TypeDefinition :: enumeratorDefinition - Get enumerator definition
The function returns the enumerator definition for the requested category in the top enumerator list. In case of hierarchical enumerations, subordinated enumerators can be searched via sub enumerator lists provided by enumerator definitions.
When the requested enumerator could not be found in the top enumerator list, the function returns an empty enumerator, which might be checked by calling EnumeratorDefinition ::isValid() .
When the type definition is not an enumeration or the enumerator definition in the dictionary is invalid, the function throws an exception. In order to check, whether the data type is an enumeration, isEnumeration() might be called.
Enumerator definitions provide code, name and definition for an enumerator value.
Implementation overview
- Get enumerator by value
TypeDefinition :: enumeratorDefinition ( iEnumeratorValue ) - Get enumerator by name
TypeDefinition :: enumeratorDefinition ( sName )
Implementation details
-
Get enumerator by value
const odaba::EnumeratorDefinition TypeDefinition  :: enumeratorDefinition ( int32 iEnumeratorValue )
The function provides the enumerator for the enumerator code (value) passed in iEnumeratorValue . The function only searches in the enumerator top list.
When no enumerator with the passed code could be found, the function returns an empty enumerator definition.
EnumeratorDefinition lookup(TypeDefinition &enumdef, int code) {
EnumeratorDefinition edef;
edef = enumdef.enumeratorDefinition(code);
if ( !edef.IsValid() )
output("enumerator not found");
return edef;
}
- iEnumeratorValue
- Enumerator value
The enumerator value is the code (value) of an enumerator as being defined in an enumeration. CS_U is a reserved value indication an invalid enumerator value.
to list
- iEnumeratorValue
- Enumerator value
-
Get enumerator by name
const odaba::EnumeratorDefinition TypeDefinition  :: enumeratorDefinition ( odaba::String &sName )
The function searches the enumerator for the enumerator name passed in sName . The function only searches in the enumerator top list.
When no enumerator with the passed name could be found, the function returns an empty (invalid) enumerator definition.
EnumeratorDefinition lookup(TypeDefinition &enumdef, String name) {
EnumeratorDefinition edef;
edef = enumdef.enumeratorDefinition(name);
if ( !edef.IsValid() )
output("enumerator not found");
return edef;
}
- sName - Name
to list