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

Detailed Description

Outline

Purpose

Provide masks for interpreting status from charconvert functions.

Classes

See also
bdlde_charconvertutf16, bdlde_charconvertucs2

Description

This component provides a namespace for the enum type bdlde::CharConvertStatus::Enum, which enumerates the set of bit-wise masks that can be used to interpret return values from translation functions in components bdlde_charconvertutf16 and bdlde_charconvertucs2 .

Enumerators

Name Description
------------------- ---------------------------------------------
k_INVALID_INPUT_BIT Invalid code points or sequences of bytes / words
were encountered in the input.
k_OUT_OF_SPACE_BIT The space provided for the output was
insufficient for the translation.

Usage

This section illustrates intended use of this component.

Example 1: Basic Syntax

The following snippets of code provide a simple illustration of bdlde::CharConvertStatus usage.

First, we create a variable value of type bdlde::CharConvertStatus::Enum and initialize it with the value 3, which is not a valid value of the enum.

Enum
Definition bdlde_charconvertstatus.h:130
@ k_INVALID_INPUT_BIT
Definition bdlde_charconvertstatus.h:131

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

const char *asciiValue = bdlde::CharConvertStatus::toAscii(value);
assert(0 == bsl::strcmp(asciiValue, "INVALID_INPUT_BIT"));
static const char * toAscii(CharConvertStatus::Enum value)

Finally, we print value to bsl::cout.

if (veryVerbose) {
bsl::cout << value << bsl::endl;
}

This statement produces the following output on stdout:

INVALID_INPUT_BIT