BDE 4.14.0 Production release
Loading...
Searching...
No Matches
ball::UserFields Class Reference

#include <ball_userfields.h>

Public Types

typedef bsl::vector< ball::UserFieldValue >::const_iterator ConstIterator
 

Public Member Functions

 BSLMF_NESTED_TRAIT_DECLARATION (UserFields, bslma::UsesBslmaAllocator)
 
 UserFields (bslma::Allocator *basicAllocator=0)
 
 UserFields (const UserFields &original, bslma::Allocator *basicAllocator=0)
 
 ~UserFields ()=default
 Destroy this object.
 
UserFieldsoperator= (const UserFields &rhs)
 
void removeAll ()
 
void append (const UserFieldValue &value)
 Append the specified value to this object.
 
void appendNull ()
 
void appendInt64 (bsls::Types::Int64 value)
 
void appendDouble (double value)
 
void appendString (const bsl::string_view &value)
 
void appendDatetimeTz (const bdlt::DatetimeTz &value)
 Append an element having the unset value to this object.
 
void appendCharArray (const bsl::vector< char > &value)
 Append the specified value to this object.
 
ball::UserFieldValueoperator[] (int index)
 
ball::UserFieldValuevalue (int index)
 
void swap (UserFields &other)
 
ConstIterator begin () const
 
ConstIterator end () const
 
int length () const
 Return the number of user field values in this object.
 
const ball::UserFieldValueoperator[] (int index) const
 
const ball::UserFieldValuevalue (int index) const
 
bslma::Allocatorallocator () const
 
bsl::ostream & print (bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
 

Friends

bool operator== (const UserFields &, const UserFields &)
 
void swap (UserFields &, UserFields &)
 

Detailed Description

This class implements a value-semantic type for representing a sequence of (randomly accessible) user field values.

See ball_userfields

Member Typedef Documentation

◆ ConstIterator

Constructor & Destructor Documentation

◆ UserFields() [1/2]

ball::UserFields::UserFields ( bslma::Allocator basicAllocator = 0)
inlineexplicit

Create an empty UserFields object. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used.

◆ UserFields() [2/2]

ball::UserFields::UserFields ( const UserFields original,
bslma::Allocator basicAllocator = 0 
)
inline

Create a UserFields object having the same value as the specified original object. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used.

◆ ~UserFields()

ball::UserFields::~UserFields ( )
default

Member Function Documentation

◆ allocator()

bslma::Allocator * ball::UserFields::allocator ( ) const
inline

Return the allocator used by this object to supply memory. Note that if no allocator was supplied at construction the currently installed default allocator is used.

◆ append()

void ball::UserFields::append ( const UserFieldValue value)
inline

◆ appendCharArray()

void ball::UserFields::appendCharArray ( const bsl::vector< char > &  value)
inline

◆ appendDatetimeTz()

void ball::UserFields::appendDatetimeTz ( const bdlt::DatetimeTz value)
inline

◆ appendDouble()

void ball::UserFields::appendDouble ( double  value)
inline

◆ appendInt64()

void ball::UserFields::appendInt64 ( bsls::Types::Int64  value)
inline

◆ appendNull()

void ball::UserFields::appendNull ( )
inline

◆ appendString()

void ball::UserFields::appendString ( const bsl::string_view value)
inline

◆ begin()

UserFields::ConstIterator ball::UserFields::begin ( ) const
inline

Return an iterator providing non-modifiable access to the first element in the sequence of user field values maintained by this object, or the end iterator if this object is empty.

◆ BSLMF_NESTED_TRAIT_DECLARATION()

ball::UserFields::BSLMF_NESTED_TRAIT_DECLARATION ( UserFields  ,
bslma::UsesBslmaAllocator   
)

◆ end()

UserFields::ConstIterator ball::UserFields::end ( ) const
inline

Return an iterator providing non-modifiable access to the past-the-end element in the sequence of user field values maintained by this object.

◆ length()

int ball::UserFields::length ( ) const
inline

◆ operator=()

UserFields & ball::UserFields::operator= ( const UserFields rhs)
inline

Assign to this object the value of the specified rhs object, and return a reference providing modifiable access to this object.

◆ operator[]() [1/2]

UserFieldValue & ball::UserFields::operator[] ( int  index)
inline

Return a reference providing modifiable access to the value at the specified index. The behavior is undefined unless 0 <= index && index < length().

◆ operator[]() [2/2]

const UserFieldValue & ball::UserFields::operator[] ( int  index) const
inline

Return a reference providing non-modifiable access to the value at the specified index. The behavior is undefined unless 0 <= index && index < length().

◆ print()

bsl::ostream & ball::UserFields::print ( bsl::ostream &  stream,
int  level = 0,
int  spacesPerLevel = 4 
) const

Write the value of this object to the specified output stream in a human-readable format, and return a reference to stream. Optionally specify an initial indentation level, whose absolute value is incremented recursively for nested objects. If level is specified, optionally specify spacesPerLevel, whose absolute value indicates the number of spaces per indentation level for this and all of its nested objects. If level is negative, suppress indentation of the first line. If spacesPerLevel is negative, format the entire output on one line, suppressing all but the initial indentation (as governed by level). If stream is not valid on entry, this operation has no effect. Note that the format is not fully specified, and can change without notice.

◆ removeAll()

void ball::UserFields::removeAll ( )
inline

Remove all of the user field values from this object. After this method is called length is 0.

◆ swap()

void ball::UserFields::swap ( UserFields other)
inline

Efficiently exchange the value of this object with the value of the specified other object. This method provides the no-throw exception-safety guarantee. The behavior is undefined unless this object was created with the same allocator as other.

◆ value() [1/2]

UserFieldValue & ball::UserFields::value ( int  index)
inline

◆ value() [2/2]

const UserFieldValue & ball::UserFields::value ( int  index) const
inline

Friends And Related Symbol Documentation

◆ operator==

bool operator== ( const UserFields ,
const UserFields  
)
friend

Return true if the specified lhs and rhs objects have the same value, and false otherwise. Two ball::UserFields objects have the same value if they have the same number of elements, and each element in lhs has the same value as corresponding element at the same index in rhs.

◆ swap

void swap ( UserFields ,
UserFields  
)
friend

Swap the value of the specified a object with the value of the specified b object. If a and b were created with the same allocator, then this method provides the no-throw exception-safety guarantee; otherwise, it provides the basic guarantee.


The documentation for this class was generated from the following file: