Puma Reference Manual Puma: Puma::CTemplateInfo Class Reference



Puma::CTemplateInfo Class Reference

Semantic information about a template declaration. More...

#include <Puma/CTemplateInfo.h>

Inherits Puma::CStructure.

List of all members.

Public Member Functions

 CTemplateInfo ()
 Constructor.
 ~CTemplateInfo ()
 Destructor.
void removeLinks ()
 Remove all links from other semantic objects to this semantic object.
bool isFunction () const
 Check if this is a function template definition.
bool isClass () const
 Check if this is a class template definition.
bool isAttribute () const
 Check if this is the definition of a static template class date member.
bool isBaseTemplate () const
 Check if this is a base template and not a specialization of another template.
bool isSpecialization () const
 Check if this is a specialization of another template.
void increaseDepth ()
 Increase the instantiation depth (for nested template instantiations).
void decreaseDepth ()
 Decrease the instantiation depth (for nested template instantiations).
unsigned Depth () const
 Get the current instantiation depth (for nested template instantiations).
CObjectInfoObjectInfo () const
 Get the semantic information for the entity.
CT_TemplateDeclTree () const
 Get the syntax tree node for the template declaration.
CTemplateInfoBaseTemplate () const
 Get the base template if this is template specialization.
CTemplateParamInfonewTemplateParam (bool add=true)
 Create a new template parameter.
unsigned Parameters () const
 Get the number of template parameters.
CTemplateParamInfoParameter (unsigned n) const
 Get the n-th template parameter.
CT_ExprListDefaultArgument (unsigned n) const
 Get the default argument of the n-th template parameter.
unsigned Instances () const
 Get the number of instances of this template.
CObjectInfoInstance (unsigned n)
 Get the n-th instance of this template.
void addInstance (CObjectInfo *info)
 Add the given instance to the template.
void removeInstance (const CObjectInfo *info)
 Remove the given template instance.
unsigned Specializations () const
 Get the number of specializations of this template.
CTemplateInfoSpecialization (unsigned n)
 Get the n-th specialization of this template.
void addSpecialization (CTemplateInfo *info)
 Add the given specialization of the template.
void removeSpecialization (const CTemplateInfo *info)
 Remove the given specialization of the template.
void isSpecialization (bool v)
 Set whether this is a specialization of a template.
void SpecializationName (CT_TemplateName *name)
 Set the template specialization name (template id).
CT_TemplateNameSpecializationName () const
 Get the template specialization name.
void deleteTemplateParam (const CTemplateParamInfo *p)
 Remove and destroy the given template parameter.
void ObjectInfo (CObjectInfo *info)
 Set the semantic object of the entity (class, function, etc).
void BaseTemplate (CTemplateInfo *info)
 Set the base template if this is a template specialization.

Static Public Member Functions

static bool equalArguments (CTemplateInstance *i1, CTemplateInstance *i2)
 Check if the given template instances have the same instantiation arguments.

Detailed Description

Semantic information about a template declaration.

Contains information about the parameters, specializations, and instances of the template.


Constructor & Destructor Documentation

Puma::CTemplateInfo::CTemplateInfo (  )  [inline]

Constructor.

Puma::CTemplateInfo::~CTemplateInfo (  ) 

Destructor.

Unlinks itself from the specializations and instances of this template. If the object type is CObjectInfo::TEMPLATE_INFO, CObjectInfo::CleanUp() is called.


Member Function Documentation

void Puma::CTemplateInfo::addInstance ( CObjectInfo info  )  [inline]

Add the given instance to the template.

Parameters:
info The semantic object of the template instance.
void Puma::CTemplateInfo::addSpecialization ( CTemplateInfo info  ) 

Add the given specialization of the template.

Parameters:
info The semantic object of the specialization.
void Puma::CTemplateInfo::BaseTemplate ( CTemplateInfo info  ) 

Set the base template if this is a template specialization.

Parameters:
info The base template.
CTemplateInfo * Puma::CTemplateInfo::BaseTemplate (  )  const [inline]

Get the base template if this is template specialization.

void Puma::CTemplateInfo::decreaseDepth (  )  [inline]

Decrease the instantiation depth (for nested template instantiations).

CT_ExprList* Puma::CTemplateInfo::DefaultArgument ( unsigned  n  )  const

