BDE 4.14.0 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).
75
76 public:
77 // TYPES
78 enum Value {
79 e_COMPACT = 0
81 };
82
83 enum {
85 };
86
87 // CONSTANTS
88 static const char CLASS_NAME[];
89
91
92 // CLASS METHODS
93
94 /// Return the string representation exactly matching the enumerator
95 /// name corresponding to the specified enumeration `value`.
96 static const char *toString(Value value);
97
98 /// Load into the specified `result` the enumerator matching the
99 /// specified `string` of the specified `stringLength`. Return 0 on
100 /// success, and a non-zero value with no effect on `result` otherwise
101 /// (i.e., `string` does not match any enumerator).
102 static int fromString(Value *result,
103 const char *string,
104 int stringLength);
105
106 /// Load into the specified `result` the enumerator matching the
107 /// specified `string`. Return 0 on success, and a non-zero value with
108 /// no effect on `result` otherwise (i.e., `string` does not match any
109 /// enumerator).
110 static int fromString(Value *result,
111 const bsl::string_view& string);
112
113 /// Load into the specified `result` the enumerator matching the
114 /// specified `number`. Return 0 on success, and a non-zero value with
115 /// no effect on `result` otherwise (i.e., `number` does not match any
116 /// enumerator).
117 static int fromInt(Value *result, int number);
118
119 /// Write to the specified `stream` the string representation of
120 /// the specified enumeration `value`. Return a reference to
121 /// the modifiable `stream`.
122 static bsl::ostream& print(bsl::ostream& stream, Value value);
123};
124
125// FREE OPERATORS
126
127/// Format the specified `rhs` to the specified output `stream` and
128/// return a reference to the modifiable `stream`.
129inline
130bsl::ostream& operator<<(bsl::ostream& stream, EncodingStyle::Value rhs);
131
132} // close package namespace
133
134// TRAITS
135
137
138
139// ============================================================================
140// INLINE FUNCTION DEFINITIONS
141// ============================================================================
142
143namespace baljsn {
144
145 // -------------------
146 // class EncodingStyle
147 // -------------------
148
149// CLASS METHODS
150inline
152{
153 return fromString(result,
154 string.data(),
155 static_cast<int>(string.length()));
156}
157
158inline
159bsl::ostream& EncodingStyle::print(bsl::ostream& stream,
161{
162 return stream << toString(value);
163}
164
165} // close package namespace
166
167// FREE FUNCTIONS
168
169inline
170bsl::ostream& baljsn::operator<<(
171 bsl::ostream& stream,
173{
174 return baljsn::EncodingStyle::print(stream, rhs);
175}
176
177
178#endif
179
180// GENERATED BY BLP_BAS_CODEGEN_3.8.24 Fri Feb 17 12:35:40 2017
181// USING bas_codegen.pl -m msg --package baljsn --noExternalization -E --noAggregateConversion baljsn.xsd
182// SERVICE VERSION
183// ----------------------------------------------------------------------------
184// Copyright 2015 Bloomberg Finance L.P.
185//
186// Licensed under the Apache License, Version 2.0 (the "License");
187// you may not use this file except in compliance with the License.
188// You may obtain a copy of the License at
189//
190// http://www.apache.org/licenses/LICENSE-2.0
191//
192// Unless required by applicable law or agreed to in writing, software
193// distributed under the License is distributed on an "AS IS" BASIS,
194// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
195// See the License for the specific language governing permissions and
196// limitations under the License.
197// ----------------------------- END-OF-FILE ----------------------------------
198
199/** @} */
200/** @} */
201/** @} */
Definition bslstl_stringview.h:441
#define BDLAT_DECL_ENUMERATION_TRAITS(ClassName)
Definition bdlat_typetraits.h:293
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
Definition baljsn_datumdecoderoptions.h:113
bsl::ostream & operator<<(bsl::ostream &stream, const DatumDecoderOptions &rhs)
Enumeration of encoding style (COMPACT or PRETTY).
Definition baljsn_encodingstyle.h:74
static int fromString(Value *result, const char *string, int stringLength)
Value
Definition baljsn_encodingstyle.h:78
@ e_COMPACT
Definition baljsn_encodingstyle.h:79
@ e_PRETTY
Definition baljsn_encodingstyle.h:80
static bsl::ostream & print(bsl::ostream &stream, Value value)
Definition baljsn_encodingstyle.h:159
static int fromInt(Value *result, int number)
static const bdlat_EnumeratorInfo ENUMERATOR_INFO_ARRAY[]
Definition baljsn_encodingstyle.h:90
static const char CLASS_NAME[]
Definition baljsn_encodingstyle.h:88
static const char * toString(Value value)
@ NUM_ENUMERATORS
Definition baljsn_encodingstyle.h:84
Definition bdlat_enumeratorinfo.h:97