BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bdlat_selectioninfo

Classes

struct  bdlat_SelectionInfo
 

Functions

bool operator== (const bdlat_SelectionInfo &lhs, const bdlat_SelectionInfo &rhs)
 
bool operator!= (const bdlat_SelectionInfo &lhs, const bdlat_SelectionInfo &rhs)
 
bsl::ostream & operator<< (bsl::ostream &stream, const bdlat_SelectionInfo &selectionInfo)
 
const char *& bdlat_SelectionInfo::annotation ()
 
int & bdlat_SelectionInfo::formattingMode ()
 
int & bdlat_SelectionInfo::id ()
 
const char *& bdlat_SelectionInfo::name ()
 
int & bdlat_SelectionInfo::nameLength ()
 
BSLS_KEYWORD_CONSTEXPR const char * bdlat_SelectionInfo::annotation () const
 Return the non-modifiable annotation of this selection info object.
 
BSLS_KEYWORD_CONSTEXPR int bdlat_SelectionInfo::formattingMode () const
 Return the formatting mode of this selection info object.
 
BSLS_KEYWORD_CONSTEXPR int bdlat_SelectionInfo::id () const
 Return the id of this selection info object.
 
BSLS_KEYWORD_CONSTEXPR const char * bdlat_SelectionInfo::name () const
 Return the non-modifiable name of this selection info object.
 
BSLS_KEYWORD_CONSTEXPR int bdlat_SelectionInfo::nameLength () const
 

Detailed Description

Outline

Purpose

Provide a container for selection information.

Classes

See also
bdlat_choicefunctions

Description

This component provides the bdlat_SelectionInfo struct, which is a container for holding information (properties) about a choice selection. The properties of a selection include its name and the length of its name, its distinct id within its containing type, its formatting mode, and a brief annotation. Although each selection property is publicly accessible, a manipulator and accessor is also supplied for each.

When accessing or manipulating a selection of a "choice" type (using one of the functions from the bdlat_ChoiceFunctions namespace), an instance of this struct will be passed as the second argument to the accessor or manipulator.

Note that this struct needs to be a POD type.

Usage

This section illustrates intended use of this component.

Example 1: Basic Usage

Suppose you create an accessor for choice selections that prints the selection to an output stream:

#include <ostream>
using namespace BloombergLP;
class PrintSelectionWithInfo {
// Print the selection along with its name and annotation.
// PRIVATE DATA MEMBERS
bsl::ostream *d_stream_p;
public:
// CREATORS
PrintSelectionWithInfo(bsl::ostream *stream)
: d_stream_p(stream)
{
}
// OPERATIONS
template <typename TYPE>
int operator()(const TYPE& selection,
const bdlat_SelectionInfo& info)
{
(*d_stream_p) << selection << " ("
<< bsl::string(info.name(),
info.nameLength())
<< ", "
<< info.annotation() << ")\n";
}
};
int & nameLength()
Definition bdlat_selectioninfo.h:268
const char *& name()
Definition bdlat_selectioninfo.h:262
const char *& annotation()
Definition bdlat_selectioninfo.h:244
basic_string< char > string
Definition bslstl_string.h:782
Definition bdlat_selectioninfo.h:136

Function Documentation

◆ annotation() [1/2]

const char *& bdlat_SelectionInfo::annotation ( )
inline

Return a reference to the modifiable annotation of this selection info object.

◆ annotation() [2/2]

BSLS_KEYWORD_CONSTEXPR const char * bdlat_SelectionInfo::annotation ( ) const
inline

◆ formattingMode() [1/2]

int & bdlat_SelectionInfo::formattingMode ( )
inline

Return a reference to the modifiable formatting mode of this selection info object.

◆ formattingMode() [2/2]

BSLS_KEYWORD_CONSTEXPR int bdlat_SelectionInfo::formattingMode ( ) const
inline

◆ id() [1/2]

int & bdlat_SelectionInfo::id ( )
inline

Return a reference to the modifiable id of this selection info object.

◆ id() [2/2]

BSLS_KEYWORD_CONSTEXPR int bdlat_SelectionInfo::id ( ) const
inline

◆ name() [1/2]

const char *& bdlat_SelectionInfo::name ( )
inline

Return a reference to the modifiable name of this selection info object.

◆ name() [2/2]

BSLS_KEYWORD_CONSTEXPR const char * bdlat_SelectionInfo::name ( ) const
inline

◆ nameLength() [1/2]

int & bdlat_SelectionInfo::nameLength ( )
inline

Return a reference to the modifiable length of the name of this selection info object. Note that the 0-terminator is not included in the length.

◆ nameLength() [2/2]

BSLS_KEYWORD_CONSTEXPR int bdlat_SelectionInfo::nameLength ( ) const
inline

Return the length of the name of this selection info object. Note that the 0-terminator is not included in the length.

◆ operator!=()

bool operator!= ( const bdlat_SelectionInfo lhs,
const bdlat_SelectionInfo rhs 
)
inline

Return true if the specified lhs and rhs selection info objects do not have the same value, and false otherwise. Two selection info objects do not have the same value if at least one of their respective properties is not identical.

◆ operator<<()

bsl::ostream & operator<< ( bsl::ostream &  stream,
const bdlat_SelectionInfo selectionInfo 
)

Write the value of the specified selectionInfo to the specified stream.

◆ operator==()

bool operator== ( const bdlat_SelectionInfo lhs,
const bdlat_SelectionInfo rhs 
)
inline

Return true if the specified lhs and rhs selection info objects have the same value, and false otherwise. Two selection info objects have the same value if each of their respective properties are identical.