Puma Reference Manual | Puma: Puma::CEnumInfo Class Reference |
Semantic information about an enumeration. More...
#include <Puma/CEnumInfo.h>
Inherits Puma::CScopeRequest.
Public Member Functions | |
CEnumInfo () | |
Constructor. | |
~CEnumInfo () | |
Destructor. | |
unsigned | Enumerators () const |
Get the number of enumerators in this enumeration. | |
CEnumeratorInfo * | Enumerator (unsigned n) const |
Get the n-th enumerator. | |
CEnumeratorInfo * | Enumerator (const char *name) const |
Get the enumerator with the given name. | |
CEnumInfo * | DefObject () const |
Get the semantic object of the enumeration definition. | |
CTypeEnum * | TypeInfo () const |
Get the type information for the enumeration. | |
void | addEnumerator (CEnumeratorInfo *ei) |
Add a new enumerator to the enumeration. | |
void | removeEnumerator (const CEnumeratorInfo *ei) |
Remove the given enumerator from the enumeration. | |
CEnumeratorInfo * | newEnumerator () |
Create a semantic object for an enumerator. | |
void | deleteEnumerator (const CEnumeratorInfo *ei) |
Destroy the given enumerator. | |
bool | isDefined () const |
Check if the enumeration is defined. | |
bool | isComplete (unsigned long pos=0) const |
Check if the enumeration is complete (defined) at the given source code position. | |
CTypeInfo * | UnderlyingType () const |
Return the underlying data type of the enumeration. | |
void | UnderlyingType (CTypeInfo *type) |
Set the underlying data type of the enumeration. |
Semantic information about an enumeration.
Puma::CEnumInfo::CEnumInfo | ( | ) |
Constructor.
Puma::CEnumInfo::~CEnumInfo | ( | ) |
Destructor.
If the object type is CObjectInfo::ENUM_INFO, then CObjectInfo::CleanUp() is called.
void Puma::CEnumInfo::addEnumerator | ( | CEnumeratorInfo * | ei | ) |
Add a new enumerator to the enumeration.
ei | The enumerator. |
CEnumInfo* Puma::CEnumInfo::DefObject | ( | ) | const |
Get the semantic object of the enumeration definition.
Reimplemented from Puma::CObjectInfo.
void Puma::CEnumInfo::deleteEnumerator | ( | const CEnumeratorInfo * | ei | ) |
Destroy the given enumerator.
The enumerator is removed from the enumeration.
ei | The enumerator. |
CEnumeratorInfo* Puma::CEnumInfo::Enumerator | ( | const char * | name | ) | const |
Get the enumerator with the given name.
name | The name of the enumerator. |
CEnumeratorInfo * Puma::CEnumInfo::Enumerator | ( | unsigned | n | ) | const [inline] |
Get the n-th enumerator.
n | The index of the enumerator. |
unsigned Puma::CEnumInfo::Enumerators | ( | ) | const [inline] |
Get the number of enumerators in this enumeration.
bool Puma::CEnumInfo::isComplete | ( | unsigned long | pos = 0 |
) | const |
Check if the enumeration is complete (defined) at the given source code position.
The position is specified by the unique number of the CT_Token tree node representing the name of the enumeration.
pos | The source code position. |
bool Puma::CEnumInfo::isDefined | ( | ) | const |
Check if the enumeration is defined.
CEnumeratorInfo* Puma::CEnumInfo::newEnumerator | ( | ) |
Create a semantic object for an enumerator.
The new enumerator is added to the enumeration.
void Puma::CEnumInfo::removeEnumerator | ( | const CEnumeratorInfo * | ei | ) |
Remove the given enumerator from the enumeration.
ei | The enumerator. |
CTypeEnum * Puma::CEnumInfo::TypeInfo | ( | ) | const [inline] |
Get the type information for the enumeration.
Reimplemented from Puma::CObjectInfo.
void Puma::CEnumInfo::UnderlyingType | ( | CTypeInfo * | type | ) | [inline] |
Set the underlying data type of the enumeration.
This is implementation-defined and defaults to int.
type | The underlying type. |
CTypeInfo * Puma::CEnumInfo::UnderlyingType | ( | ) | const [inline] |
Return the underlying data type of the enumeration.
This is implementation-defined and defaults to int.