BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bdlde.h
Go to the documentation of this file.
1/// @file bdlde.h
2///
3///
4/// @defgroup bdlde Package bdlde
5/// @brief Basic Development Library Data Encoder (bdlde)
6/// @addtogroup bdl
7/// @{
8/// @addtogroup bdlde
9/// [bdlde]: group__bdlde.html
10/// @{
11///
12/// # Purpose {#bdlde-purpose}
13/// Mechanisms for standard encodings and hashings, e.g., base64, md5.
14///
15/// # Mnemonic {#bdlde-mnemonic}
16/// Basic Development Library Data Encoder (bdlde)
17///
18/// @see
19///
20/// # Description {#bdlde-description}
21/// The 'bdlde' package provides mechanisms (typically in the form of
22/// fully value-semantic objects) for performing various standard hashings of an
23/// input dataset, for, e.g., basic encoding, check-sums, and cryptographic
24/// hashes.
25///
26/// ## Hierarchical Synopsis
27///
28/// The 'bdlde' package currently has 23 components having 4 levels of physical
29/// dependency. The list below shows the hierarchical ordering of the components.
30/// The order of components within each level is not architecturally significant,
31/// just alphabetical.
32/// @code
33/// 4. bdlde_base64decoder
34///
35/// 3. bdlde_base64encoder
36///
37/// 2. bdlde_base64decoderoptions
38/// bdlde_base64encoderoptions
39/// bdlde_charconvertucs2
40/// bdlde_charconvertutf16
41/// bdlde_charconvertutf32
42/// bdlde_utf8checkinginstreambufwrapper
43///
44/// 1. bdlde_base64alphabet
45/// bdlde_base64ignoremode
46/// bdlde_byteorder
47/// bdlde_charconvertstatus
48/// bdlde_crc32
49/// bdlde_crc32c
50/// bdlde_crc64
51/// bdlde_hexdecoder
52/// bdlde_hexencoder
53/// bdlde_md5
54/// bdlde_quotedprintabledecoder
55/// bdlde_quotedprintableencoder
56/// bdlde_sha1
57/// bdlde_sha2
58/// bdlde_utf8util
59/// @endcode
60///
61/// ## Component Synopsis
62///
63/// @ref bdlde_base64alphabet :
64/// Provide an enumeration of the set of possible base 64 alphabets.
65///
66/// @ref bdlde_base64decoder :
67/// Provide automata for converting to and from Base64 encodings.
68///
69/// @ref bdlde_base64decoderoptions :
70/// Provide value-semantic attribute class for decoder options.
71///
72/// @ref bdlde_base64encoder :
73/// Provide automata for converting to and from Base64 encodings.
74///
75/// @ref bdlde_base64encoderoptions :
76/// Provide a value-semantic attribute class for encoder options.
77///
78/// @ref bdlde_base64ignoremode :
79/// Provide an enumeration of the set of possible base64 ignore modes.
80///
81/// @ref bdlde_byteorder :
82/// Provide an enumeration of the set of possible byte orders.
83///
84/// @ref bdlde_charconvertstatus :
85/// Provide masks for interpreting status from charconvert functions.
86///
87/// @ref bdlde_charconvertucs2 :
88/// Provide efficient conversions between UTF-8 and UCS-2 encodings.
89///
90/// @ref bdlde_charconvertutf16 :
91/// Provide fast, safe conversion between UTF-8 and UTF-16 encodings.
92///
93/// @ref bdlde_charconvertutf32 :
94/// Provide fast, safe conversion between UTF-8 encoding and UTF-32.
95///
96/// @ref bdlde_crc32 :
97/// Provide a mechanism for computing the CRC-32 checksum of a dataset.
98///
99/// @ref bdlde_crc32c :
100/// Provide utilities to calculate the CRC32-C checksum of a dataset.
101///
102/// @ref bdlde_crc64 :
103/// Provide a mechanism for computing the CRC-64 checksum of a dataset.
104///
105/// @ref bdlde_hexdecoder :
106/// Provide mechanism for decoding text from hexadecimal.
107///
108/// @ref bdlde_hexencoder :
109/// Provide mechanism for encoding text into hexadecimal.
110///
111/// 'bdlde_md5':
112/// Provide a value-semantic type encoding a message in an MD5 digest.
113///
114/// @ref bdlde_quotedprintabledecoder :
115/// Provide automata converting to and from Quoted-Printable encodings.
116///
117/// @ref bdlde_quotedprintableencoder :
118/// Provide automata converting to and from Quoted-Printable encodings.
119///
120/// @ref bdlde_sha1 :
121/// Provide a value-semantic type encoding a message in a SHA-1 digest.
122///
123/// @ref bdlde_sha2 :
124/// Provide a value-semantic type encoding a message in a SHA-2 digest.
125///
126/// @ref bdlde_utf8checkinginstreambufwrapper :
127/// Provide a stream buffer wrapper for validating UTF-8 input.
128///
129/// @ref bdlde_utf8util :
130/// Provide basic utilities for UTF-8 encodings.
131///
132/// ## Usage
133///
134//// This section illustrates intended use of this package.
135///
136/// ### Example 1: CRC-32
137///
138/// The following snippets of code illustrate a typical use of the 'bdlde_Crc32'
139/// class. Each function would typically execute in separate processes or
140/// potentially on separate machines. The 'senderExample' function below
141/// demonstrates how a message sender can write a message and its CRC-32 checksum
142/// to a 'bdlx' output stream. Note that 'Out' may be a 'typedef' of any class
143/// that implements the 'bdlx_OutStream' protocol:
144/// @code
145/// void senderExample(Out& output)
146/// // Write a message and its CRC-32 checksum to the specified 'output'
147/// // stream.
148/// {
149/// // prepare a message
150/// bdl::string message = "This is a test message.";
151///
152/// // generate a checksum for 'message'
153/// bdlde_Crc32 crc(message.data(), message.length());
154///
155/// // write the message to 'output'
156/// output << message;
157///
158/// // write the checksum to 'output'
159/// output << crc;
160/// }
161/// @endcode
162/// The 'receiverExample' function below illustrates how a message receiver can
163/// read a message and its CRC-32 checksum from a 'bdlx' input stream, then
164/// perform a local CRC-32 computation to verify that the message was received
165/// intact. Note that 'In' may be a 'typedef' of any class that implements the
166/// 'bdlx_InStream' protocol:
167/// @code
168/// void receiverExample(In& input)
169/// // Read a message and its CRC-32 checksum from the specified 'input'
170/// // stream, and verify the integrity of the message.
171/// {
172/// // read the message from 'input'
173/// bdl::string message;
174/// input >> message;
175///
176/// // read the checksum from 'input'
177/// bdlde_Crc32 crc;
178/// input >> crc;
179///
180/// // locally compute the checksum of the received 'message'
181/// bdlde_Crc32 crcLocal;
182/// crcLocal.update(message.data(), message.length());
183///
184/// // verify that the received and locally-computed checksums match
185/// assert(crcLocal == crc);
186/// }
187/// @endcode
188///
189/// ### Example 2: MD5
190///
191/// The following snippets of code illustrate a typical use of the 'bdlde_Md5'
192/// class. Each function would typically execute in separate processes or
193/// potentially on separate machines. The 'senderExample' function below
194/// demonstrates how a message sender can write a message and its MD5 hash to a
195/// 'bdlx' output stream. Note that 'Out' may be a 'typedef' of any class that
196/// implements the 'bdlx_OutStream' protocol:
197/// @code
198/// void senderExample(Out& output)
199/// // Write a message and its MD5 hash to the specified 'output' stream.
200/// {
201/// // prepare a message
202/// bdl::string message = "This is a test message.";
203///
204/// // generate a hash for 'message'
205/// bdlde_Md5 hash(message.data(), message.length());
206///
207/// // write the message to 'output'
208/// output << message;
209///
210/// // write the hash to 'output'
211/// output << hash;
212/// }
213/// @endcode
214/// The 'receiverExample' function below illustrates how a message receiver can
215/// read a message and its MD5 hash from a 'bdlx' input stream, then perform a
216/// local MD5 computation to verify that the message was received intact. Note
217/// that 'In' may be a 'typedef' of any class that implements the 'bdlx_InStream'
218/// protocol:
219/// @code
220/// void receiverExample(In& input)
221/// // Read a message and its MD5 hash from the specified 'input' stream,
222/// // and verify the integrity of the message.
223/// {
224/// // read the message from 'input'
225/// bdl::string message;
226/// input >> message;
227///
228/// // read the hash from 'input'
229/// bdlde_Md5 hash;
230/// input >> hash;
231///
232/// // locally compute the hash of the received 'message'
233/// bdlde_Md5 hashLocal;
234/// hashLocal.update(message.data(), message.length());
235///
236/// // verify that the received and locally-computed hashes match
237/// assert(hashLocal == hash);
238/// }
239/// @endcode
240///
241/// @}
242/** @} */