Provide an enumeration of the set of possible byte orders.
More...
Namespaces |
namespace | bdlde |
Detailed Description
- Outline
-
-
- Purpose:
- Provide an enumeration of the set of possible byte orders.
-
- Classes:
-
- See also:
- Component bdlde_charconvertutf16
-
- Description:
- This component provides a namespace for the
enum
type bdlde::ByteOrder::Enum
, which enumerates the set of possible byte orders.
-
- Enumerators:
Name Description
--------------- ---------------------------------------------------
e_LITTLE_ENDIAN little-endian
e_BIG_ENDIAN big-endian
e_NETWORK network byte order (aliased to 'e_BIG_ENDIAN')
e_HOST aliased to 'e_LITTLE_ENDIAN' or 'e_BIG_ENDIAN' (depending
on platform)
-
- Usage:
- In this section we show intended use of this component.
-
- Example 1: Basic Syntax:
- The following snippets of code provide a simple illustration of
bdlde::ByteOrder
usage.
- First, we create a variable
value
of type bdlde::ByteOrder::Enum
and initialize it with the enumerator value bdlde::ByteOrder::e_LITTLE_ENDIAN
: Next, we store a pointer to its ASCII representation in a variable asciiValue
of type const char *
: Then, we try one of the aliased identifiers, and we get a string corresponding to the value it is aliased to: value = bdlde::ByteOrder::e_NETWORK;
asciiValue = bdlde::ByteOrder::toAscii(value);
assert(0 == bsl::strcmp(asciiValue, "BIG_ENDIAN"));
Finally, we print value
to bsl::cout
: bsl::cout << value << bsl::endl;
This statement produces the following output on stdout
: