PUMA Library Reference Manual
Puma::CEnumInfo Class Reference

#include <Puma/CEnumInfo.h>

+ Inheritance diagram for Puma::CEnumInfo:

Description

Semantic information about an enumeration.

Public Member Functions

 CEnumInfo ()
 Constructor. More...
 
 ~CEnumInfo ()
 Destructor. More...
 
unsigned Enumerators () const
 Get the number of enumerators in this enumeration. More...
 
CEnumeratorInfoEnumerator (unsigned n) const
 Get the n-th enumerator. More...
 
CEnumeratorInfoEnumerator (const char *name) const
 Get the enumerator with the given name. More...
 
CEnumInfoDefObject () const
 Get the semantic object of the enumeration definition. More...
 
CTypeEnumTypeInfo () const
 Get the type information for the enumeration. More...
 
void addEnumerator (CEnumeratorInfo *ei)
 Add a new enumerator to the enumeration. More...
 
void removeEnumerator (const CEnumeratorInfo *ei)
 Remove the given enumerator from the enumeration. More...
 
CEnumeratorInfonewEnumerator ()
 Create a semantic object for an enumerator. More...
 
void deleteEnumerator (const CEnumeratorInfo *ei)
 Destroy the given enumerator. More...
 
bool isDefined () const
 Check if the enumeration is defined. More...
 
bool isComplete (unsigned long pos=0) const
 Check if the enumeration is complete (defined) at the given source code position. More...
 
CTypeInfoUnderlyingType () const
 Return the underlying data type of the enumeration. More...
 
void UnderlyingType (CTypeInfo *type)
 Set the underlying data type of the enumeration. More...
 
- Public Member Functions inherited from Puma::CScopeRequest
 ~CScopeRequest ()
 Destructor. More...
 
CScopeInfoScope () const
 Get the enclosing scope. More...
 
void Scope (CScopeInfo *scope)
 Set the enclosing scope. More...
 
- Public Member Functions inherited from Puma::CObjectInfo
 ~CObjectInfo ()
 Destructor. More...
 
bool operator== (const CObjectInfo &) const
 Compare the addresses of this object and all objects linked to this object with the address of the given object. More...
 
bool operator!= (const CObjectInfo &) const
 Compare the addresses of this object and all objects linked to this object with the address of the given object. More...
 
CObjectInfoObjectInfo () const
 Get a pointer to CObjectInfo for any semantic object type. More...
 
CLabelInfoLabelInfo () const
 Return a pointer to CLabelInfo if the entity is a label. More...
 
CMemberAliasInfoMemberAliasInfo () const
 Return a pointer to CMemberAliasInfo if the entity is a member alias. More...
 
CBaseClassInfoBaseClassInfo () const
 Return a pointer to CBaseClassInfo if the entity is a base class specifier. More...
 
CUsingInfoUsingInfo () const
 Return a pointer to CUsingInfo if the entity is a using-directive. More...
 
CTypedefInfoTypedefInfo () const
 Return a pointer to CTypedefInfo if the entity is a typedef. More...
 
CArgumentInfoArgumentInfo () const
 Return a pointer to CArgumentInfo if the entity is a function parameter. More...
 
CAttributeInfoAttributeInfo () const
 Return a pointer to CAttributeInfo if the entity is an object or enumeration constant. More...
 
CTemplateParamInfoTemplateParamInfo () const
 Return a pointer to CTemplateParemInfo if the entity is a template parameter. More...
 
CStructureStructure () const
 Return a pointer to CStructure if the entity is a namespace, class, function, or any other construct that can contain other entities. More...
 
CFileInfoFileInfo () const
 Return a pointer to CFileInfo if this is the file scope. More...
 
CRecordRecord () const
 Return a pointer to CRecord if the entity is a class or union. More...
 
CLocalScopeLocalScope () const
 Return a pointer to CLocalScope if the entity is a local scope (block scope). More...
 
CScopeInfoScopeInfo () const
 Return a pointer to CScopeInfo if the entity defines a scope. More...
 
CClassInfoClassInfo () const
 Return a pointer to CClassInfo if the entity is a class. More...
 
CUnionInfoUnionInfo () const
 Return a pointer to CUnionInfo if the entity is a union. More...
 
CEnumInfoEnumInfo () const
 Return a pointer to CEnumInfo if the entity is an enumeration. More...
 
CFunctionInfoFunctionInfo () const
 Return a pointer to CFunctionInfo if the entity is a function, method, or overloaded operator. More...
 
CNamespaceInfoNamespaceInfo () const
 Return a pointer to CNamespaceInfo if the entity is a namespace. More...
 
CEnumeratorInfoEnumeratorInfo () const
 Return a pointer to CEnumeratorInfo if the entity is an enumeration constant. More...
 
CTemplateInfoTemplateInfo () const
 Return a pointer to CTemplateInfo if the entity is a template. More...
 
CClassInstanceClassInstance () const
 Return a pointer to CClassInstance if the entity is an instance of a class template. More...
 
CFctInstanceFctInstance () const
 Return a pointer to CFctInstance if the entity is an instance of a function template. More...
 
