BDE 4.14.0 Production release
Loading...
Searching...
No Matches
baltzo::DataFileLoader Class Reference

#include <baltzo_datafileloader.h>

Inheritance diagram for baltzo::DataFileLoader:
baltzo::Loader

Public Types

typedef bsl::allocator< char > allocator_type
 

Public Member Functions

 BSLMF_NESTED_TRAIT_DECLARATION (DataFileLoader, bslma::UsesBslmaAllocator)
 
 DataFileLoader ()
 
 DataFileLoader (const allocator_type &allocator)
 
 ~DataFileLoader () BSLS_KEYWORD_OVERRIDE
 Destroy this data-file loader.
 
void configureRootPath (const char *path)
 
int configureRootPathIfPlausible (const char *path)
 
int loadTimeZone (Zoneinfo *result, const char *timeZoneId) BSLS_KEYWORD_OVERRIDE
 
int loadTimeZoneRaw (Zoneinfo *result, const char *timeZoneId)
 
int loadTimeZoneFilePath (bsl::string *result, const char *timeZoneId) const
 
int loadTimeZoneFilePath (std::string *result, const char *timeZoneId) const
 
const bsl::stringrootPath () const
 
bool isRootPathPlausible () const
 
allocator_type get_allocator () const
 
- Public Member Functions inherited from baltzo::Loader
virtual ~Loader ()
 Destroy this object.
 

Static Public Member Functions

static bool isPlausibleZoneinfoRootPath (const char *path)
 

Detailed Description

This component provides a concrete implementation of the DataLoader protocol for loading, into a Zoneinfo, the properties of a time zone defined by an Zoneinfo (TZ Database) binary file located on the file system.

See baltzo_datafileloader

Member Typedef Documentation

◆ allocator_type

Constructor & Destructor Documentation

◆ DataFileLoader() [1/2]

baltzo::DataFileLoader::DataFileLoader ( )

◆ DataFileLoader() [2/2]

baltzo::DataFileLoader::DataFileLoader ( const allocator_type allocator)
explicit

Create an unconfigured data-file loader. Optionally specify an allocator (e.g., the address of a bslma::Allocator object) to supply memory; otherwise, the default allocator is used.

◆ ~DataFileLoader()

baltzo::DataFileLoader::~DataFileLoader ( )

Member Function Documentation

◆ BSLMF_NESTED_TRAIT_DECLARATION()

baltzo::DataFileLoader::BSLMF_NESTED_TRAIT_DECLARATION ( DataFileLoader  ,
bslma::UsesBslmaAllocator   
)

◆ configureRootPath()

void baltzo::DataFileLoader::configureRootPath ( const char *  path)

Unconditionally set, to the specified path, the root of the file-system directory hierarchy from which this loader will read Zoneinfo binary time-zone information files.

◆ configureRootPathIfPlausible()

int baltzo::DataFileLoader::configureRootPathIfPlausible ( const char *  path)

Set, to the specified path, the root of the file-system directory hierarchy from which this loader will read Zoneinfo binary time-zone information files. Return 0 on success, and a non-zero value (without no effect) if path is not a directory that appears to contain valid Zoneinfo data, as determined by calling isPlausibleZoneinfoRootPath on path.

◆ get_allocator()

DataFileLoader::allocator_type baltzo::DataFileLoader::get_allocator ( ) const
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.

◆ isPlausibleZoneinfoRootPath()

static bool baltzo::DataFileLoader::isPlausibleZoneinfoRootPath ( const char *  path)
static

Return true if there currently exists a directory at the specified file-system path that appears to contain Zoneinfo time-zone information files. This method verifies (at a minimum) that path is a valid directory, and contains files for a subset of common time-zone identifiers, but does not guarantee path is currently (or will remain) a correctly configured Zoneinfo database containing a complete set of time-zone data.

◆ isRootPathPlausible()

bool baltzo::DataFileLoader::isRootPathPlausible ( ) const
inline

Return true if the directory returned by the rootPath method exists and appears to contain valid Zoneinfo time-zone information files, as determined by calling isPlausibleZoneinfoRootPath on the value returned by the rootPath method.

◆ loadTimeZone()

int baltzo::DataFileLoader::loadTimeZone ( Zoneinfo result,
const char *  timeZoneId 
)
virtual

Load into the specified result the time-zone information for the time zone identified by the specified timeZoneId. The result will have a sentinel transition at 01-01-001, meeting the first two requirements for a "well-formed" object (see baltzo::ZoneinfoUtil::isWellFormed documentation). 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 this operation, result will be left in a valid, but unspecified state.

Implements baltzo::Loader.

◆ loadTimeZoneFilePath() [1/2]

int baltzo::DataFileLoader::loadTimeZoneFilePath ( bsl::string result,
const char *  timeZoneId 
) const

◆ loadTimeZoneFilePath() [2/2]

int baltzo::DataFileLoader::loadTimeZoneFilePath ( std::string *  result,
const char *  timeZoneId 
) const

◆ loadTimeZoneRaw()

int baltzo::DataFileLoader::loadTimeZoneRaw ( Zoneinfo result,
const char *  timeZoneId 
)

Load into the specified result the time-zone information for the time zone identified by the specified timeZoneId exactly in accordance with the original data. The result may not be a "well-formed" object (see baltzo::ZoneinfoUtil::isWellFormed documentation for details). 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 this operation, result will be left in a valid, but unspecified state. Note that time zone data files created by certain versions of the zic time zone compiler will have a sentinel transition prior to 01-01-0001 (the first representable Datetime value) and the result will therefore be non-well formed (use loadTimeZone instead).

◆ rootPath()

const bsl::string & baltzo::DataFileLoader::rootPath ( ) const

Return the root of the directory hierarchy from which this loader will attempt to load Zoneinfo binary data files. The behavior is undefined unless either configureRootPath has been called or configureRootPathIfValid has been called successfully.


The documentation for this class was generated from the following file: