BDE 4.39.x Production Release
Loading...
Searching...
No Matches
bdlar::EnumRef Class Reference

#include <bdlar_enumref.h>

Public Member Functions

template<class t_ENUM >
 EnumRef (t_ENUM &enumeration, typename bsl::enable_if< IsEnum< t_ENUM >::value >::type *=0)
 
 EnumRef (void *objectAddress, const EnumVtable *vtable)
 
int fromInt (int number) const
 
int fromString (const char *string, int stringLength) const
 
int makeFallback () const
 
void reset () const
 
const EnumVtablevtable () const
 
bool hasFallback () const
 
bool isFallback () const
 
void * objectAddress () const
 
void toInt (int *result) const
 
void toString (bsl::string *result) const
 

Constructor & Destructor Documentation

◆ EnumRef() [1/2]

template<class t_ENUM >
bdlar::EnumRef::EnumRef ( t_ENUM &  enumeration,
typename bsl::enable_if< IsEnum< t_ENUM >::value >::type *  = 0 
)
inlineexplicit

Create an EnumRef object that type erases the supplied enumeration object.

◆ EnumRef() [2/2]

bdlar::EnumRef::EnumRef ( void *  objectAddress,
const EnumVtable vtable 
)
inline

Create an EnumRef object.

Precondition
The behaviour is undefined unless objectAddress and vtable point to the valid objects.

Member Function Documentation

◆ fromInt()

int bdlar::EnumRef::fromInt ( int  number) const
inline

Assign the enumerator value matching the specified number. Return 0 on success, and a non-zero value with no effect on the object if number does not match any enumerator.

◆ fromString()

int bdlar::EnumRef::fromString ( const char *  string,
int  stringLength 
) const
inline

Assign the enumerator value matching the specified string of the specified stringLength. Return 0 on success, and a non-zero value with no effect on the object if string and stringLength do not match any enumerator.

◆ hasFallback()

bool bdlar::EnumRef::hasFallback ( ) const
inline

Return true if the specified enumerator held by this object supports a fallback enumerator, and false otherwise.

◆ isFallback()

bool bdlar::EnumRef::isFallback ( ) const
inline

Return true if the specified enumerator held by this object is equal to a fallback enumerator, and false otherwise.

◆ makeFallback()

int bdlar::EnumRef::makeFallback ( ) const
inline

Assign the fallback enumerator value. Return 0 on success, and a non-zero value with no effect on the object if it does not have a fallback enumerator.

◆ objectAddress()

void * bdlar::EnumRef::objectAddress ( ) const
inline

Return a pointer to the wrapped object.

◆ reset()

void bdlar::EnumRef::reset ( ) const
inline

Reset the referred object to the default value.

◆ toInt()

void bdlar::EnumRef::toInt ( int *  result) const
inline

Load into the specified result the integer representation of the enumerator value held by this object.

◆ toString()

void bdlar::EnumRef::toString ( bsl::string result) const
inline

Load into the specified result the string representation of the enumerator value held by this object.

◆ vtable()

const EnumVtable * bdlar::EnumRef::vtable ( ) const
inline

Return a pointer to the vtable.


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