CUnionInstanceUnionInstance () const
 Return a pointer to CUnionInstance if the entity is an instance of a union template. More...
 
CTemplateInfoTemplate () const
 Return a pointer to CTemplateInfo if the entity is a template. More...
 
CTemplateInstanceTemplateInstance () const
 Return a pointer to CTemplateInstance if the entity is an instance of a class or function template. More...
 
CScopeInfoScope () const
 Get the scope in which the entity was declared. More...
 
CStructureQualifiedScope () const
 Get the scope of qualified names. More...
 
CRecordClassScope () const
 Get the class containing the class member described by this object. More...
 
CStructureAssignedScope () const
 Get the scope of a friend class or function. More...
 
ObjectId Id () const
 Get the type of this semantic object. More...
 
const DStringName () const
 Get the name of entity described by this semantic object. More...
 
const char * QualName (bool abs=false, bool tdef=false, bool unnamed=false)
 Get the qualified name of the entity described by this semantic object. More...
 
CObjectInfoDefObject () const
 Get the semantic information object for the definition of an entity. More...
 
CTypeInfoTypeInfo () const
 Get the data type of the entity. More...
 
CSourceInfoSourceInfo () const
 Get the source file information. More...
 
CSemDatabaseClassDB () const
 Get the semantic information database object containing this semantic object. More...
 
CSemDatabaseSemDB () const
 Get the semantic information database object containing this semantic object. More...
 
CTreeTree () const
 Get the syntax tree node for the entity described by this semantic object. More...
 
CObjectInfoNextObject () const
 Get the next semantic object linked with this object. More...
 
CObjectInfoPrevObject () const
 Get the previous semantic object linked with this object. More...
 
CObjectInfoBaseObject () const
 Get the semantic object for the base class entity this entity is overloading. More...
 
CTreeInit () const
 Get the initializer of the entity. More...
 
CProtection::Type Protection () const
 Get the member protection of the entity, if it is a class member. More...
 
CLinkage::Type Linkage () const
 Get the linkage of the entity. More...
 
CStorage::Type Storage () const
 Get the storage class of the entity. More...
 
const CLanguageLanguage () const
 Get the entity encoding language. More...
 
CLanguageLanguage ()
 Get the entity encoding language. More...
 
const CSpecifiersSpecifiers () const
 Get the declaration specifiers. More...
 
bool isType () const
 Check if the entity is a type. More...
 
bool isObject () const
 Check if the entity is an object. More...
 
bool isAnonymous () const
 Check if the entity is anonymous (has no explicit name). More...
 
bool isTemplate () const
 Check if the entity is a class or function template, or a template template parameter. More...
 
bool isTemplateInstance () const
 Check if the entity is a class or function template instance. More...
 
bool isBuiltin () const
 Check if the entity describes a built-in type or function. More...
 
bool isClassMember () const
 Check if the entity is a method or data member of a class. More...
 
bool isVirtual () const
 Check if the entity is declared virtual. More...
 
bool isStatic () const
 Check if the entity is declared static. More...
 
bool isThreadLocal () const
 Check if the entity is declared __thread. More...
 
bool isExtern () const
 Check if the entity is declared extern. More...
 
bool isMutable () const
 Check if the entity is declared mutable. More...
 
bool isRegister () const
 Check if the entity is declared register. More...
 
bool isExplicit () const
 Check if the entity is declared explicit. More...
 
bool isInline () const
 Check if the entity is declared inline. More...
 
bool isAuto () const
 Check if the entity is declared auto. More...
 
bool isRegistered (const CStructure *s) const
 Check if the given semantic object is registered as being connected to this semantic object in any way. More...
 
bool isLocal () const
 Check if the entity is local. More...
 
void Name (const char *s)
 Set the name of the entity. More...
 
void Name (const DString &ds)
 Set the name of the entity. More...
 
void TypeInfo (CTypeInfo *type)
 Set the type of the entity. More...
 
void BaseObject (CObjectInfo *base)
 Set the base class object for the entity this entity overloads. More...
 
void Protection (CProtection::Type p)
 Set the member access protection of the entity. More...
 
void Linkage (CLinkage::Type l)
 Set the linkage of the entity. More...
 
void Storage (CStorage::Type s)
 Set the storage class of the entity. More...
 
void Specifiers (const CSpecifiers &)
 Set the declaration specifiers. More...
 
void FileInfo (CFileInfo *finfo)
 Set the source file information for the entity. More...
 
void Tree (CTree *tree)
 Set the syntax tree node of the entity. More...
 
void ClassDB (CSemDatabase *db)
 Set the semantic information database object containing this semantic object. More...
 
void SemDB (CSemDatabase *db)
 Set the semantic information database object containing this semantic object. More...
 
void NextObject (CObjectInfo *obj)
 Set the link to next semantic object. More...
 
void PrevObject (CObjectInfo *obj)
 Set the link to next semantic object. More...
 
void Unlink ()
 Unlink this semantic object. More...
 
void Register (CStructure *s)
 Register the given semantic object as being connected to this semantic object in any way. More...
 
