BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bdld::DatumMapRef Class Reference

#include <bdld_datum.h>

Public Types

typedef const bdld::DatumMapEntry element_type
 
typedef bdld::DatumMapEntry value_type
 
typedef bsl::size_t size_type
 
typedef bsl::ptrdiff_t difference_type
 
typedef element_typepointer
 
typedef const element_typeconst_pointer
 
typedef element_typereference
 
typedef const element_typeconst_reference
 
typedef pointer iterator
 
typedef const_pointer const_iterator
 
typedef bsl::reverse_iterator< iteratorreverse_iterator
 
typedef bsl::reverse_iterator< const_iteratorconst_reverse_iterator
 
typedef Datum::SizeType SizeType
 

Public Member Functions

 BSLMF_NESTED_TRAIT_DECLARATION (DatumMapRef, bsl::is_trivially_copyable)
 
 BSLMF_NESTED_TRAIT_DECLARATION (DatumMapRef, bdlb::HasPrintMethod)
 
 DatumMapRef (const DatumMapEntry *data, SizeType size, bool sorted, bool ownsKeys)
 
 ~DatumMapRef ()=default
 Destroy this object.
 
const_reference operator[] (size_type position) const
 
const_iterator begin () const BSLS_KEYWORD_NOEXCEPT
 
const_iterator cbegin () const BSLS_KEYWORD_NOEXCEPT
 
const_iterator end () const BSLS_KEYWORD_NOEXCEPT
 
const_iterator cend () const BSLS_KEYWORD_NOEXCEPT
 
const_reverse_iterator rbegin () const BSLS_KEYWORD_NOEXCEPT
 
const_reverse_iterator crbegin () const BSLS_KEYWORD_NOEXCEPT
 
const_reverse_iterator rend () const BSLS_KEYWORD_NOEXCEPT
 
const_reverse_iterator crend () const BSLS_KEYWORD_NOEXCEPT
 
bool empty () const BSLS_KEYWORD_NOEXCEPT
 Return size() == 0.
 
size_type size () const BSLS_KEYWORD_NOEXCEPT
 
const_reference front () const
 
const_reference back () const
 
pointer data () const BSLS_KEYWORD_NOEXCEPT
 
bool isSorted () const
 Return true if underlying map is sorted and false otherwise.
 
bool ownsKeys () const
 
const Datumfind (const bslstl::StringRef &key) const
 
