PUMA Library Reference Manual
Loading...
Searching...
No Matches
Puma::CSemDatabase Class Reference

#include <Puma/CSemDatabase.h>

Description

Semantic information database.

Contains all semantic objects created during the semantic analysis for one translation unit.

Public Types

typedef std::set< CObjectInfo * > ObjectSet
 

Public Member Functions

 CSemDatabase (CProject &prj, int size=997)
 Constructor. More...
 
virtual ~CSemDatabase ()
 Destructor. More...
 
ObjectSetObjects ()
 Get the set of all semantic objects. More...
 
unsigned ObjectInfos () const
 Get the number of semantic objects. More...
 
unsigned ClassInfos () const
 Get the number of semantic objects for classes. More...
 
unsigned UnionInfos () const
 Get the number of semantic objects for unions. More...
 
unsigned EnumInfos () const
 Get the number of semantic objects for enumerations. More...
 
unsigned TypedefInfos () const
 Get the number of semantic objects for typedefs. More...
 
unsigned FunctionInfos () const
 Get the number of semantic objects for functions. More...
 
unsigned FileInfos () const
 Get the number of semantic objects for translation units (file scope). More...
 
CObjectInfoObjectInfo (unsigned n) const
 Get the n-th semantic object. More...
 
CClassInfoClassInfo (unsigned n) const
 Get the n-th semantic object for classes. More...
 
CUnionInfoUnionInfo (unsigned n) const
 Get the n-th semantic object for unions. More...
 
CEnumInfoEnumInfo (unsigned n) const
 Get the n-th semantic object for enumerations. More...
 
CTypedefInfoTypedefInfo (unsigned n) const
 Get the n-th semantic object for typedefs. More...
 
CFunctionInfoFunctionInfo (unsigned n) const
 Get the n-th semantic object for functions. More...
 
CFileInfoFileInfo (unsigned n) const
 Get the n-th semantic object for translation units (file scope). More...
 
CObjectInfoObjectInfo (Token *pos) const
 Get the semantic object for the entity at the given source code position (token). More...
 
CObjectInfoObjectInfo (CT_Token *pos) const
 Get the semantic object for the entity at the given source code position (token). More...
 
CArgumentInfonewArgument ()
 
CAttributeInfonewAttribute ()
 
CBaseClassInfonewBaseClass ()
 
CClassInfonewClass ()
 
CClassInstancenewClassInstance ()
 
CEnumInfonewEnum ()
 
CEnumeratorInfonewEnumerator ()
 
CFunctionInfonewFunction ()
 
CFctInstancenewFctInstance ()
 
CLabelInfonewLabel ()
 
CLocalScopenewLocalScope ()
 
CMemberAliasInfonewMemberAlias ()
 
CNamespaceInfonewNamespace ()
 
CTemplateInfonewTemplate ()
 
CTemplateParamInfonewTemplateParam ()
 
CTypedefInfonewTypedef ()
 
CUnionInfonewUnion ()
 
CUnionInstancenewUnionInstance ()
 
CUsingInfonewUsing ()
 
CFileInfonewFile ()
 
void Insert (CObjectInfo *info)
 Insert a new semantic object into the database. More...
 
void Remove (CObjectInfo *info)
 Remove the given semantic object from the database. More...
 
CFunctionInfoBuiltinOperator (const char *name, int tok, CTypeInfo *rtype, CTypeInfo *t0, CTypeInfo *t1)
 Get the semantic object for the given built-in operator. More...
 
void Dump (std::ostream &out, int depth=0, bool dump_builtins=true) const
 Dump the contents of the database. More...
 
CProjectProject () const
 Get the project information. More...
 

Member Typedef Documentation

◆ ObjectSet

Constructor & Destructor Documentation

◆ CSemDatabase()

Puma::CSemDatabase::CSemDatabase ( CProject prj,
int  size = 997 
)
inline

Constructor.

Parameters
prjThe project information.
sizeInitial size of the database (not yet used!).

◆ ~CSemDatabase()

virtual Puma::CSemDatabase::~CSemDatabase ( )
virtual

Destructor.

Destroys all semantic information objects in the database.

Member Function Documentation

◆ BuiltinOperator()

CFunctionInfo * Puma::CSemDatabase::BuiltinOperator ( const char *  name,
int  tok,
CTypeInfo rtype,
CTypeInfo t0,
CTypeInfo t1 
)

Get the semantic object for the given built-in operator.

Parameters
nameThe operator name/symbol.
tokThe operator token type.
rtypeThe result type of the operator.
t0Type of the first operand.
t1Type of the second operand, or NULL if only one operand.

◆ ClassInfo()

CClassInfo * Puma::CSemDatabase::ClassInfo ( unsigned  n) const
inline

Get the n-th semantic object for classes.

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

◆ ClassInfos()

unsigned Puma::CSemDatabase::ClassInfos ( ) const
inline

Get the number of semantic objects for classes.

◆ Dump()

void Puma::CSemDatabase::Dump ( std::ostream &  out,
int  depth = 0,
bool  dump_builtins = true 
) const

Dump the contents of the database.

The dump is indented as tree corresponding to the nesting of the semantic objects.

