BDE 4.14.0 Production release
Loading...
Searching...
No Matches
s_baltst_testattribute.h
Go to the documentation of this file.
1/// @file s_baltst_testattribute.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// s_baltst_testattribute.h -*-C++-*-
8#ifndef INCLUDED_S_BALTST_TESTATTRIBUTE
9#define INCLUDED_S_BALTST_TESTATTRIBUTE
10
11#include <bsls_ident.h>
12BSLS_IDENT("$Id: $")
13
14/// @defgroup s_baltst_testattribute s_baltst_testattribute
15/// @brief Provide attribute metadata types for test sequences.
16/// @addtogroup Standalones
17/// @{
18/// @addtogroup s_baltst
19/// @{
20/// @addtogroup s_baltst_testattribute
21/// @{
22///
23/// <h1> Outline </h1>
24/// * <a href="#s_baltst_testattribute-purpose"> Purpose</a>
25/// * <a href="#s_baltst_testattribute-classes"> Classes </a>
26///
27/// # Purpose {#s_baltst_testattribute-purpose}
28/// Provide attribute metadata types for test sequences.
29///
30/// # Classes {#s_baltst_testattribute-classes}
31///
32/// - s_baltst::TestAttribute: attribute metadata for test sequences
33/// - s_baltst::TestAttribute1: an example attribute
34/// - s_baltst::TestAttribute2: an example attribute
35/// - s_baltst::TestAttributeDefaults: defaults
36/// - s_baltst::TypedTestAttribute: attribute metadata with value type
37/// @}
38/** @} */
39/** @} */
40
41/** @addtogroup Standalones
42 * @{
43 */
44/** @addtogroup s_baltst
45 * @{
46 */
47/** @addtogroup s_baltst_testattribute
48 * @{
49 */
50/
51#include <bdlat_attributeinfo.h>
52
53#include <bsl_cstring.h>
54#include <bsl_string.h>
55#include <bsl_string_view.h>
56
57
58namespace s_baltst {
59
60 // ============================
61 // struct TestAttributeDefaults
62 // ============================
63
64/// This utility `struct` provides a namespace for non-modifiable,
65/// constant-initialized default values for the non-type template parameters
66/// of a `TestAttribute`.
68
69 // CLASS DATA
70 static const char k_DEFAULT_ANNOTATION[1];
71 static const char k_DEFAULT_NAME[1];
73};
74
75 // ===================
76 // class TestAttribute
77 // ===================
78
79/// This class provides a namespace for a suite of non-modifiable,
80/// constant-initialized data that can be used to specify all attributes of
81/// a `bdlat_AttributeInfo` object.
82///
83/// See @ref s_baltst_testattribute
84template <int ID,
86 const char *ANNOTATION = TestAttributeDefaults::k_DEFAULT_ANNOTATION,
87 int FORMATTING_MODE =
90
91 public:
92 // CLASS DATA
93 static const char *k_NAME;
94 static const char *k_ANNOTATION;
95 enum { k_ID = ID, k_FORMATTING_MODE = FORMATTING_MODE };
96
97 // CLASS METHODS
98 static int id();
99
100 static bsl::string_view name();
101
103
104 static int formattingMode();
105
107
108 // CREATORS
110};
111
112// CLASS DATA
113template <int ID,
114 const char *NAME,
115 const char *ANNOTATION,
116 int FORMATTING_MODE>
118 NAME;
119
120template <int ID,
121 const char *NAME,
122 const char *ANNOTATION,
123 int FORMATTING_MODE>
124const char
126 ANNOTATION;
127
128 // ========================
129 // class TypedTestAttribute
130 // ========================
131
132/// This class provides two member type definitions, `Type`, and
133/// `Attribute`, which are aliases to the arguments supplied to the `TYPE`
134/// and `TEST_SELECTION` template parameters, respectively.
135///
136/// See @ref s_baltst_testattribute
137template <class TYPE, class TEST_ATTRIBUTE>
139
140 public:
141 // TYPES
142 typedef TYPE Type;
143 typedef TEST_ATTRIBUTE Attribute;
144};
145
146 // =========================
147 // struct TestAttribute_Data
148 // =========================
149
151 // PUBLIC CLASS DATA
152 static const int k_ATTRIBUTE_1_ID = 0;
153 static const char k_ATTRIBUTE_1_NAME[sizeof("attr1")];
154 static const char k_ATTRIBUTE_1_ANNOTATION[sizeof("")];
155 static const int k_ATTRIBUTE_1_FORMATTING_MODE = 0;
156 static const int k_ATTRIBUTE_2_ID = 1;
157 static const char k_ATTRIBUTE_2_NAME[sizeof("attr2")];
158 static const char k_ATTRIBUTE_2_ANNOTATION[sizeof("")];
159 static const int k_ATTRIBUTE_2_FORMATTING_MODE = 0;
160};
161
162 // ====================
163 // class TestAttribute1
164 // ====================
165
171
172 // ====================
173 // class TestAttribute2
174 // ====================
175
181
182// ============================================================================
183// INLINE DEFINITIONS
184// ============================================================================
185
186 // -------------------
187 // class TestAttribute
188 // -------------------
189
190// CLASS METHODS
191template <int ID,
192 const char *NAME,
193 const char *ANNOTATION,
194 int FORMATTING_MODE>
199
200template <int ID,
201 const char *NAME,
202 const char *ANNOTATION,
203 int FORMATTING_MODE>
208
209template <int ID,
210 const char *NAME,
211 const char *ANNOTATION,
212 int FORMATTING_MODE>
218
219template <int ID,
220 const char *NAME,
221 const char *ANNOTATION,
222 int FORMATTING_MODE>
227
228template <int ID,
229 const char *NAME,
230 const char *ANNOTATION,
231 int FORMATTING_MODE>
234{
235 bdlat_AttributeInfo result = {k_ID,
236 k_NAME,
237 static_cast<int>(bsl::strlen(k_NAME)),
238 k_ANNOTATION,
239 k_FORMATTING_MODE};
240
241 return result;
242}
243
244// CREATORS
245template <int ID,
246 const char *NAME,
247 const char *ANNOTATION,
248 int FORMATTING_MODE>
252
253} // close package namespace
254
255
256#endif // INCLUDED_S_BALTST_TESTATTRIBUTE
257
258// ----------------------------------------------------------------------------
259// Copyright 2021 Bloomberg Finance L.P.
260//
261// Licensed under the Apache License, Version 2.0 (the "License");
262// you may not use this file except in compliance with the License.
263// You may obtain a copy of the License at
264//
265// http://www.apache.org/licenses/LICENSE-2.0
266//
267// Unless required by applicable law or agreed to in writing, software
268// distributed under the License is distributed on an "AS IS" BASIS,
269// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
270// See the License for the specific language governing permissions and
271// limitations under the License.
272// ----------------------------- END-OF-FILE ----------------------------------
273
274/** @} */
275/** @} */
276/** @} */
Definition bslstl_stringview.h:441
Definition s_baltst_testattribute.h:89
@ k_FORMATTING_MODE
Definition s_baltst_testattribute.h:95
@ k_ID
Definition s_baltst_testattribute.h:95
static const char * k_ANNOTATION
Definition s_baltst_testattribute.h:94
TestAttribute()
Definition s_baltst_testattribute.h:249
static bsl::string_view annotation()
Definition s_baltst_testattribute.h:214
static bdlat_AttributeInfo attributeInfo()
Definition s_baltst_testattribute.h:233
static int formattingMode()
Definition s_baltst_testattribute.h:223
static const char * k_NAME
Definition s_baltst_testattribute.h:93
static int id()
Definition s_baltst_testattribute.h:195
static bsl::string_view name()
Definition s_baltst_testattribute.h:204
Definition s_baltst_testattribute.h:138
TYPE Type
Definition s_baltst_testattribute.h:142
TEST_ATTRIBUTE Attribute
Definition s_baltst_testattribute.h:143
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
Definition s_baltst_address.h:66
TestAttribute< TestAttribute_Data::k_ATTRIBUTE_2_ID, TestAttribute_Data::k_ATTRIBUTE_2_NAME, TestAttribute_Data::k_ATTRIBUTE_2_ANNOTATION, TestAttribute_Data::k_ATTRIBUTE_2_FORMATTING_MODE > TestAttribute2
Definition s_baltst_testattribute.h:180
TestAttribute< TestAttribute_Data::k_ATTRIBUTE_1_ID, TestAttribute_Data::k_ATTRIBUTE_1_NAME, TestAttribute_Data::k_ATTRIBUTE_1_ANNOTATION, TestAttribute_Data::k_ATTRIBUTE_1_FORMATTING_MODE > TestAttribute1
Definition s_baltst_testattribute.h:170
Definition bdlat_attributeinfo.h:137
Definition s_baltst_testattribute.h:67
static const char k_DEFAULT_ANNOTATION[1]
Definition s_baltst_testattribute.h:70
@ k_DEFAULT_FORMATTING_MODE
Definition s_baltst_testattribute.h:72
static const char k_DEFAULT_NAME[1]
Definition s_baltst_testattribute.h:71
Definition s_baltst_testattribute.h:150
static const int k_ATTRIBUTE_2_FORMATTING_MODE
Definition s_baltst_testattribute.h:159
static const char k_ATTRIBUTE_2_ANNOTATION[sizeof("")]
Definition s_baltst_testattribute.h:158
static const int k_ATTRIBUTE_1_ID
Definition s_baltst_testattribute.h:152
static const char k_ATTRIBUTE_2_NAME[sizeof("attr2")]
Definition s_baltst_testattribute.h:157
static const int k_ATTRIBUTE_2_ID
Definition s_baltst_testattribute.h:156
static const char k_ATTRIBUTE_1_NAME[sizeof("attr1")]
Definition s_baltst_testattribute.h:153
static const char k_ATTRIBUTE_1_ANNOTATION[sizeof("")]
Definition s_baltst_testattribute.h:154
static const int k_ATTRIBUTE_1_FORMATTING_MODE
Definition s_baltst_testattribute.h:155