BDE 4.14.0 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
131// FREE OPERATORS
132
133/// Format the specified `rhs` to the specified output `stream` and
134/// return a reference to the modifiable `stream`.
135inline
136bsl::ostream& operator<<(bsl::ostream& stream, MyEnumerationWithFallback::Value rhs);
137
138} // close package namespace
139
140// TRAITS
141
143
144
145// ============================================================================
146// INLINE FUNCTION DEFINITIONS
147// ============================================================================
148
149namespace s_baltst {
150
151 // -------------------------------
152 // class MyEnumerationWithFallback
153 // -------------------------------
154
155// CLASS METHODS
156inline
158{
159 return fromString(result, string.c_str(), static_cast<int>(string.length()));
160}
161
162inline
163bsl::ostream& MyEnumerationWithFallback::print(bsl::ostream& stream,
165{
166 return stream << toString(value);
167}
168
169} // close package namespace
170
171// FREE FUNCTIONS
172
173inline
174bsl::ostream& s_baltst::operator<<(
175 bsl::ostream& stream,
177{
179}
180
181
182#endif
183
184// GENERATED BY @BLP_BAS_CODEGEN_VERSION@
185// USING bas_codegen.pl s_baltst_myenumerationwithfallback.xsd --mode msg --includedir . --msgComponent myenumerationwithfallback --noRecurse --noExternalization --noHashSupport --noAggregateConversion
186// ----------------------------------------------------------------------------
187// NOTICE:
188// Copyright 2023 Bloomberg Finance L.P. All rights reserved.
189// Property of Bloomberg Finance L.P. (BFLP)
190// This software is made available solely pursuant to the
191// terms of a BFLP license agreement which governs its use.
192// ------------------------------- END-OF-FILE --------------------------------
193
194/** @} */
195/** @} */
196/** @} */
Definition bslstl_string.h:1281
#define BDLAT_DECL_ENUMERATION_WITH_FALLBACK_TRAITS(ClassName)
Definition bdlat_typetraits.h:305
#define BSLS_IDENT_RCSID(tag, str)
Definition bsls_ident.h:260
#define BSLS_IDENT_PRAGMA_ONCE
Definition bsls_ident.h:310
Definition s_baltst_address.h:66
bsl::ostream & operator<<(bsl::ostream &stream, const Address &rhs)
Definition bdlat_enumeratorinfo.h:97
Definition s_baltst_myenumerationwithfallback.h:67
static int makeFallback(Value *result)
@ NUM_ENUMERATORS
Definition s_baltst_myenumerationwithfallback.h:78
static const bdlat_EnumeratorInfo ENUMERATOR_INFO_ARRAY[]
Definition s_baltst_myenumerationwithfallback.h:84
static int fromString(Value *result, const char *string, int stringLength)
static const char CLASS_NAME[]
Definition s_baltst_myenumerationwithfallback.h:82
static bool isFallback(Value value)
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:163
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