Quick Links:

bal | bbl | bdl | bsl

Namespaces

Component bdlde_base64alphabet
[Package bdlde]

Provide an enumeration of the set of possible base 64 alphabets. More...

Namespaces

namespace  bdlde

Detailed Description

Outline
Purpose:
Provide an enumeration of the set of possible base 64 alphabets.
Classes:
bdlde::Base64Alphabet namespace for an alphabet enum
See also:
bdlde_base64encorderoptions, bdlde_base64decorderoptions, Component bdlde_base64encoder, Component bdlde_base64decoder
Description:
This component provides a namespace for the enum type bdlde::Base64Alphabet::Enum, which enumerates the set of possible alphabets.
Enumerators:
  Name              Description
  ---------------   ---------------------------------------------------
  e_BASIC           standard base64 alphabet
  e_URL             URL-safe base64 alphabet
Usage:
In this section we show intended use of this component.
Example 1:
The following snippets of code provide a simple illustration of bdlde::Base64Alphabet usage.
First, we create variable of type bdlde::Base64Alphabet::Enum and initialize it with the enumerator values:
  const bdlde::Base64Alphabet::Enum basic = bdlde::Base64Alphabet::e_BASIC;
  const bdlde::Base64Alphabet::Enum url   = bdlde::Base64Alphabet::e_URL;
Next, we store a pointer to their ASCII representation in variables of type const char *:
  const char *asciiBasic = bdlde::Base64Alphabet::toAscii(basic);
  const char *asciiUrl   = bdlde::Base64Alphabet::toAscii(url);
  assert(0 == bsl::strcmp(asciiBasic, "BASIC"));
  assert(0 == bsl::strcmp(asciiUrl,   "URL"));
Now, we stream some Enums to ostreams:
  bsl::ostringstream ossBasic, ossUrl;

  ossBasic << basic;
  ossUrl   << url;
Finally, we observe the output of the streaming:
  assert(ossBasic.str() == "BASIC");
  assert(ossUrl.str()   == "URL");

  assert(ossBasic.str() == asciiBasic);
  assert(ossUrl.str()   == asciiUrl);