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

#include <baltzo_zoneinfo.h>

Public Types

typedef bsl::allocator< char > allocator_type
 
typedef TransitionSequence::const_iterator TransitionConstIterator
 

Public Member Functions

 BSLMF_NESTED_TRAIT_DECLARATION (Zoneinfo, bslma::UsesBslmaAllocator)
 
 Zoneinfo ()
 
 Zoneinfo (const allocator_type &allocator)
 
 Zoneinfo (const Zoneinfo &original, const allocator_type &allocator=allocator_type())
 
 Zoneinfo (bslmf::MovableRef< Zoneinfo > original) BSLS_KEYWORD_NOEXCEPT
 
 Zoneinfo (bslmf::MovableRef< Zoneinfo > original, const allocator_type &allocator)
 
Zoneinfooperator= (const Zoneinfo &rhs)
 
Zoneinfooperator= (bslmf::MovableRef< Zoneinfo > rhs)
 
void addTransition (bdlt::EpochUtil::TimeT64 utcTime, const LocalTimeDescriptor &descriptor)
 
void setIdentifier (const bsl::string_view &value)
 
void setIdentifier (const char *value)
 
void setPosixExtendedRangeDescription (const bsl::string_view &value)
 
void setPosixExtendedRangeDescription (const char *value)
 
void swap (Zoneinfo &other)
 
bslma::Allocatorallocator () const
 
TransitionConstIterator findTransitionForUtcTime (const bdlt::Datetime &utcTime) const
 
const ZoneinfoTransitionfirstTransition () const
 
allocator_type get_allocator () const
 
const bsl::stringidentifier () const
 
const bsl::stringposixExtendedRangeDescription () const
 
bsl::size_t numTransitions () const
 Return the number of transitions maintained by this zone info.
 
TransitionConstIterator beginTransitions () const
 
TransitionConstIterator endTransitions () const
 
