BDE 4.14.0 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 .
134
135 // PUBLIC TYPES
136 enum Enum { e_IGNORE_NONE, // any unrecognized character is an
137 // error
138
139 e_IGNORE_WHITESPACE, // any unrecognized character other
140 // than whitespace is an error
141
142 e_IGNORE_UNRECOGNIZED // no unrecognized character is an
143 // error
144 };
145
146 public:
147 // CLASS METHODS
148
149 /// Write the string representation of the specified enumeration `value`
150 /// to the specified output `stream`, and return a reference to
151 /// `stream`. Optionally specify an initial indentation `level`, whose
152 /// absolute value is incremented recursively for nested objects. If
153 /// `level` is specified, optionally specify `spacesPerLevel`, whose
154 /// absolute value indicates the number of spaces per indentation level
155 /// for this and all of its nested objects. If `level` is negative,
156 /// suppress indentation of the first line. If `spacesPerLevel` is
157 /// negative, format the entire output on one line, suppressing all but
158 /// the initial indentation (as governed by `level`). See `toAscii` for
159 /// what constitutes the string representation of a
160 /// `ByteOrder::Enum` value.
161 static bsl::ostream& print(bsl::ostream& stream,
162 Enum value,
163 int level = 0,
164 int spacesPerLevel = 4);
165
166 /// Return the non-modifiable string representation corresponding to the
167 /// specified enumeration `value`, if it exists, and a unique (error)
168 /// string otherwise. The string representation of `value` matches the
169 /// name of its corresponding base enumeration with the "e_" prefix
170 /// elided. For example:
171 /// @code
172 /// bsl::cout << ByteOrder::toAscii(ByteOrder::e_IGNORE_NODE);
173 /// @endcode
174 /// will print the following on standard output:
175 /// @code
176 /// IGNORE_NONE
177 /// @endcode
178 /// Note that specifying a `value` that does not match any of the
179 /// enumerators will result in a string representation that is distinct
180 /// from any of those corresponding to the enumerators, but is otherwise
181 /// unspecified.
182 static const char *toAscii(Enum value);
183};
184
185// FREE OPERATORS
186
187/// Write the string representation of the specified enumeration `value` to
188/// the specified output `stream` in a single-line format, and return a
189/// reference to `stream`. See `toAscii` for what constitutes the string
190/// representation of a `bdlde::Base64Alphabet::Enum` value. Note that this
191/// method has the same behavior as
192/// @code
193/// bdlde::Base64Alphabet::print(stream, value, 0, -1);
194/// @endcode
195bsl::ostream& operator<<(bsl::ostream& stream, Base64IgnoreMode::Enum value);
196
197} // close package namespace
198
199
200#endif
201
202// ----------------------------------------------------------------------------
203// Copyright 2022 Bloomberg Finance L.P.
204//
205// Licensed under the Apache License, Version 2.0 (the "License");
206// you may not use this file except in compliance with the License.
207// You may obtain a copy of the License at
208//
209// http://www.apache.org/licenses/LICENSE-2.0
210//
211// Unless required by applicable law or agreed to in writing, software
212// distributed under the License is distributed on an "AS IS" BASIS,
213// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
214// See the License for the specific language governing permissions and
215// limitations under the License.
216// ----------------------------- END-OF-FILE ----------------------------------
217
218/** @} */
219/** @} */
220/** @} */
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
Definition bdlde_base64alphabet.h:118
bsl::ostream & operator<<(bsl::ostream &stream, Base64Alphabet::Enum value)
Definition bdlde_base64ignoremode.h:133
Enum
Definition bdlde_base64ignoremode.h:136
@ e_IGNORE_WHITESPACE
Definition bdlde_base64ignoremode.h:139
@ e_IGNORE_UNRECOGNIZED
Definition bdlde_base64ignoremode.h:142
@ e_IGNORE_NONE
Definition bdlde_base64ignoremode.h:136
static bsl::ostream & print(bsl::ostream &stream, Enum value, int level=0, int spacesPerLevel=4)
static const char * toAscii(Enum value)