BDE 4.39.x Production Release
Loading...
Searching...
No Matches
bdlde_base64ignoremode.h
Go to the documentation of this file.
1/// @file bdlde_base64ignoremode.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// bdlde_base64ignoremode.h -*-C++-*-
8#ifndef INCLUDED_BDLDE_BASE64IGNOREMODE
9#define INCLUDED_BDLDE_BASE64IGNOREMODE
10
11#include <bsls_ident.h>
12BSLS_IDENT("$Id: $")
13
14/// @defgroup bdlde_base64ignoremode bdlde_base64ignoremode
15/// @brief Provide an enumeration of the set of possible base64 ignore modes.
16/// @addtogroup bdl
17/// @{
18/// @addtogroup bdlde
19/// @{
20/// @addtogroup bdlde_base64ignoremode
21/// @{
22///
23/// <h1> Outline </h1>
24/// * <a href="#bdlde_base64ignoremode-purpose"> Purpose</a>
25/// * <a href="#bdlde_base64ignoremode-classes"> Classes </a>
26/// * <a href="#bdlde_base64ignoremode-description"> Description </a>
27/// * <a href="#bdlde_base64ignoremode-enumerators"> Enumerators </a>
28/// * <a href="#bdlde_base64ignoremode-usage"> Usage </a>
29/// * <a href="#bdlde_base64ignoremode-example-1-basic-syntax"> Example 1: Basic Syntax </a>
30///
31/// # Purpose {#bdlde_base64ignoremode-purpose}
32/// Provide an enumeration of the set of possible base64 ignore modes.
33///
34/// # Classes {#bdlde_base64ignoremode-classes}
35///
36/// - bdlde::Base64IgnoreMode: namespace for an ignore mode `enum`
37///
38/// @see bdlde_base64decoderoptions, bdlde_base64decoder
39///
40/// # Description {#bdlde_base64ignoremode-description}
41/// This component provides a namespace for the `enum` type
42/// `bdlde::Base64IgnoreMode::Enum`, which enumerates the set of possible ignore
43/// modes for the `bdlde::Base64Decoder`.
44///
45/// ## Enumerators {#bdlde_base64ignoremode-enumerators}
46///
47///
48/// @code
49/// Name Description
50/// --------------- ---------------------------------------------------
51/// e_IGNORE_NONE Any unrecognized character is an error
52/// e_IGNORE_WHITESPACE Any unrecognized character other than whitespace is
53/// an error
54/// e_IGNORE_UNRECOGNIZED No unrecognized character is an error
55/// @endcode
56///
57/// ## Usage {#bdlde_base64ignoremode-usage}
58///
59///
60/// This section illustrates intended use of this component.
61///
62/// ### Example 1: Basic Syntax {#bdlde_base64ignoremode-example-1-basic-syntax}
63///
64///
65/// The following snippets of code provide a simple illustration of
66/// `bdlde::Base64IgnoreMode` usage.
67///
68/// First, we create variable of type `bdlde::Base64IgnoreMode::Enum` and
69/// initialize it with the enumerator values:
70/// @code
71/// const bdlde::Base64IgnoreMode::Enum none =
72/// bdlde::Base64IgnoreMode::e_IGNORE_NONE;
73/// const bdlde::Base64IgnoreMode::Enum whitespace =
74/// bdlde::Base64IgnoreMode::e_IGNORE_WHITESPACE;
75/// @endcode
76/// Next, we store a pointer to their ASCII representation in variables of type
77/// `const char *`:
78/// @code
79/// const char *asciiNone = bdlde::Base64IgnoreMode::toAscii(none);
80/// const char *asciiWhitespace = bdlde::Base64IgnoreMode::toAscii(whitespace);
81/// assert(0 == bsl::strcmp(asciiNone, "IGNORE_NONE"));
82/// assert(0 == bsl::strcmp(asciiWhitespace, "IGNORE_WHITESPACE"));
83/// @endcode
84/// Now, we stream some `Enum`s to `ostream`s:
85/// @code
86/// bsl::ostringstream ossNone, ossWhitespace;
87///
88/// ossNone << none;
89/// ossWhitespace << whitespace;
90/// @endcode
91/// Finally, we observe the output of the streaming:
92/// @code
93/// assert(ossNone.str() == "IGNORE_NONE");
94/// assert(ossWhitespace.str() == "IGNORE_WHITESPACE");
95///
96/// assert(ossNone.str() == asciiNone);
97/// assert(ossWhitespace.str() == asciiWhitespace);
98/// @endcode
99/// @}
100/** @} */
101/** @} */
102
103/** @addtogroup bdl
104 * @{
105 */
106/** @addtogroup bdlde
107 * @{
108 */
109/** @addtogroup bdlde_base64ignoremode
110 * @{
111 */
112
113#include <bdlscm_version.h>
114
115#include <bsls_platform.h>
116
117#include <bsl_iosfwd.h>
118
119
120namespace bdlde {
121
122 // =======================
123 // struct Base64IgnoreMode
124 // =======================
125
126/// This `struct` provides a namespace for enumerating the set of ignore
127/// modes. See `Enum` in the TYPES sub-section for details.
128///
129/// This class:
130/// * supports a complete set of *enumeration* operations
131/// - except for `bdex` serialization
132/// For terminology see @ref bsldoc_glossary .
133///
134/// See @ref bdlde_base64ignoremode
136
137 // PUBLIC TYPES
138 enum Enum { e_IGNORE_NONE, // any unrecognized character is an
139 // error
140
141 e_IGNORE_WHITESPACE, // any unrecognized character other
142 // than whitespace is an error
143
144 e_IGNORE_UNRECOGNIZED // no unrecognized character is an
145 // error
146 };
147
148 public:
149 // CLASS METHODS
150
151 /// Write the string representation of the specified enumeration `value`
152 /// to the specified output `stream`, and return a reference to
153 /// `stream`. Optionally specify an initial indentation `level`, whose
154 /// absolute value is incremented recursively for nested objects. If
155 /// `level` is specified, optionally specify `spacesPerLevel`, whose
156 /// absolute value indicates the number of spaces per indentation level
157 /// for this and all of its nested objects. If `level` is negative,
158 /// suppress indentation of the first line. If `spacesPerLevel` is
159 /// negative, format the entire output on one line, suppressing all but
160 /// the initial indentation (as governed by `level`). See `toAscii` for
161 /// what constitutes the string representation of a
162 /// `ByteOrder::Enum` value.
163 static bsl::ostream& print(bsl::ostream& stream,
164 Enum value,
165 int level = 0,
166 int spacesPerLevel = 4);
167
168 /// Return the non-modifiable string representation corresponding to the
169 /// specified enumeration `value`, if it exists, and a unique (error)
170 /// string otherwise. The string representation of `value` matches the
171 /// name of its corresponding base enumeration with the "e_" prefix
172 /// elided. For example:
173 /// @code
174 /// bsl::cout << ByteOrder::toAscii(ByteOrder::e_IGNORE_NODE);
175 /// @endcode
176 /// will print the following on standard output:
177 /// @code
178 /// IGNORE_NONE
179 /// @endcode
180 ///
181 /// \note Note that specifying a `value` that does not match any of the
182 /// enumerators will result in a string representation that is distinct
183 /// from any of those corresponding to the enumerators, but is otherwise
184 /// unspecified.
185 static const char *toAscii(Enum value);
186};
187
188// FREE OPERATORS
189
190/// Write the string representation of the specified enumeration `value` to
191/// the specified output `stream` in a single-line format, and return a
192/// reference to `stream`. See `toAscii` for what constitutes the string representation of a `bdlde::Base64Alphabet::Enum` value.
193///
194/// \note Note that this
195/// method has the same behavior as
196/// @code
197/// bdlde::Base64Alphabet::print(stream, value, 0, -1);
198/// @endcode
199bsl::ostream& operator<<(bsl::ostream& stream, Base64IgnoreMode::Enum value);
200
201} // close package namespace
202
203
204#endif
205
206// ----------------------------------------------------------------------------
207// Copyright 2022 Bloomberg Finance L.P.
208//
209// Licensed under the Apache License, Version 2.0 (the "License");
210// you may not use this file except in compliance with the License.
211// You may obtain a copy of the License at
212//
213// http://www.apache.org/licenses/LICENSE-2.0
214//
215// Unless required by applicable law or agreed to in writing, software
216// distributed under the License is distributed on an "AS IS" BASIS,
217// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
218// See the License for the specific language governing permissions and
219// limitations under the License.
220// ----------------------------- END-OF-FILE ----------------------------------
221
222/** @} */
223/** @} */
224/** @} */
#define BSLS_IDENT(str)
BSLS_IDENT() - insert string into .comment binary segment (if supported)
Definition bsls_ident.h:238
Definition bdlde_base64alphabet.h:118
bsl::ostream & operator<<(bsl::ostream &stream, Base64Alphabet::Enum value)
Definition bdlde_base64ignoremode.h:135
Enum
Definition bdlde_base64ignoremode.h:138
@ e_IGNORE_WHITESPACE
Definition bdlde_base64ignoremode.h:141
@ e_IGNORE_UNRECOGNIZED
Definition bdlde_base64ignoremode.h:144
@ e_IGNORE_NONE
Definition bdlde_base64ignoremode.h:138
static bsl::ostream & print(bsl::ostream &stream, Enum value, int level=0, int spacesPerLevel=4)
static const char * toAscii(Enum value)