Get the default argument of the n-th template parameter.

Parameters:
n The index of the template parameter.
Returns:
The default argument expression or NULL if the parameter has no default argument.
void Puma::CTemplateInfo::deleteTemplateParam ( const CTemplateParamInfo p  ) 

Remove and destroy the given template parameter.

Parameters:
p The template parameter.
unsigned Puma::CTemplateInfo::Depth (  )  const [inline]

Get the current instantiation depth (for nested template instantiations).

static bool Puma::CTemplateInfo::equalArguments ( CTemplateInstance i1,
CTemplateInstance i2 
) [static]

Check if the given template instances have the same instantiation arguments.

Parameters:
i1 A template instance.
i2 Another template instance.
void Puma::CTemplateInfo::increaseDepth (  )  [inline]

Increase the instantiation depth (for nested template instantiations).

CObjectInfo * Puma::CTemplateInfo::Instance ( unsigned  n  )  [inline]

Get the n-th instance of this template.

Parameters:
n The index of the instance.
Returns:
The template instance or NULL if n is invalid.
unsigned Puma::CTemplateInfo::Instances (  )  const [inline]

Get the number of instances of this template.

bool Puma::CTemplateInfo::isAttribute (  )  const [inline]

Check if this is the definition of a static template class date member.

bool Puma::CTemplateInfo::isBaseTemplate (  )  const [inline]

Check if this is a base template and not a specialization of another template.

bool Puma::CTemplateInfo::isClass (  )  const [inline]

Check if this is a class template definition.

Reimplemented from Puma::CScopeInfo.

bool Puma::CTemplateInfo::isFunction (  )  const [inline]

Check if this is a function template definition.

Reimplemented from Puma::CScopeInfo.

void Puma::CTemplateInfo::isSpecialization ( bool  v  )  [inline]

Set whether this is a specialization of a template.

Parameters:
v true if this is a specialization.
bool Puma::CTemplateInfo::isSpecialization (  )  const [inline]

Check if this is a specialization of another template.

CTemplateParamInfo* Puma::CTemplateInfo::newTemplateParam ( bool  add = true  ) 

Create a new template parameter.

Parameters:
add If true, add the created parameter to the template.
void Puma::CTemplateInfo::ObjectInfo ( CObjectInfo info  )  [inline]

Set the semantic object of the entity (class, function, etc).

Parameters:
info The semantic object.
CObjectInfo * Puma::CTemplateInfo::ObjectInfo (  )  const [inline]

Get the semantic information for the entity.

Reimplemented from Puma::CObjectInfo.

CTemplateParamInfo * Puma::CTemplateInfo::Parameter ( unsigned  n  )  const [inline]

Get the n-th template parameter.

Parameters:
n The index of the template parameter.
Returns:
The template parameter or NULL if n is invalid.
unsigned Puma::CTemplateInfo::Parameters (  )  const [inline]

Get the number of template parameters.

void Puma::CTemplateInfo::removeInstance ( const CObjectInfo info  ) 

Remove the given template instance.

Parameters:
info The template instance.
void Puma::CTemplateInfo::removeLinks (  ) 

Remove all links from other semantic objects to this semantic object.

void Puma::CTemplateInfo::removeSpecialization ( const CTemplateInfo info  ) 

Remove the given specialization of the template.

Parameters:
info The template specialization.
CTemplateInfo * Puma::CTemplateInfo::Specialization ( unsigned  n  )  [inline]

Get the n-th specialization of this template.

Parameters:
n The index of the specialization.
Returns:
The specialization or NULL if n is invalid.
CT_TemplateName * Puma::CTemplateInfo::SpecializationName (  )  const [inline]

Get the template specialization name.

Returns:
The template specialization name or NULL if not a specialization.
void Puma::CTemplateInfo::SpecializationName ( CT_TemplateName name  )  [inline]

Set the template specialization name (template id).

Parameters:
name The template specialization name.
unsigned Puma::CTemplateInfo::Specializations (  )  const [inline]

Get the number of specializations of this template.

CT_TemplateDecl * Puma::CTemplateInfo::Tree (  )  const [inline]

Get the syntax tree node for the template declaration.

Reimplemented from Puma::CObjectInfo.




Puma Reference Manual. Created on 18 Sep 2009.