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

Detailed Description

Outline

Purpose

Provide an enumeration of the set of possible base64 ignore modes.

Classes

See also
bdlde_base64decoderoptions, bdlde_base64decoder

Description

This component provides a namespace for the enum type bdlde::Base64IgnoreMode::Enum, which enumerates the set of possible ignore modes for the bdlde::Base64Decoder.

Enumerators

Name Description
--------------- ---------------------------------------------------
e_IGNORE_NONE Any unrecognized character is an error
e_IGNORE_WHITESPACE Any unrecognized character other than whitespace is
an error
e_IGNORE_UNRECOGNIZED No unrecognized character is an error

Usage

This section illustrates intended use of this component.

Example 1: Basic Syntax

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

First, we create variable of type bdlde::Base64IgnoreMode::Enum and initialize it with the enumerator values:

Enum
Definition bdlde_base64ignoremode.h:136
@ e_IGNORE_WHITESPACE
Definition bdlde_base64ignoremode.h:139
@ e_IGNORE_NONE
Definition bdlde_base64ignoremode.h:136

Next, we store a pointer to their ASCII representation in variables of type const char *:

const char *asciiNone = bdlde::Base64IgnoreMode::toAscii(none);
const char *asciiWhitespace = bdlde::Base64IgnoreMode::toAscii(whitespace);
assert(0 == bsl::strcmp(asciiNone, "IGNORE_NONE"));
assert(0 == bsl::strcmp(asciiWhitespace, "IGNORE_WHITESPACE"));
static const char * toAscii(Enum value)

Now, we stream some Enums to ostreams:

bsl::ostringstream ossNone, ossWhitespace;
ossNone << none;
ossWhitespace << whitespace;
Definition bslstl_ostringstream.h:175

Finally, we observe the output of the streaming:

assert(ossNone.str() == "IGNORE_NONE");
assert(ossWhitespace.str() == "IGNORE_WHITESPACE");
assert(ossNone.str() == asciiNone);
assert(ossWhitespace.str() == asciiWhitespace);
void str(const StringType &value)
Definition bslstl_ostringstream.h:581