BDE 4.39.x Production Release
Loading...
Searching...
No Matches
baljsn_encodingstyle.h
Go to the documentation of this file.
1/// @file baljsn_encodingstyle.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// baljsn_encodingstyle.h *DO NOT EDIT* @generated -*-C++-*-
8#ifndef INCLUDED_BALJSN_ENCODINGSTYLE
9#define INCLUDED_BALJSN_ENCODINGSTYLE
10
11#include <bsls_ident.h>
12BSLS_IDENT("$Id: $")
13
14/// @defgroup baljsn_encodingstyle baljsn_encodingstyle
15/// @brief Provide value-semantic attribute classes.
16/// @addtogroup bal
17/// @{
18/// @addtogroup baljsn
19/// @{
20/// @addtogroup baljsn_encodingstyle
21/// @{
22///
23/// <h1> Outline </h1>
24/// * <a href="#baljsn_encodingstyle-purpose"> Purpose</a>
25/// * <a href="#baljsn_encodingstyle-implementation-note"> Implementation Note </a>
26///
27/// # Purpose {#baljsn_encodingstyle-purpose}
28/// Provide value-semantic attribute classes.
29///
30/// ### Implementation Note {#baljsn_encodingstyle-implementation-note}
31///
32///
33/// This file was generated from a script and was subsequently modified to add
34/// documentation and to make other changes. The steps to generate and update
35/// this file can be found in the `doc/generating_codec_options.txt` file.
36/// @}
37/** @} */
38/** @} */
39
40/** @addtogroup bal
41 * @{
42 */
43/** @addtogroup baljsn
44 * @{
45 */
46/** @addtogroup baljsn_encodingstyle
47 * @{
48 */
49
50#include <balscm_version.h>
51
52#include <bslalg_typetraits.h>
53
54#include <bdlat_attributeinfo.h>
56#include <bdlat_typetraits.h>
57
58#include <bsls_assert.h>
59
60#include <bsl_iosfwd.h>
61#include <bsl_ostream.h>
62#include <bsl_string.h>
63#include <bsl_string_view.h>
64
65
66
67namespace baljsn {
68
69 // ===================
70 // class EncodingStyle
71 // ===================
72
73/// Enumeration of encoding style (COMPACT or PRETTY).
74///
75/// See @ref baljsn_encodingstyle
77
78 public:
79 // TYPES
80 enum Value {
81 e_COMPACT = 0
83 };
84
85 enum {
87 };
88
89 // CONSTANTS
90 static const char CLASS_NAME[];
91
93
94 // CLASS METHODS
95
96 /// Return the string representation exactly matching the enumerator
97 /// name corresponding to the specified enumeration `value`.
98 static const char *toString(Value value);
99
100 /// Load into the specified `result` the enumerator matching the
101 /// specified `string` of the specified `stringLength`. Return 0 on
102 /// success, and a non-zero value with no effect on `result` otherwise
103 /// (i.e., `string` does not match any enumerator).
104 static int fromString(Value *result,
105 const char *string,
106 int stringLength);
107
108 /// Load into the specified `result` the enumerator matching the
109 /// specified `string`. Return 0 on success, and a non-zero value with
110 /// no effect on `result` otherwise (i.e., `string` does not match any
111 /// enumerator).
112 static int fromString(Value *result,
113 const bsl::string_view& string);
114
115 /// Load into the specified `result` the enumerator matching the
116 /// specified `number`. Return 0 on success, and a non-zero value with
117 /// no effect on `result` otherwise (i.e., `number` does not match any
118 /// enumerator).
119 static int fromInt(Value *result, int number);
120
121 /// Write to the specified `stream` the string representation of
122 /// the specified enumeration `value`. Return a reference to
123 /// the modifiable `stream`.
124 static bsl::ostream& print(bsl::ostream& stream, Value value);
125};
126
127// FREE OPERATORS
128
129/// Format the specified `rhs` to the specified output `stream` and
130/// return a reference to the modifiable `stream`.
131inline
132bsl::ostream& operator<<(bsl::ostream& stream, EncodingStyle::Value rhs);
133
134} // close package namespace
135
136// TRAITS
137
139
140// ============================================================================
141// INLINE FUNCTION DEFINITIONS
142// ============================================================================
143
144namespace baljsn {
145
146 // -------------------
147 // class EncodingStyle
148 // -------------------
149
150// CLASS METHODS
151inline
153{
154 return fromString(result,
155 string.data(),
156 static_cast<int>(string.length()));
157}
158
159inline
160bsl::ostream& EncodingStyle::print(bsl::ostream& stream,
162{
163 return stream << toString(value);
164}
165
166} // close package namespace
167
168// FREE FUNCTIONS
169
170inline
171bsl::ostream& baljsn::operator<<(
172 bsl::ostream& stream,
174{
175 return baljsn::EncodingStyle::print(stream, rhs);
176}
177
178
179#endif
180
181// GENERATED BY BLP_BAS_CODEGEN_3.8.24 Fri Feb 17 12:35:40 2017
182// USING bas_codegen.pl -m msg --package baljsn --noExternalization -E --noAggregateConversion baljsn.xsd
183// SERVICE VERSION
184// ----------------------------------------------------------------------------
185// Copyright 2015 Bloomberg Finance L.P.
186//
187// Licensed under the Apache License, Version 2.0 (the "License");
188// you may not use this file except in compliance with the License.
189// You may obtain a copy of the License at
190//
191// http://www.apache.org/licenses/LICENSE-2.0
192//
193// Unless required by applicable law or agreed to in writing, software
194// distributed under the License is distributed on an "AS IS" BASIS,
195// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
196// See the License for the specific language governing permissions and
197// limitations under the License.
198// ----------------------------- END-OF-FILE ----------------------------------
199
200/** @} */
201/** @} */
202/** @} */
Definition bslstl_stringview.h:471
#define BDLAT_DECL_ENUMERATION_TRAITS(ClassName)
Definition bdlat_typetraits.h:312
#define BSLS_IDENT(str)
BSLS_IDENT() - insert string into .comment binary segment (if supported)
Definition bsls_ident.h:238
Definition baljsn_convertfromjsonoptions.h:112
bsl::ostream & operator<<(bsl::ostream &stream, const DatumDecoderOptions &rhs)
Definition baljsn_encodingstyle.h:76
static int fromString(Value *result, const char *string, int stringLength)
Value
Definition baljsn_encodingstyle.h:80
@ e_COMPACT
Definition baljsn_encodingstyle.h:81
@ e_PRETTY
Definition baljsn_encodingstyle.h:82
static bsl::ostream & print(bsl::ostream &stream, Value value)
Definition baljsn_encodingstyle.h:160
static int fromInt(Value *result, int number)
static const bdlat_EnumeratorInfo ENUMERATOR_INFO_ARRAY[]
Definition baljsn_encodingstyle.h:92
static const char CLASS_NAME[]
Definition baljsn_encodingstyle.h:90
static const char * toString(Value value)
@ NUM_ENUMERATORS
Definition baljsn_encodingstyle.h:86
Definition bdlat_enumeratorinfo.h:99