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

Classes

struct  bdlat_AttributeInfo
 

Functions

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

Detailed Description

Outline

Purpose

Provide a container for attribute information.

Classes

See also
bdlat_sequencefunctions

Description

This component provides the bdlat_AttributeInfo struct, which is a container for holding information (properties) about a sequence attribute. The properties of an attribute 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 attribute property is publicly accessible, a manipulator and accessor is also supplied for each.

When accessing or manipulating an attribute of a "sequence" type (using one of the functions from the bdlat_SequenceFunctions 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 sequence attributes that prints each attribute to an output stream:

#include <ostream>
using namespace BloombergLP;
class PrintAttributeWithInfo {
// Print the attribute along with its name and annotation.
// PRIVATE DATA MEMBERS
bsl::ostream *d_stream_p;
public:
// CREATORS
PrintAttributeWithInfo(bsl::ostream *stream)
: d_stream_p(stream)
{
}
// OPERATIONS
template <typename TYPE>
int operator()(const TYPE& attribute,
const bdlat_AttributeInfo& info)
{
(*d_stream_p) << attribute << " ("
<< bsl::string(info.name(),
info.nameLength())
<< ", "
<< info.annotation() << ")\n";
}
};
const char *& name()
Definition bdlat_attributeinfo.h:263
int & nameLength()
Definition bdlat_attributeinfo.h:269
const char *& annotation()
Definition bdlat_attributeinfo.h:245
basic_string< char > string
Definition bslstl_string.h:782
Definition bdlat_attributeinfo.h:137

Function Documentation

◆ annotation() [1/2]

const char *& bdlat_AttributeInfo::annotation ( )
inline

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

◆ annotation() [2/2]

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

◆ formattingMode() [1/2]

int & bdlat_AttributeInfo::formattingMode ( )
inline

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

◆ formattingMode() [2/2]

BSLS_KEYWORD_CONSTEXPR int bdlat_AttributeInfo::formattingMode ( ) const
inline

◆ id() [1/2]

int & bdlat_AttributeInfo::id ( )
inline

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

◆ id() [2/2]

BSLS_KEYWORD_CONSTEXPR int bdlat_AttributeInfo::id ( ) const
inline

◆ name() [1/2]

const char *& bdlat_AttributeInfo::name ( )
inline

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

◆ name() [2/2]

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

◆ nameLength() [1/2]

int & bdlat_AttributeInfo::nameLength ( )
inline

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

◆ nameLength() [2/2]

BSLS_KEYWORD_CONSTEXPR int bdlat_AttributeInfo::nameLength ( ) const
inline

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

◆ operator!=()

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

Return true if the specified lhs and rhs attribute info objects do not have the same value, and false otherwise. Two attribute 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_AttributeInfo attributeInfo 
)

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

◆ operator==()

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

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