BDE 4.14.0 Production release
Loading...
Searching...
No Matches
s_baltst_testenumerator.h
Go to the documentation of this file.
1/// @file s_baltst_testenumerator.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// s_baltst_testenumerator.h -*-C++-*-
8#ifndef INCLUDED_S_BALTST_TESTENUMERATOR
9#define INCLUDED_S_BALTST_TESTENUMERATOR
10
11#include <bsls_ident.h>
12BSLS_IDENT("$Id: $")
13
14/// @defgroup s_baltst_testenumerator s_baltst_testenumerator
15/// @brief Provide enumerator metadata types for test enumerations.
16/// @addtogroup Standalones
17/// @{
18/// @addtogroup s_baltst
19/// @{
20/// @addtogroup s_baltst_testenumerator
21/// @{
22///
23/// <h1> Outline </h1>
24/// * <a href="#s_baltst_testenumerator-purpose"> Purpose</a>
25/// * <a href="#s_baltst_testenumerator-classes"> Classes </a>
26///
27/// # Purpose {#s_baltst_testenumerator-purpose}
28/// Provide enumerator metadata types for test enumerations.
29///
30/// # Classes {#s_baltst_testenumerator-classes}
31///
32/// - s_baltst::TestEnumerator: enumerator metadata for test enumerators
33/// - s_baltst::TestNilEnumerator: type representing no enumerator
34/// @}
35/** @} */
36/** @} */
37
38/** @addtogroup Standalones
39 * @{
40 */
41/** @addtogroup s_baltst
42 * @{
43 */
44/** @addtogroup s_baltst_testenumerator
45 * @{
46 */
47/
48#include <bsl_string_view.h>
49
50
51namespace s_baltst {
52
53 // ====================
54 // class TestEnumerator
55 // ====================
56
57/// This class provides a namespace for a suite of constant-initialized data
58/// that can be used to specify the integer and string values of an
59/// enumerator for a `bdlat` `Enumeration` type.
60///
61/// See @ref s_baltst_testenumerator
62template <int INT_VALUE, const char *STRING_VALUE>
64
65 public:
66 // CLASS DATA
67 static const char *k_STRING_VALUE;
68 enum { k_INT_VALUE = INT_VALUE };
69
70 // CLASS METHODS
71 static int intValue();
73
74 // CREATORS
76};
77
78 // =======================
79 // class TestNilEnumerator
80 // =======================
81
82/// This class provides a namespace for a type having a set of public
83/// members with the same names and types as `TestEnumerator`, and that can
84/// be used as a sentinel type to indicate that no such enumerator exists.
85///
86/// See @ref s_baltst_testenumerator
88
89 public:
90 // CLASS DATA
91 static const char *k_STRING_VALUE;
92 enum { k_INT_VALUE = 0 };
93
94 // CLASS METHODS
95 static int intValue();
97};
98
99// ============================================================================
100// INLINE DEFINITIONS
101// ============================================================================
102
103 // --------------------
104 // class TestEnumerator
105 // --------------------
106
107// CLASS DATA
108template <int INT_VALUE, const char *STRING_VALUE>
110 STRING_VALUE;
111
112// CLASS METHODS
113template <int INT_VALUE, const char *STRING_VALUE>
115{
116 return k_INT_VALUE;
117}
118
119template <int INT_VALUE, const char *STRING_VALUE>
124
125// CREATORS
126template <int INT_VALUE, const char *STRING_VALUE>
130
131 // -----------------------
132 // class TestNilEnumerator
133 // -----------------------
134
135// CLASS METHODS
136inline
138{
139 return k_INT_VALUE;
140}
141
142inline
147
148} // close package namespace
149
150
151#endif // INCLUDED_S_BALTST_TESTENUMERATOR
152
153// ----------------------------------------------------------------------------
154// Copyright 2021 Bloomberg Finance L.P.
155//
156// Licensed under the Apache License, Version 2.0 (the "License");
157// you may not use this file except in compliance with the License.
158// You may obtain a copy of the License at
159//
160// http://www.apache.org/licenses/LICENSE-2.0
161//
162// Unless required by applicable law or agreed to in writing, software
163// distributed under the License is distributed on an "AS IS" BASIS,
164// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
165// See the License for the specific language governing permissions and
166// limitations under the License.
167// ----------------------------- END-OF-FILE ----------------------------------
168
169/** @} */
170/** @} */
171/** @} */
Definition bslstl_stringview.h:441
Definition s_baltst_testenumerator.h:63
TestEnumerator()
Definition s_baltst_testenumerator.h:127
static bsl::string_view stringValue()
Definition s_baltst_testenumerator.h:120
static const char * k_STRING_VALUE
Definition s_baltst_testenumerator.h:67
@ k_INT_VALUE
Definition s_baltst_testenumerator.h:68
static int intValue()
Definition s_baltst_testenumerator.h:114
Definition s_baltst_testenumerator.h:87
static bsl::string_view stringValue()
Definition s_baltst_testenumerator.h:143
static int intValue()
Definition s_baltst_testenumerator.h:137
@ k_INT_VALUE
Definition s_baltst_testenumerator.h:92
static const char * k_STRING_VALUE
Definition s_baltst_testenumerator.h:91
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
Definition s_baltst_address.h:66