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

Detailed Description

Outline

Purpose

Enumerate the set of named errors for the baltzo package.

Classes

See also
baltzo_localtimedescriptor, baltzo_timezoneutil

Description

This component provides a namespace, baltzo::ErrorCode, for the enum type baltzo::ErrorCode::Enum, which enumerates the set of named error codes returned by functions across the baltzo package.

Enumerators

Name Description
---------------- --------------------------------------
k_UNSUPPORTED_ID Time zone identifier is not supported.
k_OUT_OF_RANGE A conversion would have resulted in a value outside of
the valid range

Usage

This section illustrates intended use of this component.

Example 1: Basic Syntax

The following snippets of code provide a simple illustration of baltzo::ErrorCode usage.

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

Enum
Definition baltzo_errorcode.h:126
@ k_UNSUPPORTED_ID
Definition baltzo_errorcode.h:127

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

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

Finally, we print value to bsl::cout.

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

This statement produces the following output on stdout:

UNSUPPORTED_ID