|
1 /****************************************************************************** |
|
2 * |
|
3 * |
|
4 * |
|
5 * Copyright (C) 1997-2008 by Dimitri van Heesch. |
|
6 * |
|
7 * Permission to use, copy, modify, and distribute this software and its |
|
8 * documentation under the terms of the GNU General Public License is hereby |
|
9 * granted. No representations are made about the suitability of this software |
|
10 * for any purpose. It is provided "as is" without express or implied warranty. |
|
11 * See the GNU General Public License for more details. |
|
12 * |
|
13 * Documents produced by Doxygen are derivative works derived from the |
|
14 * input used in their production; they are not affected by this license. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef MEMBERDEF_H |
|
19 #define MEMBERDEF_H |
|
20 |
|
21 #include "qtbc.h" |
|
22 #include <qlist.h> |
|
23 #include <qdict.h> |
|
24 #include <qstack.h> |
|
25 |
|
26 #include "entry.h" |
|
27 #include "definition.h" |
|
28 #include "sortdict.h" |
|
29 |
|
30 class ClassDef; |
|
31 class NamespaceDef; |
|
32 class GroupDef; |
|
33 class FileDef; |
|
34 class MemberList; |
|
35 class MemberGroup; |
|
36 class ExampleSDict; |
|
37 class OutputList; |
|
38 class GroupDef; |
|
39 class QTextStream; |
|
40 class ArgumentList; |
|
41 class MemberDefImpl; |
|
42 |
|
43 struct SourceReference |
|
44 { |
|
45 FileDef *fd; |
|
46 QCString anchor; |
|
47 }; |
|
48 |
|
49 class MemberDef : public Definition |
|
50 { |
|
51 public: |
|
52 |
|
53 enum MemberType { |
|
54 Define, |
|
55 Function, |
|
56 Variable, |
|
57 Typedef, |
|
58 Enumeration, |
|
59 EnumValue, |
|
60 Signal, |
|
61 Slot, |
|
62 Friend, |
|
63 DCOP, |
|
64 Property, |
|
65 Event |
|
66 }; |
|
67 |
|
68 MemberDef(const char *defFileName,int defLine, |
|
69 const char *type,const char *name,const char *args, |
|
70 const char *excp,Protection prot,Specifier virt,bool stat, |
|
71 Relationship related,MemberType t,const ArgumentList *tal, |
|
72 const ArgumentList *al); |
|
73 ~MemberDef(); |
|
74 DefType definitionType() const { return TypeMember; } |
|
75 // move this member into a different scope |
|
76 void moveTo(Definition *); |
|
77 |
|
78 //----------------------------------------------------------------------------------- |
|
79 // ---- getters ----- |
|
80 //----------------------------------------------------------------------------------- |
|
81 |
|
82 // link id |
|
83 QCString getOutputFileBase() const; |
|
84 QCString getReference() const; |
|
85 QCString anchor() const; |
|
86 |
|
87 const char *declaration() const; |
|
88 const char *definition() const; |
|
89 const char *typeString() const; |
|
90 const char *argsString() const; |
|
91 const char *excpString() const; |
|
92 const char *bitfieldString() const; |
|
93 const char *extraTypeChars() const; |
|
94 const QCString &initializer() const; |
|
95 int initializerLines() const; |
|
96 int getMemberSpecifiers() const; |
|
97 MemberList *getSectionList(Definition *d) const; |
|
98 |
|
99 // scope query members |
|
100 ClassDef *getClassDef() const; |
|
101 FileDef *getFileDef() const; |
|
102 NamespaceDef* getNamespaceDef() const; |
|
103 |
|
104 // grabbing the property read/write accessor names |
|
105 const char *getReadAccessor() const; |
|
106 const char *getWriteAccessor() const; |
|
107 |
|
108 // querying the grouping definition |
|
109 GroupDef *getGroupDef() const; |
|
110 Grouping::GroupPri_t getGroupPri() const; |
|
111 const char *getGroupFileName() const; |
|
112 int getGroupStartLine() const; |
|
113 bool getGroupHasDocs() const; |
|
114 QCString qualifiedName() const; |
|
115 QCString objCMethodName(bool localLink,bool showStatic) const; |
|
116 |
|
117 // direct kind info |
|
118 Protection protection() const; |
|
119 Specifier virtualness(int count=0) const; |
|
120 MemberType memberType() const; |
|
121 QCString memberTypeName() const; |
|
122 |
|
123 // getter methods |
|
124 bool isSignal() const; |
|
125 bool isSlot() const; |
|
126 bool isVariable() const; |
|
127 bool isEnumerate() const; |
|
128 bool isEnumValue() const; |
|
129 bool isTypedef() const; |
|
130 bool isFunction() const; |
|
131 bool isDefine() const; |
|
132 bool isFriend() const; |
|
133 bool isDCOP() const; |
|
134 bool isProperty() const; |
|
135 bool isEvent() const; |
|
136 bool isRelated() const; |
|
137 bool isForeign() const; |
|
138 bool isStatic() const; |
|
139 bool isInline() const; |
|
140 bool isExplicit() const; |
|
141 bool isMutable() const; |
|
142 bool isGettable() const; |
|
143 bool isSettable() const; |
|
144 bool isReadable() const; |
|
145 bool isWritable() const; |
|
146 bool isAddable() const; |
|
147 bool isRemovable() const; |
|
148 bool isRaisable() const; |
|
149 bool isFinal() const; |
|
150 bool isAbstract() const; |
|
151 bool isOverride() const; |
|
152 bool isInitonly() const; |
|
153 bool isOptional() const; |
|
154 bool isRequired() const; |
|
155 bool isNonAtomic() const; |
|
156 bool isCopy() const; |
|
157 bool isAssign() const; |
|
158 bool isRetain() const; |
|
159 bool isNew() const; |
|
160 bool isSealed() const; |
|
161 bool isImplementation() const; |
|
162 bool isExternal() const; |
|
163 bool isTemplateSpecialization() const; |
|
164 bool hasDocumentedParams() const; |
|
165 bool hasDocumentedReturnType() const; |
|
166 bool isObjCMethod() const; |
|
167 bool isObjCProperty() const; |
|
168 bool isConstructor() const; |
|
169 bool isDestructor() const; |
|
170 bool hasOneLineInitializer() const; |
|
171 bool hasMultiLineInitializer() const; |
|
172 bool protectionVisible() const; |
|
173 |
|
174 // output info |
|
175 bool isLinkableInProject() const; |
|
176 bool isLinkable() const; |
|
177 bool hasDocumentation() const; // overrides hasDocumentation in definition.h |
|
178 //bool hasUserDocumentation() const; // overrides hasUserDocumentation |
|
179 bool isBriefSectionVisible() const; |
|
180 bool isDetailedSectionVisible(bool inGroup,bool inFile) const; |
|
181 bool isDetailedSectionLinkable() const; |
|
182 bool isFriendClass() const; |
|
183 bool isDocumentedFriendClass() const; |
|
184 |
|
185 MemberDef *reimplements() const; |
|
186 LockingPtr<MemberList> reimplementedBy() const; |
|
187 |
|
188 //int inbodyLine() const; |
|
189 //QCString inbodyFile() const; |
|
190 //const QCString &inbodyDocumentation() const; |
|
191 |
|
192 ClassDef *relatedAlso() const; |
|
193 |
|
194 bool hasDocumentedEnumValues() const; |
|
195 MemberDef *getAnonymousEnumType() const; |
|
196 bool isDocsForDefinition() const; |
|
197 MemberDef *getEnumScope() const; |
|
198 LockingPtr<MemberList> enumFieldList() const; |
|
199 |
|
200 bool hasExamples(); |
|
201 LockingPtr<ExampleSDict> getExamples() const; |
|
202 bool isPrototype() const; |
|
203 |
|
204 // argument related members |
|
205 LockingPtr<ArgumentList> argumentList() const; |
|
206 LockingPtr<ArgumentList> declArgumentList() const; |
|
207 LockingPtr<ArgumentList> templateArguments() const; |
|
208 LockingPtr< QList<ArgumentList> > definitionTemplateParameterLists() const; |
|
209 |
|
210 // member group related members |
|
211 int getMemberGroupId() const; |
|
212 MemberGroup *getMemberGroup() const; |
|
213 |
|
214 bool fromAnonymousScope() const; |
|
215 bool anonymousDeclShown() const; |
|
216 |
|
217 // callgraph related members |
|
218 bool hasCallGraph() const; |
|
219 bool hasCallerGraph() const; |
|
220 bool visibleMemberGroup(bool hideNoHeader); |
|
221 |
|
222 MemberDef *templateMaster() const; |
|
223 QCString getScopeString() const; |
|
224 ClassDef *getClassDefOfAnonymousType(); |
|
225 |
|
226 // cached typedef functions |
|
227 bool isTypedefValCached() const; |
|
228 ClassDef *getCachedTypedefVal() const; |
|
229 QCString getCachedTypedefTemplSpec() const; |
|
230 QCString getCachedResolvedTypedef() const; |
|
231 |
|
232 MemberDef *memberDefinition() const; |
|
233 MemberDef *memberDeclaration() const; |
|
234 MemberDef *inheritsDocsFrom() const; |
|
235 MemberDef *getGroupAlias() const; |
|
236 |
|
237 ClassDef *category() const; |
|
238 |
|
239 //----------------------------------------------------------------------------------- |
|
240 // ---- setters ----- |
|
241 //----------------------------------------------------------------------------------- |
|
242 |
|
243 // set functions |
|
244 void setMemberType(MemberType t); |
|
245 void setDefinition(const char *d); |
|
246 void setFileDef(FileDef *fd); |
|
247 void setAnchor(const char *a); |
|
248 void setProtection(Protection p); |
|
249 void setMemberSpecifiers(int s); |
|
250 void mergeMemberSpecifiers(int s); |
|
251 void setInitializer(const char *i); |
|
252 void setBitfields(const char *s); |
|
253 void setMaxInitLines(int lines); |
|
254 void setMemberClass(ClassDef *cd); |
|
255 void setSectionList(Definition *d,MemberList *sl); |
|
256 void setGroupDef(GroupDef *gd,Grouping::GroupPri_t pri, |
|
257 const QCString &fileName,int startLine,bool hasDocs, |
|
258 MemberDef *member=0); |
|
259 void setExplicitExternal(bool b); |
|
260 void setReadAccessor(const char *r); |
|
261 void setWriteAccessor(const char *w); |
|
262 void setTemplateSpecialization(bool b); |
|
263 |
|
264 void makeRelated(); |
|
265 void makeForeign(); |
|
266 void setHasDocumentedParams(bool b); |
|
267 void setHasDocumentedReturnType(bool b); |
|
268 void setInheritsDocsFrom(MemberDef *md); |
|
269 void setTagInfo(TagInfo *i); |
|
270 void setArgsString(const char *as); |
|
271 |
|
272 // relation to other members |
|
273 void setReimplements(MemberDef *md); |
|
274 void insertReimplementedBy(MemberDef *md); |
|
275 |
|
276 // in-body documentation |
|
277 //void setInbodyDocumentation(const char *docs,const char *file,int line); |
|
278 |
|
279 void setRelatedAlso(ClassDef *cd); |
|
280 |
|
281 // enumeration specific members |
|
282 void insertEnumField(MemberDef *md); |
|
283 void setEnumScope(MemberDef *md); |
|
284 void setEnumClassScope(ClassDef *cd); |
|
285 void setDocumentedEnumValues(bool value); |
|
286 void setAnonymousEnumType(MemberDef *md); |
|
287 |
|
288 // example related members |
|
289 bool addExample(const char *anchor,const char *name,const char *file); |
|
290 |
|
291 // prototype related members |
|
292 void setPrototype(bool p); |
|
293 |
|
294 // argument related members |
|
295 void setArgumentList(ArgumentList *al); |
|
296 void setDeclArgumentList(ArgumentList *al); |
|
297 void setDefinitionTemplateParameterLists(QList<ArgumentList> *lists); |
|
298 void setTypeConstraints(ArgumentList *al); |
|
299 |
|
300 // namespace related members |
|
301 void setNamespace(NamespaceDef *nd); |
|
302 |
|
303 // member group related members |
|
304 void setMemberGroup(MemberGroup *grp); |
|
305 void setMemberGroupId(int id); |
|
306 void makeImplementationDetail(); |
|
307 |
|
308 // anonymous scope members |
|
309 void setFromAnonymousScope(bool b); |
|
310 void setFromAnonymousMember(MemberDef *m); |
|
311 |
|
312 void enableCallGraph(bool e); |
|
313 void enableCallerGraph(bool e); |
|
314 |
|
315 void setTemplateMaster(MemberDef *mt); |
|
316 void addListReference(Definition *d); |
|
317 void setDocsForDefinition(bool b); |
|
318 void setGroupAlias(MemberDef *md); |
|
319 |
|
320 void cacheTypedefVal(ClassDef *val,const QCString &templSpec,const QCString &resolvedType); |
|
321 void invalidateTypedefValCache(); |
|
322 |
|
323 void invalidateCachedArgumentTypes(); |
|
324 |
|
325 // declaration <-> definition relation |
|
326 void setMemberDefinition(MemberDef *md); |
|
327 void setMemberDeclaration(MemberDef *md); |
|
328 |
|
329 void setAnonymousUsed(); |
|
330 void copyArgumentNames(MemberDef *bmd); |
|
331 |
|
332 void setCategory(ClassDef *); |
|
333 |
|
334 //----------------------------------------------------------------------------------- |
|
335 // --- actions ---- |
|
336 //----------------------------------------------------------------------------------- |
|
337 |
|
338 // output generation |
|
339 void writeDeclaration(OutputList &ol, |
|
340 ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd, |
|
341 bool inGroup); |
|
342 void writeDocumentation(MemberList *ml,OutputList &ol, |
|
343 const char *scopeName,Definition *container, |
|
344 bool inGroup,bool showEnumValues=FALSE); |
|
345 void warnIfUndocumented(); |
|
346 |
|
347 MemberDef *createTemplateInstanceMember(ArgumentList *formalArgs, |
|
348 ArgumentList *actualArgs); |
|
349 |
|
350 void writeEnumDeclaration(OutputList &typeDecl, |
|
351 ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd); |
|
352 |
|
353 void findSectionsInDocumentation(); |
|
354 |
|
355 bool visited; |
|
356 |
|
357 protected: |
|
358 void flushToDisk() const; |
|
359 void loadFromDisk() const; |
|
360 private: |
|
361 void lock() const; |
|
362 void unlock() const; |
|
363 void saveToDisk() const; |
|
364 void makeResident() const; |
|
365 |
|
366 static int s_indentLevel; |
|
367 // disable copying of member defs |
|
368 MemberDef(const MemberDef &); |
|
369 MemberDef &operator=(const MemberDef &); |
|
370 |
|
371 void writeLink(OutputList &ol, |
|
372 ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd, |
|
373 bool onlyText=FALSE); |
|
374 |
|
375 MemberDefImpl *m_impl; |
|
376 int m_cacheHandle; |
|
377 off_t m_storagePos; // location where the item is stored in file (if impl==0) |
|
378 bool m_flushPending; |
|
379 }; |
|
380 |
|
381 #endif |