BDE 4.39.x Production Release
Loading...
Searching...
No Matches
s_baltst_myenumerationwithfallback.h
Go to the documentation of this file.
1/// @file s_baltst_myenumerationwithfallback.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// s_baltst_myenumerationwithfallback.h *DO NOT EDIT* @generated -*-C++-*-
8#ifndef INCLUDED_S_BALTST_MYENUMERATIONWITHFALLBACK
9#define INCLUDED_S_BALTST_MYENUMERATIONWITHFALLBACK
10
11#include <bsls_ident.h>
12BSLS_IDENT_RCSID(s_baltst_myenumerationwithfallback_h, "$Id$ $CSID$")
14
15/// @defgroup s_baltst_myenumerationwithfallback s_baltst_myenumerationwithfallback
16/// @brief Provide value-semantic attribute classes
17/// @addtogroup Standalones
18/// @{
19/// @addtogroup s_baltst
20/// @{
21/// @addtogroup s_baltst_myenumerationwithfallback
22/// @{
23///
24/// <h1> Outline </h1>
25/// * <a href="#s_baltst_myenumerationwithfallback-purpose"> Purpose</a>
26///
27/// # Purpose {#s_baltst_myenumerationwithfallback-purpose}
28/// Provide value-semantic attribute classes
29/// @}
30/** @} */
31/** @} */
32
33/** @addtogroup Standalones
34 * @{
35 */
36/** @addtogroup s_baltst
37 * @{
38 */
39/** @addtogroup s_baltst_myenumerationwithfallback
40 * @{
41 */
42
43#include <bslalg_typetraits.h>
44
45#include <bdlat_attributeinfo.h>
46
48
49#include <bdlat_typetraits.h>
50
51#include <bsls_assert.h>
52
53#include <bsl_iosfwd.h>
54#include <bsl_limits.h>
55
56#include <bsl_ostream.h>
57#include <bsl_string.h>
58
59
60
61namespace s_baltst {
62
63 // ===============================
64 // class MyEnumerationWithFallback
65 // ===============================
66
68
69 public:
70 // TYPES
71 enum Value {
72 VALUE1 = 0,
73 VALUE2 = 1,
74 UNKNOWN = 2
75 };
76
77 enum {
79 };
80
81 // CONSTANTS
82 static const char CLASS_NAME[];
83
85
86 // CLASS METHODS
87
88 /// Return the string representation exactly matching the enumerator
89 /// name corresponding to the specified enumeration `value`.
90 static const char *toString(Value value);
91
92 /// Load into the specified `result` the enumerator matching the
93 /// specified `string` of the specified `stringLength`. Return 0 on
94 /// success, and a non-zero value with no effect on `result` otherwise
95 /// (i.e., `string` does not match any enumerator).
96 static int fromString(Value *result,
97 const char *string,
98 int stringLength);
99
100 /// Load into the specified `result` the enumerator matching the
101 /// specified `string`. Return 0 on success, and a non-zero value with
102 /// no effect on `result` otherwise (i.e., `string` does not match any
103 /// enumerator).
104 static int fromString(Value *result,
105 const bsl::string& string);
106
107 /// Load into the specified `result` the enumerator matching the
108 /// specified `number`. Return 0 on success, and a non-zero value with
109 /// no effect on `result` otherwise (i.e., `number` does not match any
110 /// enumerator).
111 static int fromInt(Value *result, int number);
112
113 /// Load into the specified `result` the fallback enumerator value and
114 /// return 0 to indicate success.
115 static int makeFallback(Value *result);
116
117 /// Return `true` to indicate that this type supports a fallback
118 /// enumerator.
119 static bool hasFallback(Value);
120
121 /// Return `true` if the specified `value` equals the fallback
122 /// enumerator, and `false` otherwise.
123 static bool isFallback(Value value);
124
125 /// Write to the specified `stream` the string representation of
126 /// the specified enumeration `value`. Return a reference to
127 /// the modifiable `stream`.
128 static bsl::ostream& print(bsl::ostream& stream, Value value);
129
130 // HIDDEN FRIENDS
131
132 /// Format the specified `rhs` to the specified output `stream` and
133 /// return a reference to the modifiable `stream`.
134 friend bsl::ostream& operator<<(bsl::ostream& stream, Value rhs)
135 {
136 return MyEnumerationWithFallback::print(stream, rhs);
137 }
138};
139
140} // close package namespace
141
142// TRAITS
143
145
146
147// ============================================================================
148// INLINE DEFINITIONS
149// ============================================================================
150
151namespace s_baltst {
152
153 // -------------------------------
154 // class MyEnumerationWithFallback
155 // -------------------------------
156
157// CLASS METHODS
158inline
160{
161 return fromString(result, string.c_str(), static_cast<int>(string.length()));
162}
163
164inline
165bsl::ostream& MyEnumerationWithFallback::print(bsl::ostream& stream,
167{
168 return stream << toString(value);
169}
170
171inline
173{
174 *result = UNKNOWN;
175 return 0;
176}
177
178inline
183
184inline
189
190} // close package namespace
191
192// FREE FUNCTIONS
193
194
195#endif
196
197// GENERATED BY BLP_BAS_CODEGEN_2025.08.21
198// USING bas_codegen.pl s_baltst_myenumerationwithfallback.xsd --mode msg --includedir . --msgComponent myenumerationwithfallback --noRecurse --noExternalization --noHashSupport --noAggregateConversion
199// ----------------------------------------------------------------------------
200// NOTICE:
201// Copyright 2025 Bloomberg Finance L.P. All rights reserved.
202// Property of Bloomberg Finance L.P. (BFLP)
203// This software is made available solely pursuant to the
204// terms of a BFLP license agreement which governs its use.
205// ------------------------------- END-OF-FILE --------------------------------
206
207/** @} */
208/** @} */
209/** @} */
Definition bslstl_string.h:1252
#define BDLAT_DECL_ENUMERATION_WITH_FALLBACK_TRAITS(ClassName)
Definition bdlat_typetraits.h:324
#define BSLS_IDENT_RCSID(tag, str)
BSLS_IDENT_RCSID() - insert ident str (specific to platform/compiler)
Definition bsls_ident.h:244
#define BSLS_IDENT_PRAGMA_ONCE
BSLS_IDENT_PRAGMA_ONCE - macro to avoid multiple inclusion
Definition bsls_ident.h:263
Definition s_baltst_address.h:66
Definition bdlat_enumeratorinfo.h:99
Definition s_baltst_myenumerationwithfallback.h:67
friend bsl::ostream & operator<<(bsl::ostream &stream, Value rhs)
Definition s_baltst_myenumerationwithfallback.h:134
static const bdlat_EnumeratorInfo ENUMERATOR_INFO_ARRAY[]
Definition s_baltst_myenumerationwithfallback.h:84
static int fromString(Value *result, const char *string, int stringLength)
static bool hasFallback(Value)
Definition s_baltst_myenumerationwithfallback.h:179
static const char CLASS_NAME[]
Definition s_baltst_myenumerationwithfallback.h:82
@ NUM_ENUMERATORS
Definition s_baltst_myenumerationwithfallback.h:78
static bool isFallback(Value value)
Definition s_baltst_myenumerationwithfallback.h:185
static int fromInt(Value *result, int number)
static const char * toString(Value value)
static bsl::ostream & print(bsl::ostream &stream, Value value)
Definition s_baltst_myenumerationwithfallback.h:165
Value
Definition s_baltst_myenumerationwithfallback.h:71
@ VALUE2
Definition s_baltst_myenumerationwithfallback.h:73
@ UNKNOWN
Definition s_baltst_myenumerationwithfallback.h:74
@ VALUE1
Definition s_baltst_myenumerationwithfallback.h:72
static int makeFallback(Value *result)
Definition s_baltst_myenumerationwithfallback.h:172