BDE 4.39.x Production Release
Loading...
Searching...
No Matches
bdlt_dayofweek

Detailed Description

Provide an enumeration of the set of days of the week.

Outline

Purpose

Provide an enumeration of the set of days of the week.

Classes

Description

This component provides a namespace for the enum type bdlt::DayOfWeek::Enum, which enumerates the set of days of the week.

Enumerators

Long Name Short Name Description
----------- ---------- -----------
e_SUNDAY e_SUN Sunday
e_MONDAY e_MON Monday
e_TUESDAY e_TUE Tuesday
e_WEDNESDAY e_WED Wednesday
e_THURSDAY e_THU Thursday
e_FRIDAY e_FRI Friday
e_SATURDAY e_SAT Saturday

Usage

This section illustrates intended use of this component.

Example 1: Basic Syntax

The following snippets of code provide a simple illustration of bdlt::DayOfWeek operation.

First, create a variable, day, of type bdlt::DayOfWeek::Enum, and initialize it to the value bdlt::DayOfWeek::e_MONDAY:

Enum
Enumerated day-of-week values.
Definition bdlt_dayofweek.h:125
@ e_MONDAY
Definition bdlt_dayofweek.h:128

Next, store its representation in a variable, rep, of type const char *:

const char *rep = bdlt::DayOfWeek::toAscii(day);
assert(0 == bsl::strcmp(rep, "MON"));
static const char * toAscii(Enum dayOfWeek)

Finally, we print the value of day to stdout:

bsl::cout << day << bsl::endl;

This statement produces the following output on stdout:

MON