Outline
Purpose
Enumerate the set of month-of-year values.
Classes
Description
This component provides a namespace for the enum
type, bdlt::MonthOfYear::Enum
, that enumerates the set of month-of-year values.
Enumerators
Name Description
------------------- ----------------------------------
e_JANUARY, e_JAN Enumerators representing January
e_FEBRUARY, e_FEB Enumerators representing February
e_MARCH, e_MAR Enumerators representing March
e_APRIL, e_APR Enumerators representing April
e_MAY Enumerator representing May
e_JUNE, e_JUN Enumerators representing June
e_JULY, e_JUL Enumerators representing July
e_AUGUST, e_AUG Enumerators representing August
e_SEPTEMBER, e_SEP Enumerators representing September
e_OCTOBER, e_OCT Enumerators representing October
e_NOVEMBER, e_NOV Enumerators representing November
e_DECEMBER, e_DEC Enumerators representing December
k_NUM_MONTHS Number of enumerators in the range
'[ e_JAN .. e_DEC ]'.
Usage
This section illustrates intended use of this component.
Example 1: Basic Syntax
The following snippets of code provide a simple illustration of bdlt::MonthOfYear
usage.
First, we create a variable value
of type bdlt::MonthOfYear::Enum
and initialize it to the value bdlt::MonthOfYear::e_APRIL
:
Enum
Define the list of month-of-year values.
Definition bdlt_monthofyear.h:134
@ e_APRIL
Definition bdlt_monthofyear.h:139
Next, we store a pointer to its ASCII representation in a variable asciiValue
of type const char *
:
assert(0 == bsl::strcmp(asciiValue, "APR"));
static const char * toAscii(MonthOfYear::Enum value)
Finally, we print the value to bsl::cout
:
bsl::cout << value << bsl::endl;
This statement produces the following output on stdout
: