8#ifndef INCLUDED_S_BALTST_MYCHOICE
9#define INCLUDED_S_BALTST_MYCHOICE
43#include <bslalg_typetraits.h>
57#include <bsl_string.h>
59#include <bsl_iosfwd.h>
60#include <bsl_limits.h>
64namespace bslma {
class Allocator; }
66namespace s_baltst {
class MyChoice; }
85 bool isEqualTo(
const MyChoice& rhs)
const;
138#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) \
139 && defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT)
163#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) \
164 && defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT)
194#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) \
195 && defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT)
207 template <
typename t_MANIPULATOR>
236 bsl::ostream&
print(bsl::ostream& stream,
238 int spacesPerLevel = 4)
const;
248 template <
typename t_ACCESSOR>
286 return lhs.isEqualTo(rhs);
294 return !(lhs == rhs);
301 return rhs.print(stream, 0, -1);
324bool MyChoice::isEqualTo(
const MyChoice& rhs)
const
328 switch (
rhs.selectionId()) {
329 case Class::SELECTION_ID_SELECTION1:
330 return this->
selection1() == rhs.selection1();
331 case Class::SELECTION_ID_SELECTION2:
332 return this->
selection2() == rhs.selection2();
346: d_selectionId(SELECTION_ID_UNDEFINED)
347, d_allocator_p(
bslma::Default::allocator(basicAllocator))
358template <
typename t_MANIPULATOR>
361 switch (d_selectionId) {
392 return d_selectionId;
395template <
typename t_ACCESSOR>
398 switch (d_selectionId) {
Definition bslstl_string.h:1252
Definition bslma_allocator.h:545
Definition s_baltst_mychoice.h:73
static const bdlat_SelectionInfo SELECTION_INFO_ARRAY[]
Definition s_baltst_mychoice.h:108
@ SELECTION_ID_SELECTION1
Definition s_baltst_mychoice.h:92
@ SELECTION_ID_SELECTION2
Definition s_baltst_mychoice.h:93
@ SELECTION_ID_UNDEFINED
Definition s_baltst_mychoice.h:91
bool isSelection1Value() const
Definition s_baltst_mychoice.h:426
const char * selectionName() const
Return the symbolic name of the current selection of this object.
int makeSelection(int selectionId)
@ NUM_SELECTIONS
Definition s_baltst_mychoice.h:97
friend bsl::ostream & operator<<(bsl::ostream &stream, const MyChoice &rhs)
Definition s_baltst_mychoice.h:299
int makeSelection(const char *name, int nameLength)
bsls::ObjectBuffer< int > d_selection1
Definition s_baltst_mychoice.h:77
MyChoice & operator=(const MyChoice &rhs)
Assign to this object the value of the specified rhs object.
int manipulateSelection(t_MANIPULATOR &manipulator)
Definition s_baltst_mychoice.h:359
bsl::ostream & print(bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
int accessSelection(t_ACCESSOR &accessor) const
Definition s_baltst_mychoice.h:396
bsl::string & selection2()
Definition s_baltst_mychoice.h:382
@ SELECTION_INDEX_SELECTION1
Definition s_baltst_mychoice.h:101
@ SELECTION_INDEX_SELECTION2
Definition s_baltst_mychoice.h:102
bool isUndefinedValue() const
Definition s_baltst_mychoice.h:438
static const bdlat_SelectionInfo * lookupSelectionInfo(int id)
static const bdlat_SelectionInfo * lookupSelectionInfo(const char *name, int nameLength)
bsl::string & makeSelection2(const bsl::string &value)
friend bool operator==(const MyChoice &lhs, const MyChoice &rhs)
Definition s_baltst_mychoice.h:284
int & selection1()
Definition s_baltst_mychoice.h:375
bsl::string & makeSelection2()
~MyChoice()
Destroy this object.
Definition s_baltst_mychoice.h:352
static const char CLASS_NAME[]
Definition s_baltst_mychoice.h:106
int & makeSelection1(int value)
MyChoice(bslma::Allocator *basicAllocator=0)
Definition s_baltst_mychoice.h:345
friend bool operator!=(const MyChoice &lhs, const MyChoice &rhs)
Definition s_baltst_mychoice.h:292
MyChoice(const MyChoice &original, bslma::Allocator *basicAllocator=0)
int selectionId() const
Definition s_baltst_mychoice.h:390
bsls::ObjectBuffer< bsl::string > d_selection2
Definition s_baltst_mychoice.h:78
bool isSelection2Value() const
Definition s_baltst_mychoice.h:432
#define BDLAT_DECL_CHOICE_WITH_ALLOCATOR_BITWISEMOVEABLE_TRAITS(ClassName)
Definition bdlat_typetraits.h:268
#define BSLS_ASSERT(X)
Definition bsls_assert.h:1976
#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
ALLOCATOR const STRING_VIEW_LIKE_TYPE & rhs
Definition bslstl_string.h:3918
Definition baljsn_encoder_testtypes.h:76
Definition s_baltst_address.h:66
Definition bdlat_selectioninfo.h:138
TYPE & object()
Definition bsls_objectbuffer.h:352