|
BDE 4.39.x Production Release
|
#include <baltzo_testloader.h>
This class provides a concrete test implementation of the Loader protocol (an abstract interface) for obtaining a time zone. This test implementation maintains a mapping of time-zone identifiers to Zoneinfo objects. Time zone information objects are associated with a time-zone identifier using the setTimeZone method, and can be subsequently accessed by calling the protocol method loadTimeZone with the same identifier.
Public Types | |
| typedef bsl::allocator< char > | allocator_type |
Public Member Functions | |
| BSLMF_NESTED_TRAIT_DECLARATION (TestLoader, bslma::UsesBslmaAllocator) | |
| TestLoader () | |
| TestLoader (const allocator_type &allocator) | |
| ~TestLoader () BSLS_KEYWORD_OVERRIDE | |
| void | setTimeZone (const Zoneinfo &timeZone) |
| int | setTimeZone (const char *timeZoneId, const char *timeZoneData, int timeZoneDataNumBytes) |
| int | loadTimeZone (Zoneinfo *result, const char *timeZoneId) BSLS_KEYWORD_OVERRIDE |
| allocator_type | get_allocator () const |
| bsl::ostream & | print (bsl::ostream &stream, int level=0, int spacesPerLevel=4) const |
Public Member Functions inherited from baltzo::Loader | |
| virtual | ~Loader () |
| typedef bsl::allocator<char> baltzo::TestLoader::allocator_type |
|
inline |
Create a TestLoader object. Optionally specify an allocator (e.g., the address of a bslma::Allocator object) to supply memory; otherwise, the default allocator is used. By default the test loader will return ErrorCode::k_UNSUPPORTED_ID for all time-zone identifiers.
|
inlineexplicit |
| baltzo::TestLoader::~TestLoader | ( | ) |
Destroy this TestLoader object;.
| baltzo::TestLoader::BSLMF_NESTED_TRAIT_DECLARATION | ( | TestLoader | , |
| bslma::UsesBslmaAllocator | |||
| ) |
|
inline |
Return the allocator used by this object to supply memory.
|
virtual |
Load into the specified result the time-zone information for the time-zone identified by the specified timeZoneId. Return 0 on success, and a non-zero value otherwise. A return status of ErrorCode::k_UNSUPPORTED_ID indicates that timeZoneId is not recognized. If an error occurs during the operation, result will be left in a valid but unspecified state.
Implements baltzo::Loader.
| bsl::ostream & baltzo::TestLoader::print | ( | bsl::ostream & | stream, |
| int | level = 0, |
||
| int | spacesPerLevel = 4 |
||
| ) | const |
Write the set of time zones maintained by this object to the specified output stream in a human-readable format, and return a reference to stream. Optionally specify an initial indentation level, whose absolute value is incremented recursively for nested objects. If level is specified, optionally specify spacesPerLevel, whose absolute value indicates the number of spaces per indentation level for this and all of its nested objects. If level is negative, suppress indentation of the first line. If spacesPerLevel is negative, format the entire output on one line, suppressing all but the initial indentation (as governed by level). If stream is not valid on entry, this operation has no effect.
| int baltzo::TestLoader::setTimeZone | ( | const char * | timeZoneId, |
| const char * | timeZoneData, | ||
| int | timeZoneDataNumBytes | ||
| ) |
Set the time-zone data this test loader will return for the specified timeZoneId to the Zoneinfo value defined by reading the specified timeZoneData buffer, holding data in the Zoneinfo standard binary file format, of at least the specified timeZoneDataNumBytes. Return 0 on success, or a negative value if an error occurs.
timeZoneData contains at least timeZoneDataNumBytes bytes. | void baltzo::TestLoader::setTimeZone | ( | const Zoneinfo & | timeZone | ) |
Set, to the specified timeZone, the time-zone information that will be returned by loadTimeZone for the identifier timeZone.identifier().