86
CStructure (ObjectId);
87
* \param id The object type. */
88
CStructure (ObjectId id);
95
/** Get the entity name to semantic object map. */
93
96
ObjectsByName& ObjectInfoMap() { return _Shared->_ObjectMap; }
97
/** Get the entity name to semantic object map. */
94
98
const ObjectInfoSet& ObjectInfos() const { return _Shared->_ObjectSet; }
96
unsigned Objects () const; // all entities in scope
97
unsigned Objects (const DString&) const;
98
unsigned Types () const; // type declarations
99
unsigned Types (const DString&) const;
100
unsigned Attributes () const; // data objects
101
unsigned Attributes (const DString&) const;
102
unsigned TemplateParams () const; // template parameters
103
unsigned TemplateParams (const DString&) const;
104
unsigned Functions () const; // functions, methods, function
105
unsigned Functions (const DString&) const; // templates and its instances
106
unsigned Usings () const; // using-directives
107
unsigned Usings (const DString&) const;
108
unsigned Namespaces () const; // namespaces
109
unsigned Namespaces (const DString&) const;
110
unsigned Friends () const; // friend function declarations
111
unsigned Friends (const DString&) const;
112
CObjectInfo *Object (unsigned) const;
113
CObjectInfo *Object (const DString&, unsigned = 0) const;
114
CObjectInfo *Type (unsigned) const;
115
CObjectInfo *Type (const DString&, unsigned = 0) const;
116
CUsingInfo *Using (unsigned) const;
117
CUsingInfo *Using (const DString&, unsigned = 0) const;
118
CNamespaceInfo *Namespace (unsigned) const;
119
CNamespaceInfo *Namespace (const DString&, unsigned = 0) const;
120
CRecord *Friend (unsigned) const;
121
CRecord *Friend (const DString&, unsigned = 0) const;
122
CAttributeInfo *Attribute (unsigned) const;
123
CAttributeInfo *Attribute (const DString&, unsigned = 0) const;
124
CTemplateParamInfo *TemplateParam (unsigned) const;
125
CTemplateParamInfo *TemplateParam (const DString&, unsigned = 0) const;
126
CFunctionInfo *Function (unsigned) const;
127
CFunctionInfo *Function (const DString&, unsigned = 0) const;
128
CFunctionInfo *Function (const DString&, CTypeInfo *) const;
130
bool isMemberAlias (const CObjectInfo *) const; // is a member alias info?
131
CMemberAliasInfo *MemberAlias (const CObjectInfo *) const; // get denoted member
134
void setShared (CStructure *);
135
void addObject (CObjectInfo *);
136
void addAttribute (CAttributeInfo *);
137
void addTemplateParam (CTemplateParamInfo *);
138
void addFunction (CFunctionInfo *);
139
void addType (CObjectInfo *);
140
void addUsing (CUsingInfo *);
141
void addNamespace (CNamespaceInfo *);
142
void addFriend (CRecord *);
143
void removeObject (const CObjectInfo *); // WILL NOT BE DESTROYED!
144
void removeAttribute (const CAttributeInfo *); // WILL NOT BE DESTROYED!
145
void removeTemplateParam (const CTemplateParamInfo *); // WILL NOT BE DESTROYED!
146
void removeFunction (const CFunctionInfo *); // WILL NOT BE DESTROYED!
147
void removeType (const CObjectInfo *); // WILL NOT BE DESTROYED!
148
void removeUsing (const CUsingInfo *); // WILL NOT BE DESTROYED!
149
void removeNamespace (const CNamespaceInfo *); // WILL NOT BE DESTROYED!
150
void removeFriend (const CRecord *); // WILL NOT BE DESTROYED!
151
void removeMemberAlias (const CMemberAliasInfo *); // WILL NOT BE DESTROYED!
101
/** Get the number of contained semantic objects. */
102
unsigned Objects () const;
103
/** Get the number of contained semantic objects for
104
* entities with the given name.
105
* \param name The name of the entity. */
106
unsigned Objects (const DString& name) const;
107
/** Get the number of contained semantic objects for
108
* type declarations. */
109
unsigned Types () const;
110
/** Get the number of contained semantic objects for
111
* declarations of types with the given name.
112
* \param name The name of the type. */
113
unsigned Types (const DString& name) const;
114
/** Get the number of contained semantic objects for
115
* object declarations. */
116
unsigned Attributes () const;
117
/** Get the number of contained semantic objects for
118
* declarations of objects with the given name.
119
* \param name The name of the object. */
120
unsigned Attributes (const DString& name) const;
121
/** Get the number of contained semantic objects for
122
* template parameter declarations. */
123
unsigned TemplateParams () const;
124
/** Get the number of contained semantic objects for
125
* declarations of template parameters with the given name.
126
* \param name The name of the template parameter. */
127
unsigned TemplateParams (const DString& name) const;
128
/** Get the number of contained semantic objects for
129
* function declarations. */
130
unsigned Functions () const;
131
/** Get the number of contained semantic objects for
132
* declarations of functions with the given name.
133
* \param name The name of the function. */
134
unsigned Functions (const DString& name) const;
135
/** Get the number of contained semantic objects for
137
unsigned Usings () const;
138
/** Get the number of contained semantic objects for
139
* used members with the given name.
140
* \param name The name of the member. */
141
unsigned Usings (const DString& name) const;
142
/** Get the number of contained semantic objects for
143
* namespace declarations. */
144
unsigned Namespaces () const;
145
/** Get the number of contained semantic objects for
146
* declarations of namespaces with the given name.
147
* \param name The name of the namespace. */
148
unsigned Namespaces (const DString& name) const;
149
/** Get the number of contained semantic objects for
150
* friend declarations. */
151
unsigned Friends () const;
152
/** Get the number of contained semantic objects for
153
* declarations of friends with the given name.
154
* \param name The name of the friend. */
155
unsigned Friends (const DString& name) const;
157
/** Get the n-th contained semantic object.
158
* \param n The index of the semantic object. */
159
CObjectInfo *Object (unsigned n) const;
160
/** Get the n-th contained semantic object for
161
* entities with the given name.
162
* \param name The name of the entity.
163
* \param n Optional index of the semantic object (defaults to 0). */
164
CObjectInfo *Object (const DString& name, unsigned n = 0) const;
165
/** Get the n-th contained semantic object for a type.
166
* \param n The index of the semantic object. */
167
CObjectInfo *Type (unsigned n) const;
168
/** Get the n-th contained semantic object for
169
* types with the given name.
170
* \param name The name of the type.
171
* \param n Optional index of the semantic object (defaults to 0). */
172
CObjectInfo *Type (const DString& name, unsigned n = 0) const;
173
/** Get the n-th contained semantic object for a using-directive.
174
* \param n The index of the semantic object. */
175
CUsingInfo *Using (unsigned n) const;
176
/** Get the n-th contained semantic object for
177
* used members with the given name.
178
* \param name The name of the member.
179
* \param n Optional index of the semantic object (defaults to 0). */
180
CUsingInfo *Using (const DString& name, unsigned n = 0) const;
181
/** Get the n-th contained semantic object for a namespace.
182
* \param n The index of the semantic object. */
183
CNamespaceInfo *Namespace (unsigned n) const;
184
/** Get the n-th contained semantic object for
185
* namespaces with the given name.
186
* \param name The name of the namespace.
187
* \param n Optional index of the semantic object (defaults to 0). */
188
CNamespaceInfo *Namespace (const DString& name, unsigned n = 0) const;
189
/** Get the n-th contained semantic object for a friend.
190
* \param n The index of the semantic object. */
191
CRecord *Friend (unsigned n) const;
192
/** Get the n-th contained semantic object for
193
* friends with the given name.
194
* \param name The name of the friend.
195
* \param n Optional index of the semantic object (defaults to 0). */
196
CRecord *Friend (const DString& name, unsigned n = 0) const;
197
/** Get the n-th contained semantic object for an object.
198
* \param n The index of the semantic object. */
199
CAttributeInfo *Attribute (unsigned n) const;
200
/** Get the n-th contained semantic object for
201
* objects with the given name.
202
* \param name The name of the object.
203
* \param n Optional index of the semantic object (defaults to 0). */
204
CAttributeInfo *Attribute (const DString& name, unsigned n = 0) const;
205
/** Get the n-th contained semantic object for a template parameter.
206
* \param n The index of the semantic object. */
207
CTemplateParamInfo *TemplateParam (unsigned n) const;
208
/** Get the n-th contained semantic object for
209
* template parameters with the given name.
210
* \param name The name of the template parameter.
211
* \param n Optional index of the semantic object (defaults to 0). */
212
CTemplateParamInfo *TemplateParam (const DString& name, unsigned n = 0) const;
213
/** Get the n-th contained semantic object for a function.
214
* \param n The index of the semantic object. */
215
CFunctionInfo *Function (unsigned n) const;
216
/** Get the n-th contained semantic object for
217
* functions with the given name.
218
* \param name The name of the function.
219
* \param n Optional index of the semantic object (defaults to 0). */
220
CFunctionInfo *Function (const DString& name, unsigned n = 0) const;
221
/** Get the contained semantic object for functions with the
222
* given name and type.
223
* \param name The name of the function.
224
* \param type The type of the function. */
225
CFunctionInfo *Function (const DString& name, CTypeInfo *type) const;
227
/** Check if an alias exists for the given entity in this scope.
228
* \param info The semantic object of the entity. */
229
bool isMemberAlias (const CObjectInfo *info) const;
230
/** Get the member alias information for the aliased entity.
231
* \param info The semantic object of the entity. */
232
CMemberAliasInfo *MemberAlias (const CObjectInfo *info) const;
234
/** Set a common data object for the linked semantic objects.
235
* \param share The common data object. */
236
void setShared (CStructure *share);
238
/** Add a semantic object.
239
* \param info The semantic object. */
240
void addObject (CObjectInfo *info);
241
/** Add a semantic object for an object.
242
* \param info The semantic object. */
243
void addAttribute (CAttributeInfo *info);
244
/** Add a semantic object for a template parameter.
245
* \param info The semantic object. */
246
void addTemplateParam (CTemplateParamInfo *info);
247
/** Add a semantic object for a function.
248
* \param info The semantic object. */
249
void addFunction (CFunctionInfo *info);
250
/** Add a semantic object for a type.
251
* \param info The semantic object. */
252
void addType (CObjectInfo *info);
253
/** Add a semantic object for a using-directive.
254
* \param info The semantic object. */
255
void addUsing (CUsingInfo *info);
256
/** Add a semantic object for a namespace.
257
* \param info The semantic object. */
258
void addNamespace (CNamespaceInfo *info);
259
/** Add a semantic object for a friend.
260
* \param info The semantic object. */
261
void addFriend (CRecord *info);
263
/** Remove the semantic object.
264
* \param info The semantic object. */
265
void removeObject (const CObjectInfo *info);
266
/** Remove the semantic object for an object.
267
* \param info The semantic object. */
268
void removeAttribute (const CAttributeInfo *info);
269
/** Remove the semantic object for a template parameter.
270
* \param info The semantic object. */
271
void removeTemplateParam (const CTemplateParamInfo *info);
272
/** Remove the semantic object for a function.
273
* \param info The semantic object. */
274
void removeFunction (const CFunctionInfo *info);
275
/** Remove the semantic object for a type.
276
* \param info The semantic object. */
277
void removeType (const CObjectInfo *info);
278
/** Remove the semantic object for a using-directive.
279
* \param info The semantic object. */
280
void removeUsing (const CUsingInfo *info);
281
/** Remove the semantic object for a namespace.
282
* \param info The semantic object. */
283
void removeNamespace (const CNamespaceInfo *info);
284
/** Remove the semantic object for a friend.
285
* \param info The semantic object. */
286
void removeFriend (const CRecord *info);
287
/** Remove the semantic object for a member alias.
288
* \param info The semantic object. */
289
void removeMemberAlias (const CMemberAliasInfo *info);
291
/** Unregister this semantic object at all contained
292
* semantic objects. */
153
293
void removeRegisterEntry ();
155
void addObjectName(CObjectInfo *); // internal use only, do not call directly
156
void removeObjectName (const DString& name, CObjectInfo *info) ; // internal use only
295
/** Add a semantic object to the name map.
296
* \warning For internal use only!
297
* \param info The semantic object. */
298
void addObjectName(CObjectInfo* info);
299
/** Remove the given semantic object for the entity
300
* with the given name from the name map.
301
* \warning For internal use only!
302
* \param name The name of the entity.
303
* \param info The semantic object. */
304
void removeObjectName (const DString& name, CObjectInfo* info);
306
/** Create a new semantic object for an object declaration. */
159
307
CAttributeInfo *newAttribute ();
308
/** Create a new semantic object for an enumeration. */
160
309
CEnumInfo *newEnum ();
310
/** Create a new semantic object for a using-directive. */
161
311
CUsingInfo *newUsing ();
312
/** Create a new semantic object for a typedef. */
162
313
CTypedefInfo *newTypedef ();
163
CMemberAliasInfo *newMemberAlias (CObjectInfo *);
164
void deleteAttribute (const CAttributeInfo *);
165
void deleteEnum (const CEnumInfo *);
166
void deleteUsing (const CUsingInfo *);
167
void deleteTypedef (const CTypedefInfo *);
168
void deleteMemberAlias (const CMemberAliasInfo *);
314
/** Create a new semantic object for a member alias.
315
* \param member The aliased member. */
316
CMemberAliasInfo *newMemberAlias (CObjectInfo *member);
318
/** Remove and destroy the given semantic object for an object.
319
* \param info The semantic object. */
320
void deleteAttribute (const CAttributeInfo *info);
321
/** Remove and destroy the given semantic object for an enumeration.
322
* \param info The semantic object. */
323
void deleteEnum (const CEnumInfo *info);
324
/** Remove and destroy the given semantic object for a using-directive.
325
* \param info The semantic object. */
326
void deleteUsing (const CUsingInfo *info);
327
/** Remove and destroy the given semantic object for a typedef.
328
* \param info The semantic object. */
329
void deleteTypedef (const CTypedefInfo *info);
330
/** Remove and destroy the given semantic object for a member alias.
331
* \param info The semantic object. */
332
void deleteMemberAlias (const CMemberAliasInfo *info);
171
335
#define INIT_SIZE 20