void Unregister (CStructure *s)
 Unregister the given semantic object as being connected to this semantic object in any way. More...
 
void isVirtual (bool v)
 Set whether the entity was declared virtual. More...
 
void isStatic (bool v)
 Set whether the entity was declared static. More...
 
void isThreadLocal (bool v)
 Set whether the entity was declared __thread. More...
 
void isExtern (bool v)
 Set whether the entity was declared extern. More...
 
void isMutable (bool v)
 Set whether the entity was declared mutable. More...
 
void isRegister (bool v)
 Set whether the entity was declared register. More...
 
void isExplicit (bool v)
 Set whether the entity was declared explicit. More...
 
void isInline (bool v)
 Set whether the entity was declared inline. More...
 
void isAuto (bool v)
 Set whether the entity was declared auto. More...
 
void AssignedScope (CStructure *s)
 Set the assigned scope of the entity. More...
 

Additional Inherited Members

- Public Types inherited from Puma::CObjectInfo
enum  ObjectId {
  FILE_INFO,
  UNION_INFO,
  CLASS_INFO,
  BASECLASS_INFO,
  MEMBERALIAS_INFO,
  ENUM_INFO,
  TYPEDEF_INFO,
  FUNCTION_INFO,
  LABEL_INFO,
  ENUMERATOR_INFO,
  ATTRIBUTE_INFO,
  TEMPLATE_PARAM_INFO,
  TEMPLATE_INFO,
  CLASS_INSTANCE_INFO,
  UNION_INSTANCE_INFO,
  FCT_INSTANCE_INFO,
  ARGUMENT_INFO,
  LOCAL_INFO,
  NAMESPACE_INFO,
  USING_INFO
}
 Semantic information object types. More...
 
- Protected Member Functions inherited from Puma::CScopeRequest
 CScopeRequest (ObjectId id)
 Constructor. More...
 
- Protected Member Functions inherited from Puma::CObjectInfo
 CObjectInfo (ObjectId id)
 Constructor. More...
 
- Protected Attributes inherited from Puma::CObjectInfo
CStructure_QualScope
 Qualified name scope. More...
 
CStructure_AssignedScope
 The scope of a friend class or function. More...
 
Array< CStructure * > _Registered
 Set of semantic objects connected to this object in any way. More...
 

Constructor & Destructor Documentation

◆ CEnumInfo()

Puma::CEnumInfo::CEnumInfo ( )

Constructor.

◆ ~CEnumInfo()

Puma::CEnumInfo::~CEnumInfo ( )

Destructor.

If the object type is CObjectInfo::ENUM_INFO, then CObjectInfo::CleanUp() is called.

Member Function Documentation

◆ addEnumerator()

void Puma::CEnumInfo::addEnumerator ( CEnumeratorInfo ei)

Add a new enumerator to the enumeration.

Parameters
eiThe enumerator.

◆ DefObject()

CEnumInfo* Puma::CEnumInfo::DefObject ( ) const

Get the semantic object of the enumeration definition.

See also
CObjectInfo::DefObject()

◆ deleteEnumerator()

void Puma::CEnumInfo::deleteEnumerator ( const CEnumeratorInfo ei)

Destroy the given enumerator.

The enumerator is removed from the enumeration.

Parameters
eiThe enumerator.

◆ Enumerator() [1/2]

CEnumeratorInfo* Puma::CEnumInfo::Enumerator ( const char *  name) const

Get the enumerator with the given name.

Parameters
nameThe name of the enumerator.
Returns
The enumerator or NULL if no enumerator with that name.

◆ Enumerator() [2/2]

CEnumeratorInfo * Puma::CEnumInfo::Enumerator ( unsigned  n) const
inline

Get the n-th enumerator.

Parameters
nThe index of the enumerator.
Returns
The enumerator or NULL if n is invalid.

◆ Enumerators()

unsigned Puma::CEnumInfo::Enumerators ( ) const
inline

Get the number of enumerators in this enumeration.

◆ isComplete()

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.

Parameters
posThe source code position.

◆ isDefined()

bool Puma::CEnumInfo::isDefined ( ) const

Check if the enumeration is defined.

◆ newEnumerator()

CEnumeratorInfo* Puma::CEnumInfo::newEnumerator ( )

Create a semantic object for an enumerator.

The new enumerator is added to the enumeration.

◆ removeEnumerator()

void Puma::CEnumInfo::removeEnumerator ( const CEnumeratorInfo ei)

Remove the given enumerator from the enumeration.

Parameters
eiThe enumerator.

◆ TypeInfo()

CTypeEnum * Puma::CEnumInfo::TypeInfo ( ) const
inline

Get the type information for the enumeration.

◆ UnderlyingType() [1/2]

CTypeInfo * Puma::CEnumInfo::UnderlyingType ( ) const
inline

Return the underlying data type of the enumeration.

This is implementation-defined and defaults to int.

◆ UnderlyingType() [2/2]

void Puma::CEnumInfo::UnderlyingType ( CTypeInfo type)
inline

Set the underlying data type of the enumeration.

This is implementation-defined and defaults to int.

Parameters
typeThe underlying type.