46
50
Array<CTemplateInfo*> _Specializations;
55
/** Destructor. Unlinks itself from the specializations
56
* and instances of this template. If the object type
57
* is CObjectInfo::TEMPLATE_INFO, CObjectInfo::CleanUp()
61
/** Remove all links from other semantic objects to
62
* this semantic object. */
52
63
void removeLinks ();
54
bool isFunction () const; // is function template?
55
bool isClass () const; // is class template?
56
bool isAttribute () const; // is definition of static data member?
57
bool isBaseTemplate () const; // is not specialization?
58
bool isSpecialization () const; // is not base template?
65
/** Check if this is a function template definition. */
66
bool isFunction () const;
67
/** Check if this is a class template definition. */
68
bool isClass () const;
69
/** Check if this is the definition of a static
70
* template class date member. */
71
bool isAttribute () const;
72
/** Check if this is a base template and not a
73
* specialization of another template. */
74
bool isBaseTemplate () const;
75
/** Check if this is a specialization of another template. */
76
bool isSpecialization () const;
60
void increaseDepth (); // increase instantiation depth
61
void decreaseDepth (); // decrease instantiation depth
62
unsigned Depth () const; // return instantiation depth
78
/** Increase the instantiation depth (for nested template
80
void increaseDepth ();
81
/** Decrease the instantiation depth (for nested template
83
void decreaseDepth ();
84
/** Get the current instantiation depth (for nested template
86
unsigned Depth () const;
64
CObjectInfo *ObjectInfo () const; // the template definition
88
/** Get the semantic information for the entity. */
89
CObjectInfo *ObjectInfo () const;
90
/** Get the syntax tree node for the template declaration. */
65
91
CT_TemplateDecl *Tree () const;
92
/** Get the base template if this is template specialization. */
66
93
CTemplateInfo *BaseTemplate () const;
94
/** Create a new template parameter.
95
* \param add If \e true, add the created parameter to the template. */
67
96
CTemplateParamInfo *newTemplateParam (bool add = true);
98
/** Get the number of template parameters. */
69
99
unsigned Parameters () const;
70
CTemplateParamInfo *Parameter (unsigned) const;
71
CT_ExprList *DefaultArgument (unsigned) const;
100
/** Get the n-th template parameter.
101
* \param n The index of the template parameter.
102
* \return The template parameter or NULL if \e n is invalid. */
103
CTemplateParamInfo *Parameter (unsigned n) const;
104
/** Get the default argument of the n-th template parameter.
105
* \param n The index of the template parameter.
106
* \return The default argument expression or NULL if
107
* the parameter has no default argument. */
108
CT_ExprList *DefaultArgument (unsigned n) const;
110
/** Get the number of instances of this template. */
73
111
unsigned Instances () const;
74
CObjectInfo *Instance (unsigned);
75
void addInstance (CObjectInfo *);
76
void addPseudoInstance (CObjectInfo *);
77
void removeInstance (const CObjectInfo *);
112
/** Get the n-th instance of this template.
113
* \param n The index of the instance.
114
* \return The template instance or NULL if \e n is invalid. */
115
CObjectInfo *Instance (unsigned n);
116
/** Add the given instance to the template.
117
* \param info The semantic object of the template instance. */
118
void addInstance (CObjectInfo *info);
119
/** Add the given pseudo instance to the template.
120
* \param info The pseudo template instance. */
121
void addPseudoInstance (CObjectInfo *info);
122
/** Remove the given template instance.
123
* \param info The template instance. */
124
void removeInstance (const CObjectInfo *info);
126
/** Get the number of specializations of this template. */
79
127
unsigned Specializations () const;
80
CTemplateInfo *Specialization (unsigned);
81
void addSpecialization (CTemplateInfo *);
82
void removeSpecialization (const CTemplateInfo *);
83
void isSpecialization (bool);
84
void SpecializationName (CT_TemplateName *);
128
/** Get the n-th specialization of this template.
129
* \param n The index of the specialization.
130
* \return The specialization or NULL if \e n is invalid. */
131
CTemplateInfo *Specialization (unsigned n);
132
/** Add the given specialization of the template.
133
* \param info The semantic object of the specialization. */
134
void addSpecialization (CTemplateInfo *info);
135
/** Remove the given specialization of the template.
136
* \param info The template specialization. */
137
void removeSpecialization (const CTemplateInfo *info);
138
/** Set whether this is a specialization of a template.
139
* \param v \e true if this is a specialization. */
140
void isSpecialization (bool v);
141
/** Set the template specialization name (template id).
142
* \param name The template specialization name. */
143
void SpecializationName (CT_TemplateName *name);
144
/** Get the template specialization name.
145
* \return The template specialization name or NULL if not a specialization. */
85
146
CT_TemplateName *SpecializationName () const;
87
void deleteTemplateParam (const CTemplateParamInfo *);
88
void ObjectInfo (CObjectInfo *);
89
void BaseTemplate (CTemplateInfo *);
148
/** Remove and destroy the given template parameter.
149
* \param p The template parameter. */
150
void deleteTemplateParam (const CTemplateParamInfo *p);
151
/** Set the semantic object of the entity (class, function, etc).
152
* \param info The semantic object. */
153
void ObjectInfo (CObjectInfo *info);
154
/** Set the base template if this is a template specialization.
155
* \param info The base template. */
156
void BaseTemplate (CTemplateInfo *info);
91
static bool equalArguments (CTemplateInstance *, CTemplateInstance *);
158
/** Check if the given template instances have the
159
* same instantiation arguments.
160
* \param i1 A template instance.
161
* \param i2 Another template instance. */
162
static bool equalArguments (CTemplateInstance *i1, CTemplateInstance *i2);
94
165
void linkInstance (CObjectInfo *);