BDE 4.14.0 Production release
Loading...
Searching...
No Matches
baltzo_dstpolicy

Detailed Description

Outline

Purpose

Enumerate the set of daylight-saving time (DST) policy values.

Classes

See also
baltzo_localtimevalidity, baltzo_timezoneutil

Description

This component provides a namespace for the enum type baltzo::DstPolicy::Enum, which enumerates the set of policies for interpreting whether an associated local time is a daylight-saving time value. A baltzo::DstPolicy is particularly important when interpreting a local time that is not associated with a UTC offset (e.g., a bdlt::Datetime object), as such a representation may be ambiguous or invalid (see baltzo_localtimevalidity ).

Enumerators

Name Description
------------- ---------------------------------------------------
e_DST Local time is interpreted as daylight-saving time.
e_STANDARD Local time is interpreted as standard time.
e_UNSPECIFIED Local time is interpreted as either daylight-saving time or
standard time (as appropriate).

Usage

This section illustrates intended use of this component.

Example 1: Basic Syntax

The following snippets of code provide a simple illustration of using baltzo::DstPolicy.

First, we create a variable value of type baltzo::DstPolicy::Enum and initialize it with the enumerator value baltzo::DstPolicy::e_STANDARD:

Enum
Definition baltzo_dstpolicy.h:131
@ e_STANDARD
Definition baltzo_dstpolicy.h:135

Now, we store the address of its ASCII representation in a pointer variable, asciiValue, of type const char *:

const char *asciiValue = baltzo::DstPolicy::toAscii(value);
assert(0 == bsl::strcmp(asciiValue, "STANDARD"));
static const char * toAscii(DstPolicy::Enum value)

Finally, we print value to bsl::cout.

bsl::cout << value << bsl::endl;

This statement produces the following output on stdout:

STANDARD