BDE 4.39.x Production Release
Loading...
Searching...
No Matches

Classes

struct  HasFallbackEnumerator
 
struct  HasFallbackEnumerator< bdlar::EnumConstRef >
 
struct  HasFallbackEnumerator< bdlar::EnumRef >
 
struct  IsEnumeration
 
struct  IsEnumeration< bdlar::EnumConstRef >
 
struct  IsEnumeration< bdlar::EnumRef >
 
struct  IsEnumeration< s_baltst::TestDynamicType< VALUE_TYPE > >
 
struct  IsEnumeration< s_baltst::TestEnumeration< E0, E1, E2 > >
 
struct  IsEnumeration< s_baltst::TestTaggedValue< TAG_TYPE, VALUE_TYPE > >
 

Functions

template<class TYPE >
int fromInt (TYPE *result, int number)
 
template<class TYPE >
int fromString (TYPE *result, const char *string, int stringLength)
 
template<class TYPE >
int makeFallback (TYPE *result)
 
template<class TYPE >
bool hasFallback (const TYPE &value)
 
template<class TYPE >
bool isFallback (const TYPE &value)
 
template<class TYPE >
void toInt (int *result, const TYPE &value)
 
template<class TYPE >
void toString (bsl::string *result, const TYPE &value)
 
template<class TYPE >
int bdlat_enumFromInt (TYPE *result, int number)
 
template<class TYPE >
int bdlat_enumFromString (TYPE *result, const char *string, int stringLength)
 
template<class TYPE >
int bdlat_enumMakeFallback (TYPE *result)
 
template<class TYPE >
void bdlat_enumToInt (int *result, const TYPE &value)
 
template<class TYPE >
void bdlat_enumToString (bsl::string *result, const TYPE &value)
 
template<class TYPE >
bool bdlat_enumHasFallback (const TYPE &value)
 
template<class TYPE >
bool bdlat_enumIsFallback (const TYPE &value)
 

Detailed Description

This namespace provides functions that expose "enumeration" behavior for "enumeration" types. See the component-level documentation for more information.

This namespace declaration adds the default implementations of the "enumeration" customization-point functions to bdlat_EnumFunctions. These default implementations assume the type of the acted-upon object is a basic-enumeration type. For more information about basic-enumeration types, see bdlat_typetraits .

In order to use a type as a bdlat enumeration type that is not a basic-enumeration type, you must implement the below customization points for that type as overloads in the namespace that the type belongs to. Overloading the bdlat_enumMakeFallback, bdlat_enumHasFallback, and bdlat_enumIsFallback functions is required only if HasFallbackEnumerator is true for your type or class of types. In that case, the three functionsbehaviors must be consistent with each other, which means that the following axioms must hold for a non-const lvaluex:

  1. Wheneverbdlat_enumHasFallback(x)isfalse, bdlat_enumMakeFallback(&x)would fail by leavingxunchanged and returning a nonzero value, andbdlat_enumIsFallback(x)isfalse;
  2. Wheneverbdlat_enumHasFallback(x)istrue, bdlat_enumMakeFallback(&x)would succeed by returning 0 and a call tobdlat_enumIsFallback(x)immediately afterward would return true`.

Function Documentation

◆ bdlat_enumFromInt()

template<class TYPE >
int bdlat_EnumFunctions::bdlat_enumFromInt ( TYPE *  result,
int  number 
)

◆ bdlat_enumFromString()

template<class TYPE >
int bdlat_EnumFunctions::bdlat_enumFromString ( TYPE *  result,
const char *  string,
int  stringLength 
)

◆ bdlat_enumHasFallback()

template<class TYPE >
bool bdlat_EnumFunctions::bdlat_enumHasFallback ( const TYPE &  value)

Return true if the specified value supports a fallback enumerator, and false otherwise.

Precondition
The behavior is undefined if this default implementation of bdlat_enumHasFallback is instantiated with a template parameter TYPE such that bdlat_HasFallbackEnumerator<TYPE> is false.
Note
Note that this is a customization point function and should not be called directly by user code. Use bdlat_EnumFunctions::hasFallback instead.

◆ bdlat_enumIsFallback()

template<class TYPE >
bool bdlat_EnumFunctions::bdlat_enumIsFallback ( const TYPE &  value)

Return true if the specified value is equal to a fallback enumerator, and false otherwise.

Precondition
The behavior is undefined if this default implementation of bdlat_enumIsFallback is instantiated with a template parameter TYPE such that bdlat_HasFallbackEnumerator<TYPE> is false.
Note
Note that this is a customization point function and should not be called directly by user code. Use bdlat_EnumFunctions::isFallback instead.

◆ bdlat_enumMakeFallback()

template<class TYPE >
int bdlat_EnumFunctions::bdlat_enumMakeFallback ( TYPE *  result)

Load into the specified result the fallback enumerator value. Return 0 on success, and a non-zero value with no effect on result if it does not have a fallback enumerator.

Precondition
The behavior is undefined if this default implementation of bdlat_enumMakeFallback is instantiated with a template parameter TYPE such that bdlat_HasFallbackEnumerator<TYPE> is false.
Note
Note that this is a customization point function and should not be called directly by user code. Use bdlat_EnumFunctions::makeFallback instead.

◆ bdlat_enumToInt()

template<class TYPE >
void bdlat_EnumFunctions::bdlat_enumToInt ( int *  result,
const TYPE &  value 
)

◆ bdlat_enumToString()

template<class TYPE >
void bdlat_EnumFunctions::bdlat_enumToString ( bsl::string result,
const TYPE &  value 
)

◆ fromInt()

template<class TYPE >
int bdlat_EnumFunctions::fromInt ( TYPE *  result,
int  number 
)

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

◆ fromString()

template<class TYPE >
int bdlat_EnumFunctions::fromString ( TYPE *  result,
const char *  string,
int  stringLength 
)

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

◆ hasFallback()

template<class TYPE >
bool bdlat_EnumFunctions::hasFallback ( const TYPE &  value)

Return true if the specified value supports a fallback enumerator, and false otherwise.

◆ isFallback()

template<class TYPE >
bool bdlat_EnumFunctions::isFallback ( const TYPE &  value)

Return true if the specified value is equal to a fallback enumerator, and false otherwise.

◆ makeFallback()

template<class TYPE >
int bdlat_EnumFunctions::makeFallback ( TYPE *  result)

Load into the specified result the fallback enumerator value. Return 0 on success, and a non-zero value with no effect on result if it does not have a fallback enumerator.

◆ toInt()

template<class TYPE >
void bdlat_EnumFunctions::toInt ( int *  result,
const TYPE &  value 
)

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

◆ toString()

template<class TYPE >
void bdlat_EnumFunctions::toString ( bsl::string result,
const TYPE &  value 
)

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