bsl::ostream & print (bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
 

Detailed Description

This class provides a read-only view to a map of datums (an array of DatumMapEntry objects). It holds the array by a const pointer and an integral size value. It acts as return value for accessors inside the Datum class that return a map of Datum objects. Note that zero-size maps are valid.

See bdld_datum

Member Typedef Documentation

◆ const_iterator

◆ const_pointer

◆ const_reference

◆ const_reverse_iterator

◆ difference_type

typedef bsl::ptrdiff_t bdld::DatumMapRef::difference_type

◆ element_type

◆ iterator

◆ pointer

◆ reference

◆ reverse_iterator

typedef bsl::reverse_iterator<iterator> bdld::DatumMapRef::reverse_iterator

◆ size_type

typedef bsl::size_t bdld::DatumMapRef::size_type

◆ SizeType

SizeType is an alias for an unsigned integral value, representing the capacity of a datum array, the capacity of a datum map, the capacity of the keys-capacity of a datum-key-owning map or the length of a string.

◆ value_type

Constructor & Destructor Documentation

◆ DatumMapRef()

bdld::DatumMapRef::DatumMapRef ( const DatumMapEntry data,
SizeType  size,
bool  sorted,
bool  ownsKeys 
)
inline

Create a DatumMapRef object having the specified data of the specified size and the specified sorted and ownsKeys flags. The behavior is undefined unless 0 != data or 0 == size. Note that the pointer to the array is just copied.

◆ ~DatumMapRef()

bdld::DatumMapRef::~DatumMapRef ( )
default

Member Function Documentation

◆ back()

DatumMapRef::const_reference bdld::DatumMapRef::back ( ) const
inline

Return a reference providing non-modifiable access to the last element of the map this reference object represents. The behavior is undefined unless size() > 0.

◆ begin()

DatumMapRef::const_iterator bdld::DatumMapRef::begin ( ) const
inline

◆ BSLMF_NESTED_TRAIT_DECLARATION() [1/2]

bdld::DatumMapRef::BSLMF_NESTED_TRAIT_DECLARATION ( DatumMapRef  ,
bdlb::HasPrintMethod   
)

◆ BSLMF_NESTED_TRAIT_DECLARATION() [2/2]

bdld::DatumMapRef::BSLMF_NESTED_TRAIT_DECLARATION ( DatumMapRef  ,
bsl::is_trivially_copyable   
)

◆ cbegin()

DatumMapRef::const_iterator bdld::DatumMapRef::cbegin ( ) const
inline

Return an iterator providing non-modifiable access to the first element of the array of map entries this reference object represents; return a past-the-end iterator if size() == 0.

◆ cend()

DatumMapRef::const_iterator bdld::DatumMapRef::cend ( ) const
inline

Return an iterator providing non-modifiable access pointing past-the-end of the array this reference object represents.

◆ crbegin()

DatumMapRef::const_reverse_iterator bdld::DatumMapRef::crbegin ( ) const
inline

Return a reverse iterator providing non-modifiable access to the last element of the array this reference object represents, and the past-the-end reverse iterator if size() == 0.

◆ crend()

DatumMapRef::const_reverse_iterator bdld::DatumMapRef::crend ( ) const
inline

Return a reverse iterator providing non-modifiable access pointing past-the-end of the array this reference object represents.

◆ data()

DatumMapRef::pointer bdld::DatumMapRef::data ( ) const
inline

Return the address providing non-modifiable access to the first element of the map this reference object represents. Return a valid pointer which cannot be dereferenced if the size() == 0.

◆ empty()

bool bdld::DatumMapRef::empty ( ) const
inline

◆ end()

DatumMapRef::const_iterator bdld::DatumMapRef::end ( ) const
inline

◆ find()

const Datum * bdld::DatumMapRef::find ( const bslstl::StringRef key) const

Return a const pointer to the datum having the specified key, if it exists and 0 otherwise. Note that the find has order of O(n) if the data is not sorted based on the keys. If the data is sorted, it has order of O(log(n)). Also note that if multiple entries with matching keys are present, which matching record is found is unspecified.

◆ front()

DatumMapRef::const_reference bdld::DatumMapRef::front ( ) const
inline

Return a reference providing non-modifiable access to the first element of the map this reference object represents. The behavior is undefined unless size() > 0.

◆ isSorted()

bool bdld::DatumMapRef::isSorted ( ) const
inline

◆ operator[]()

DatumMapRef::const_reference bdld::DatumMapRef::operator[] ( size_type  position) const
inline

Return a reference providing non-modifiable access to the element at the specified position in the array of map entries this reference object represents. The behavior is undefined unless position < size().

◆ ownsKeys()

bool bdld::DatumMapRef::ownsKeys ( ) const
inline

Return true if underlying map owns the keys and false otherwise. Note that false is always returned for zero-sized DatumMapRef.

◆ print()

bsl::ostream & bdld::DatumMapRef::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 the modifiable 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 this human-readable format is not fully specified, and can change without notice.

◆ rbegin()

DatumMapRef::const_reverse_iterator bdld::DatumMapRef::rbegin ( ) const
inline

◆ rend()

DatumMapRef::const_reverse_iterator bdld::DatumMapRef::rend ( ) const
inline

◆ size()

DatumMapRef::size_type bdld::DatumMapRef::size ( ) const
inline

Return a const-pointer to the number of elements of the map this reference object represents.


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