~ubuntu-branches/ubuntu/jaunty/aspectc++/jaunty

« back to all changes in this revision

Viewing changes to Puma/gen-release/step1/inc/Puma/CTemplateInfo.h

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2008-07-07 14:41:02 UTC
  • mfrom: (1.1.3 upstream) (6.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080707144102-lzml7t07f3sl00r5
Tags: 1.0pre4~svn.20080711-1
* new upstream snapshot.
* include all upstream documentation. Clarifying emails regarding
  licensing has been included into debian/copyright.
* reformat description following recomendations of
  http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description
  (Closes: #480316)

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#ifndef __CTemplateInfo_h__
20
20
#define __CTemplateInfo_h__
21
21
 
22
 
// class and function template info
23
 
// knows the template parameters and the template definition
24
 
// knows the template instantiations
 
22
/** \file
 
23
 *  Semantic information about a template declaration. */
25
24
 
26
25
#include "Puma/CStructure.h"
27
26
 
33
32
class CT_ExprList;
34
33
class CT_TemplateName;
35
34
 
 
35
 
 
36
/** \class CTemplateInfo CTemplateInfo.h Puma/CTemplateInfo.h
 
37
 *  Semantic information about a template declaration.
 
38
 *  Contains information about the parameters, specializations, 
 
39
 *  and instances of the template. */
36
40
class CTemplateInfo : public CStructure {
37
41
  CObjectInfo *_ObjectInfo;
38
42
  CTemplateInfo *_Base;
46
50
  Array<CTemplateInfo*> _Specializations;
47
51
 
48
52
public: 
 
53
  /** Constructor. */
49
54
  CTemplateInfo ();
 
55
  /** Destructor. Unlinks itself from the specializations
 
56
   *  and instances of this template. If the object type 
 
57
   *  is CObjectInfo::TEMPLATE_INFO, CObjectInfo::CleanUp() 
 
58
   *  is called. */
50
59
  ~CTemplateInfo ();
51
60
  
 
61
  /** Remove all links from other semantic objects to
 
62
   *  this semantic object. */
52
63
  void removeLinks ();
53
64
 
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;
59
77
  
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
 
79
   *  instantiations). */
 
80
  void increaseDepth ();
 
81
  /** Decrease the instantiation depth (for nested template
 
82
   *  instantiations). */
 
83
  void decreaseDepth ();
 
84
  /** Get the current instantiation depth (for nested template
 
85
   *  instantiations). */
 
86
  unsigned Depth () const;
63
87
 
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);
68
97
  
 
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;
72
109
 
 
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);
78
125
  
 
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;
86
147
 
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);
90
157
 
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);
92
163
 
93
164
private:
94
165
  void linkInstance (CObjectInfo *);