Parameters
outThe output stream.
depthThe maximum indentation depth (0 means infinite).
dump_builtinsDump or ignore builtin function, types and objects.

◆ EnumInfo()

CEnumInfo * Puma::CSemDatabase::EnumInfo ( unsigned  n) const
inline

Get the n-th semantic object for enumerations.

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

◆ EnumInfos()

unsigned Puma::CSemDatabase::EnumInfos ( ) const
inline

Get the number of semantic objects for enumerations.

◆ FileInfo()

CFileInfo * Puma::CSemDatabase::FileInfo ( unsigned  n) const
inline

Get the n-th semantic object for translation units (file scope).

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

◆ FileInfos()

unsigned Puma::CSemDatabase::FileInfos ( ) const
inline

Get the number of semantic objects for translation units (file scope).

◆ FunctionInfo()

CFunctionInfo * Puma::CSemDatabase::FunctionInfo ( unsigned  n) const
inline

Get the n-th semantic object for functions.

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

◆ FunctionInfos()

unsigned Puma::CSemDatabase::FunctionInfos ( ) const
inline

Get the number of semantic objects for functions.

◆ Insert()

void Puma::CSemDatabase::Insert ( CObjectInfo info)

Insert a new semantic object into the database.

Parameters
infoThe semantic object.

◆ newArgument()

CArgumentInfo * Puma::CSemDatabase::newArgument ( )

◆ newAttribute()

CAttributeInfo * Puma::CSemDatabase::newAttribute ( )

◆ newBaseClass()

CBaseClassInfo * Puma::CSemDatabase::newBaseClass ( )

◆ newClass()

CClassInfo * Puma::CSemDatabase::newClass ( )

◆ newClassInstance()

CClassInstance * Puma::CSemDatabase::newClassInstance ( )

◆ newEnum()

CEnumInfo * Puma::CSemDatabase::newEnum ( )

◆ newEnumerator()

CEnumeratorInfo * Puma::CSemDatabase::newEnumerator ( )

◆ newFctInstance()

CFctInstance * Puma::CSemDatabase::newFctInstance ( )

◆ newFile()

CFileInfo * Puma::CSemDatabase::newFile ( )

◆ newFunction()

CFunctionInfo * Puma::CSemDatabase::newFunction ( )

◆ newLabel()

CLabelInfo * Puma::CSemDatabase::newLabel ( )

◆ newLocalScope()

CLocalScope * Puma::CSemDatabase::newLocalScope ( )

◆ newMemberAlias()

CMemberAliasInfo * Puma::CSemDatabase::newMemberAlias ( )

◆ newNamespace()

CNamespaceInfo * Puma::CSemDatabase::newNamespace ( )

◆ newTemplate()

CTemplateInfo * Puma::CSemDatabase::newTemplate ( )

◆ newTemplateParam()

CTemplateParamInfo * Puma::CSemDatabase::newTemplateParam ( )

◆ newTypedef()

CTypedefInfo * Puma::CSemDatabase::newTypedef ( )

◆ newUnion()

CUnionInfo * Puma::CSemDatabase::newUnion ( )

◆ newUnionInstance()

CUnionInstance * Puma::CSemDatabase::newUnionInstance ( )

◆ newUsing()

CUsingInfo * Puma::CSemDatabase::newUsing ( )

◆ ObjectInfo() [1/3]

CObjectInfo * Puma::CSemDatabase::ObjectInfo ( CT_Token pos) const

Get the semantic object for the entity at the given source code position (token).

Parameters
posThe token of the entity.
Returns
The semantic object or NULL.

◆ ObjectInfo() [2/3]

CObjectInfo * Puma::CSemDatabase::ObjectInfo ( Token pos) const

Get the semantic object for the entity at the given source code position (token).

Parameters
posThe token of the entity.
Returns
The semantic object or NULL.

◆ ObjectInfo() [3/3]

CObjectInfo * Puma::CSemDatabase::ObjectInfo ( unsigned  n) const

Get the n-th semantic object.

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

◆ ObjectInfos()

unsigned Puma::CSemDatabase::ObjectInfos ( ) const
inline

Get the number of semantic objects.

◆ Objects()

CSemDatabase::ObjectSet & Puma::CSemDatabase::Objects ( )
inline

Get the set of all semantic objects.

◆ Project()

CProject * Puma::CSemDatabase::Project ( ) const
inline

Get the project information.

◆ Remove()

void Puma::CSemDatabase::Remove ( CObjectInfo info)

Remove the given semantic object from the database.

Parameters
infoThe semantic object.

◆ TypedefInfo()

CTypedefInfo * Puma::CSemDatabase::TypedefInfo ( unsigned  n) const
inline

Get the n-th semantic object for typedefs.

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

◆ TypedefInfos()

unsigned Puma::CSemDatabase::TypedefInfos ( ) const
inline

Get the number of semantic objects for typedefs.

◆ UnionInfo()

CUnionInfo * Puma::CSemDatabase::UnionInfo ( unsigned  n) const
inline

Get the n-th semantic object for unions.

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

◆ UnionInfos()

unsigned Puma::CSemDatabase::UnionInfos ( ) const
inline

Get the number of semantic objects for unions.