BDE 4.14.0 Production release
|
#include <baltzo_testloader.h>
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 | |
Destroy this TestLoader object;. | |
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 () |
Destroy this object. | |
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.
typedef bsl::allocator<char> baltzo::TestLoader::allocator_type |
|
inline |
|
inlineexplicit |
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.
baltzo::TestLoader::~TestLoader | ( | ) |
baltzo::TestLoader::BSLMF_NESTED_TRAIT_DECLARATION | ( | TestLoader | , |
bslma::UsesBslmaAllocator | |||
) |
|
inline |
Return the allocator used by this object to supply memory. Note that if no allocator was supplied at construction the default allocator in effect at construction is used.
|
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. Note that the format is not fully specified, and can change without notice.
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. The behavior is undefined unless 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()
.