Puma Reference Manual | Puma::CTemplateInfo Class Reference |
Semantic information about a template declaration. More...
#include <Puma/CTemplateInfo.h>
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). | |
CObjectInfo * | ObjectInfo () const |
Get the semantic information for the entity. | |
CT_TemplateDecl * | Tree () const |
Get the syntax tree node for the template declaration. | |
CTemplateInfo * | BaseTemplate () const |
Get the base template if this is template specialization. | |
CTemplateParamInfo * | newTemplateParam (bool add=true) |
Create a new template parameter. | |
unsigned | Parameters () const |
Get the number of template parameters. | |
CTemplateParamInfo * | Parameter (unsigned n) const |
Get the n-th template parameter. | |
CTree * | DefaultArgument (unsigned n) const |
Get the default argument of the n-th template parameter. | |
unsigned | Instances () const |
Get the number of instances of this template. | |
CObjectInfo * | Instance (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. | |
CTemplateInfo * | Specialization (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_TemplateName * | SpecializationName () 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. | |
void | addTreeFragment (CTree *fragment) |
Add a tree fragment created during template instantiation. | |
Static Public Member Functions | |
static bool | equalArguments (CTemplateInstance *i1, CTemplateInstance *i2, bool matchTemplateParams=false) |
Check if the given template instances have the same instantiation arguments. | |
static bool | equalParameters (CTemplateInfo *t1, CTemplateInfo *t2) |
Check if the given templates have equals parameters. |
Semantic information about a template declaration.
Contains information about the parameters, specializations, and instances of the template.
Puma::CTemplateInfo::CTemplateInfo | ( | ) | [inline] |
Constructor.
Destructor.
Unlinks itself from the specializations and instances of this template. If the object type is CObjectInfo::TEMPLATE_INFO, CObjectInfo::CleanUp() is called.
void Puma::CTemplateInfo::addInstance | ( | CObjectInfo * | info | ) | [inline] |
Add the given instance to the template.
info | The semantic object of the template instance. |
void Puma::CTemplateInfo::addSpecialization | ( | CTemplateInfo * | info | ) |
Add the given specialization of the template.
info | The semantic object of the specialization. |
void Puma::CTemplateInfo::addTreeFragment | ( | CTree * | fragment | ) |
Add a tree fragment created during template instantiation.
CTemplateInfo * Puma::CTemplateInfo::BaseTemplate | ( | ) | const [inline] |
Get the base template if this is template specialization.
void Puma::CTemplateInfo::BaseTemplate | ( | CTemplateInfo * | info | ) |
Set the base template if this is a template specialization.
info | The base template. |
void Puma::CTemplateInfo::decreaseDepth | ( | ) | [inline] |
Decrease the instantiation depth (for nested template instantiations).
CTree* Puma::CTemplateInfo::DefaultArgument | ( | unsigned | n | ) | const |
Get the default argument of the n-th template parameter.
n | The index of the template parameter. |
void Puma::CTemplateInfo::deleteTemplateParam | ( | const CTemplateParamInfo * | p | ) |
Remove and destroy the given template parameter.
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, | ||
bool | matchTemplateParams = false |
||
) | [static] |
Check if the given template instances have the same instantiation arguments.
i1 | A template instance. |
i2 | Another template instance. |
matchTemplateParams | Template parameter compare mode. |
static bool Puma::CTemplateInfo::equalParameters | ( | CTemplateInfo * | t1, |
CTemplateInfo * | t2 | ||
) | [static] |
Check if the given templates have equals parameters.
t1 | A template. |
t2 | Another template. |
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.
n | The index of the instance. |
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.
bool Puma::CTemplateInfo::isSpecialization | ( | ) | const [inline] |
Check if this is a specialization of another template.
void Puma::CTemplateInfo::isSpecialization | ( | bool | v | ) | [inline] |
Set whether this is a specialization of a template.
v | true if this is a specialization. |
CTemplateParamInfo* Puma::CTemplateInfo::newTemplateParam | ( | bool | add = true | ) |
Create a new template parameter.
add | If true, add the created parameter to the template. |
CObjectInfo * Puma::CTemplateInfo::ObjectInfo | ( | ) | const [inline] |
Get the semantic information for the entity.
Reimplemented from Puma::CObjectInfo.
void Puma::CTemplateInfo::ObjectInfo | ( | CObjectInfo * | info | ) | [inline] |
Set the semantic object of the entity (class, function, etc).
info | The semantic object. |
CTemplateParamInfo * Puma::CTemplateInfo::Parameter | ( | unsigned | n | ) | const [inline] |
Get the n-th template parameter.
n | The index of the template parameter. |
unsigned Puma::CTemplateInfo::Parameters | ( | ) | const [inline] |
Get the number of template parameters.
void Puma::CTemplateInfo::removeInstance | ( | const CObjectInfo * | info | ) |
Remove the given template instance.
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.
info | The template specialization. |
CTemplateInfo * Puma::CTemplateInfo::Specialization | ( | unsigned | n | ) | [inline] |
Get the n-th specialization of this template.
n | The index of the specialization. |
void Puma::CTemplateInfo::SpecializationName | ( | CT_TemplateName * | name | ) | [inline] |
Set the template specialization name (template id).
name | The template specialization name. |
CT_TemplateName * Puma::CTemplateInfo::SpecializationName | ( | ) | const [inline] |
Get 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.