bsl::ostream & print (bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
 

Friends

bool operator== (const Zoneinfo &, const Zoneinfo &)
 

Detailed Description

This class is a value-semantic type holding a structured representation of the information contained in an Zoneinfo (or "Olson") time zone database for a single locale (e.g., "America/New_York"). The salient attributes of this type are the string identifier and the ordered sequence of ZoneinfoTransition objects.

See baltzo_zoneinfo

Member Typedef Documentation

◆ allocator_type

◆ TransitionConstIterator

Alias for a bi-directional const iterator over the sequence of transitions maintained by a Zoneinfo object.

Constructor & Destructor Documentation

◆ Zoneinfo() [1/5]

baltzo::Zoneinfo::Zoneinfo ( )
inline

◆ Zoneinfo() [2/5]

baltzo::Zoneinfo::Zoneinfo ( const allocator_type allocator)
inlineexplicit

Create a Zoneinfo object having the values:

identifier() == ""
const bsl::string & identifier() const
Definition baltzo_zoneinfo.h:834
bsl::size_t numTransitions() const
Return the number of transitions maintained by this zone info.
Definition baltzo_zoneinfo.h:846

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

◆ Zoneinfo() [3/5]

baltzo::Zoneinfo::Zoneinfo ( const Zoneinfo original,
const allocator_type allocator = allocator_type() 
)

Create a Zoneinfo object having the same value as the specified original object. Optionally specify an allocator (e.g., the address of a bslma::Allocator object) to supply memory; otherwise, the default allocator is used.

◆ Zoneinfo() [4/5]

baltzo::Zoneinfo::Zoneinfo ( bslmf::MovableRef< Zoneinfo original)

Create a Zoneinfo object having the same value and the same allocator as the specified original object. The value of original becomes unspecified but valid, and its allocator remains unchanged.

◆ Zoneinfo() [5/5]

baltzo::Zoneinfo::Zoneinfo ( bslmf::MovableRef< Zoneinfo original,
const allocator_type allocator 
)

Create a Zoneinfo object having the same value as the specified original object, using the specified allocator (e.g., the address of a bslma::Allocator object) to supply memory. The allocator of original remains unchanged. If original and the newly created object have the same allocator then the value of original becomes unspecified but valid, and no exceptions will be thrown; otherwise original is unchanged and an exception may be thrown.

Member Function Documentation

◆ addTransition()

void baltzo::Zoneinfo::addTransition ( bdlt::EpochUtil::TimeT64  utcTime,
const LocalTimeDescriptor descriptor 
)

Add to this object a transition occurring at the specified utcTime when the local time in the described time-zone adopts the characteristics of the specified descriptor. If a transition at utcTime is already present, replace it's local-time descriptor with descriptor.

◆ allocator()

bslma::Allocator * baltzo::Zoneinfo::allocator ( ) const
inline
Deprecated:
Use get_allocator() instead.

Return the allocator used by this object to supply memory. Note that if no allocator was supplied at construction the currently installed default allocator is used.

◆ beginTransitions()

Zoneinfo::TransitionConstIterator baltzo::Zoneinfo::beginTransitions ( ) const
inline

Return an iterator providing non-modifiable access to the first transition in the ordered sequence of transitions maintained by this object. Note that if beginTransitions() == endTransitions() then there are no transitions stored by this object.

◆ BSLMF_NESTED_TRAIT_DECLARATION()

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

◆ endTransitions()

Zoneinfo::TransitionConstIterator baltzo::Zoneinfo::endTransitions ( ) const
inline

Return an iterator providing non-modifiable access to the one-past the last transition in the ordered sequence of transitions that is associated with this object. Note that if beginTransitions() == endTransitions() then there are no transitions stored by this object.

◆ findTransitionForUtcTime()

TransitionConstIterator baltzo::Zoneinfo::findTransitionForUtcTime ( const bdlt::Datetime utcTime) const

Return an iterator providing non-modifiable access to the transition that holds the local-time descriptor associated with the specified utcTime. The behavior is undefined unless numTransitions() > 0 and utcTime is at or after the transition returned by firstTransition.

◆ firstTransition()

const ZoneinfoTransition & baltzo::Zoneinfo::firstTransition ( ) const
inline

Return a reference providing non-modifiable access to the first transition contained in this object. The behavior is undefined unless numTransitions() > 0.

◆ get_allocator()

Zoneinfo::allocator_type baltzo::Zoneinfo::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.

◆ identifier()

const bsl::string & baltzo::Zoneinfo::identifier ( ) const
inline

Return a reference providing non-modifiable access to the identifier attribute of this object.

◆ numTransitions()

bsl::size_t baltzo::Zoneinfo::numTransitions ( ) const
inline

◆ operator=() [1/2]

Zoneinfo & baltzo::Zoneinfo::operator= ( bslmf::MovableRef< Zoneinfo rhs)

Assign to this object the value of the specified rhs object, and return a non-const reference to this object. The allocators of this object and rhs both remain unchanged. If rhs and this object have the same allocator then the value of rhs becomes unspecified but valid, and no exceptions will be thrown; otherwise rhs is unchanged (and an exception may be thrown).

◆ operator=() [2/2]

Zoneinfo & baltzo::Zoneinfo::operator= ( const Zoneinfo rhs)
inline

Assign to this object the value of the specified rhs object, and return a reference providing modifiable access to this object.

◆ posixExtendedRangeDescription()

const bsl::string & baltzo::Zoneinfo::posixExtendedRangeDescription ( ) const
inline

Return a reference providing non-modifiable access to the posixExtendedRangeDescription attribute of this object, used to describe local time transitions far in the future (see {posixExtendedRangeDescription}).

◆ print()

bsl::ostream & baltzo::Zoneinfo::print ( bsl::ostream &  stream,
int  level = 0,
int  spacesPerLevel = 4 
) const

Write the value of 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.

◆ setIdentifier() [1/2]

void baltzo::Zoneinfo::setIdentifier ( const bsl::string_view value)
inline

◆ setIdentifier() [2/2]

void baltzo::Zoneinfo::setIdentifier ( const char *  value)
inline

Set the identifier attribute of this object to the specified value.

◆ setPosixExtendedRangeDescription() [1/2]

void baltzo::Zoneinfo::setPosixExtendedRangeDescription ( const bsl::string_view value)
inline

◆ setPosixExtendedRangeDescription() [2/2]

void baltzo::Zoneinfo::setPosixExtendedRangeDescription ( const char *  value)
inline

Set the posixExtendedRangeDescription attribute of this object, used to describe local time transitions far in the future, to the specified value (see {posixExtendedRangeDescription}).

◆ swap()

void baltzo::Zoneinfo::swap ( Zoneinfo other)
inline

Efficiently exchange the value of this object with the value of the specified other object. This method provides the no-throw exception-safety guarantee. The behavior is undefined unless this object was created with the same allocator as other.

Friends And Related Symbol Documentation

◆ operator==

bool operator== ( const Zoneinfo ,
const Zoneinfo  
)
friend

Return true if the specified lhs and rhs objects have the same value, and false otherwise. Two Zoneinfo objects have the same value if the corresponding value of their identifier attribute is the same and if both store the same sequence of transitions, ordered by time.


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