|
BDE 4.39.x Production Release
|
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) |
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:
isfalse, bdlat_enumMakeFallback(&x)would fail by leavingxunchanged and returning a nonzero value, andbdlat_enumIsFallback(x)isfalse;Wheneverbdlat_enumHasFallback(x)istrue, bdlat_enumMakeFallback(&x)would succeed by returning 0 and a call tobdlat_enumIsFallback(x)immediately afterward would return true`. | int bdlat_EnumFunctions::bdlat_enumFromInt | ( | TYPE * | result, |
| int | number | ||
| ) |
| int bdlat_EnumFunctions::bdlat_enumFromString | ( | TYPE * | result, |
| const char * | string, | ||
| int | stringLength | ||
| ) |
| bool bdlat_EnumFunctions::bdlat_enumHasFallback | ( | const TYPE & | value | ) |
Return true if the specified value supports a fallback enumerator, and false otherwise.
bdlat_enumHasFallback is instantiated with a template parameter TYPE such that bdlat_HasFallbackEnumerator<TYPE> is false. bdlat_EnumFunctions::hasFallback instead. | bool bdlat_EnumFunctions::bdlat_enumIsFallback | ( | const TYPE & | value | ) |
Return true if the specified value is equal to a fallback enumerator, and false otherwise.
bdlat_enumIsFallback is instantiated with a template parameter TYPE such that bdlat_HasFallbackEnumerator<TYPE> is false. bdlat_EnumFunctions::isFallback instead. | 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.
bdlat_enumMakeFallback is instantiated with a template parameter TYPE such that bdlat_HasFallbackEnumerator<TYPE> is false. bdlat_EnumFunctions::makeFallback instead. | void bdlat_EnumFunctions::bdlat_enumToInt | ( | int * | result, |
| const TYPE & | value | ||
| ) |
| void bdlat_EnumFunctions::bdlat_enumToString | ( | bsl::string * | result, |
| const TYPE & | value | ||
| ) |
| 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.
| 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.
| bool bdlat_EnumFunctions::hasFallback | ( | const TYPE & | value | ) |
Return true if the specified value supports a fallback enumerator, and false otherwise.
| bool bdlat_EnumFunctions::isFallback | ( | const TYPE & | value | ) |
Return true if the specified value is equal to a fallback enumerator, and false otherwise.
| 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.
| 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.
| 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.