My Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
memberdef.h
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  *
4  *
5  * Copyright (C) 1997-2015 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 <qlist.h>
22 #include <sys/types.h>
23 
24 #include "types.h"
25 #include "definition.h"
26 
27 class ClassDef;
28 class NamespaceDef;
29 class GroupDef;
30 class FileDef;
31 class MemberList;
32 class MemberGroup;
33 class ExampleSDict;
34 class OutputList;
35 class GroupDef;
36 class QTextStream;
37 class ArgumentList;
38 class MemberDefImpl;
39 class QStrList;
40 struct TagInfo;
41 
43 class MemberDef : public Definition
44 {
45  public:
46 
47  MemberDef(const char *defFileName,int defLine,int defColumn,
48  const char *type,const char *name,const char *args,
49  const char *excp,Protection prot,Specifier virt,bool stat,
50  Relationship related,MemberType t,const ArgumentList *tal,
51  const ArgumentList *al);
52  ~MemberDef();
53  DefType definitionType() const { return TypeMember; }
54  // move this member into a different scope
55  MemberDef *deepCopy() const;
56  void moveTo(Definition *);
57 
58  //-----------------------------------------------------------------------------------
59  // ---- getters -----
60  //-----------------------------------------------------------------------------------
61 
62  // link id
63  QCString getOutputFileBase() const;
64  QCString getReference() const;
65  QCString anchor() const;
66 
67  const char *declaration() const;
68  const char *definition() const;
69  const char *typeString() const;
70  const char *argsString() const;
71  const char *excpString() const;
72  const char *bitfieldString() const;
73  const char *extraTypeChars() const;
74  const QCString &initializer() const;
75  int initializerLines() const;
76  uint64 getMemberSpecifiers() const;
78  QCString displayDefinition() const;
79 
80  // scope query members
81  ClassDef *getClassDef() const;
82  FileDef *getFileDef() const;
84  ClassDef *accessorClass() const;
85 
86  // grabbing the property read/write accessor names
87  const char *getReadAccessor() const;
88  const char *getWriteAccessor() const;
89 
90  // querying the grouping definition
91  GroupDef *getGroupDef() const;
93  const char *getGroupFileName() const;
94  int getGroupStartLine() const;
95  bool getGroupHasDocs() const;
96  QCString qualifiedName() const;
97  QCString objCMethodName(bool localLink,bool showStatic) const;
98 
99  // direct kind info
100  Protection protection() const;
101  Specifier virtualness(int count=0) const;
102  MemberType memberType() const;
103  QCString memberTypeName() const;
104 
105  // getter methods
106  bool isSignal() const;
107  bool isSlot() const;
108  bool isVariable() const;
109  bool isEnumerate() const;
110  bool isEnumValue() const;
111  bool isTypedef() const;
112  bool isFunction() const;
113  bool isFunctionPtr() const;
114  bool isDefine() const;
115  bool isFriend() const;
116  bool isDCOP() const;
117  bool isProperty() const;
118  bool isEvent() const;
119  bool isRelated() const;
120  bool isForeign() const;
121  bool isStatic() const;
122  bool isInline() const;
123  bool isExplicit() const;
124  bool isMutable() const;
125  bool isGettable() const;
126  bool isPrivateGettable() const;
127  bool isProtectedGettable() const;
128  bool isSettable() const;
129  bool isPrivateSettable() const;
130  bool isProtectedSettable() const;
131  bool isReadable() const;
132  bool isWritable() const;
133  bool isAddable() const;
134  bool isRemovable() const;
135  bool isRaisable() const;
136  bool isFinal() const;
137  bool isAbstract() const;
138  bool isOverride() const;
139  bool isInitonly() const;
140  bool isOptional() const;
141  bool isRequired() const;
142  bool isNonAtomic() const;
143  bool isCopy() const;
144  bool isAssign() const;
145  bool isRetain() const;
146  bool isWeak() const;
147  bool isStrong() const;
148  bool isUnretained() const;
149  bool isNew() const;
150  bool isSealed() const;
151  bool isImplementation() const;
152  bool isExternal() const;
153  bool isAlias() const;
154  bool isDefault() const;
155  bool isDelete() const;
156  bool isNoExcept() const;
157  bool isAttribute() const; // UNO IDL attribute
158  bool isUNOProperty() const; // UNO IDL property
159  bool isReadonly() const;
160  bool isBound() const;
161  bool isConstrained() const;
162  bool isTransient() const;
163  bool isMaybeVoid() const;
164  bool isMaybeDefault() const;
165  bool isMaybeAmbiguous() const;
166  bool isPublished() const; // UNO IDL published
167  bool isTemplateSpecialization() const;
168  bool hasDocumentedParams() const;
169  bool hasDocumentedReturnType() const;
170  bool isObjCMethod() const;
171  bool isObjCProperty() const;
172  bool isConstructor() const;
173  bool isDestructor() const;
174  bool hasOneLineInitializer() const;
175  bool hasMultiLineInitializer() const;
176  bool protectionVisible() const;
177  bool showInCallGraph() const;
178  bool isStrongEnumValue() const;
179  bool livesInsideEnum() const;
180 
181  // derived getters
182  bool isFriendToHide() const;
183  bool isNotFriend() const;
184  bool isFunctionOrSignalSlot() const;
185  bool isRelatedOrFriend() const;
186 
187  // output info
188  bool isLinkableInProject() const;
189  bool isLinkable() const;
190  bool hasDocumentation() const; // overrides hasDocumentation in definition.h
191  //bool hasUserDocumentation() const; // overrides hasUserDocumentation
192  bool isDeleted() const;
193  bool isBriefSectionVisible() const;
194  bool isDetailedSectionVisible(bool inGroup,bool inFile) const;
195  bool isDetailedSectionLinkable() const;
196  bool isFriendClass() const;
197  bool isDocumentedFriendClass() const;
198 
199  MemberDef *reimplements() const;
200  MemberList *reimplementedBy() const;
201  bool isReimplementedBy(ClassDef *cd) const;
202 
203  //int inbodyLine() const;
204  //QCString inbodyFile() const;
205  //const QCString &inbodyDocumentation() const;
206 
207  ClassDef *relatedAlso() const;
208 
209  bool hasDocumentedEnumValues() const;
211  bool isDocsForDefinition() const;
212  MemberDef *getEnumScope() const;
213  MemberList *enumFieldList() const;
214  void setEnumBaseType(const QCString &type);
215  QCString enumBaseType() const;
216 
217  bool hasExamples();
218  ExampleSDict *getExamples() const;
219  bool isPrototype() const;
220 
221  // argument related members
222  ArgumentList *argumentList() const;
225  QList<ArgumentList> *definitionTemplateParameterLists() const;
226 
227  // member group related members
228  int getMemberGroupId() const;
229  MemberGroup *getMemberGroup() const;
230 
231  bool fromAnonymousScope() const;
232  bool anonymousDeclShown() const;
234 
235  // callgraph related members
236  bool hasCallGraph() const;
237  bool hasCallerGraph() const;
238  bool visibleMemberGroup(bool hideNoHeader);
239 
240  MemberDef *templateMaster() const;
241  QCString getScopeString() const;
243 
244  // cached typedef functions
245  bool isTypedefValCached() const;
246  ClassDef *getCachedTypedefVal() const;
247  QCString getCachedTypedefTemplSpec() const;
248  QCString getCachedResolvedTypedef() const;
249 
250  MemberDef *memberDefinition() const;
251  MemberDef *memberDeclaration() const;
252  MemberDef *inheritsDocsFrom() const;
253  MemberDef *getGroupAlias() const;
254 
255  ClassDef *category() const;
256  MemberDef *categoryRelation() const;
257 
258  QCString displayName(bool=TRUE) const;
259  QCString getDeclType() const;
260  void getLabels(QStrList &sl,Definition *container) const;
261 
262  const ArgumentList *typeConstraints() const;
263 
264  // overrules
265  QCString documentation() const;
266  QCString briefDescription(bool abbr=FALSE) const;
267  QCString fieldType() const;
268  bool isReference() const;
269 
270 
271  //-----------------------------------------------------------------------------------
272  // ---- setters -----
273  //-----------------------------------------------------------------------------------
274 
275  // set functions
276  void setMemberType(MemberType t);
277  void setDefinition(const char *d);
278  void setFileDef(FileDef *fd);
279  void setAnchor();
280  void setProtection(Protection p);
281  void setMemberSpecifiers(uint64 s);
282  void mergeMemberSpecifiers(uint64 s);
283  void setInitializer(const char *i);
284  void setBitfields(const char *s);
285  void setMaxInitLines(int lines);
286  void setMemberClass(ClassDef *cd);
287  void setSectionList(Definition *d,MemberList *sl);
289  const QCString &fileName,int startLine,bool hasDocs,
290  MemberDef *member=0);
291  void setExplicitExternal(bool b);
292  void setReadAccessor(const char *r);
293  void setWriteAccessor(const char *w);
294  void setTemplateSpecialization(bool b);
295 
296  void makeRelated();
297  void makeForeign();
298  void setHasDocumentedParams(bool b);
299  void setHasDocumentedReturnType(bool b);
300  void setInheritsDocsFrom(MemberDef *md);
301  void setTagInfo(TagInfo *i);
302  void setArgsString(const char *as);
303 
304  // relation to other members
305  void setReimplements(MemberDef *md);
307 
308  // in-body documentation
309  //void setInbodyDocumentation(const char *docs,const char *file,int line);
310 
311  void setRelatedAlso(ClassDef *cd);
312 
313  // enumeration specific members
314  void insertEnumField(MemberDef *md);
315  void setEnumScope(MemberDef *md,bool livesInsideEnum=FALSE);
316  void setEnumClassScope(ClassDef *cd);
317  void setDocumentedEnumValues(bool value);
319 
320  // example related members
321  bool addExample(const char *anchor,const char *name,const char *file);
322 
323  // prototype related members
324  void setPrototype(bool p);
325 
326  // argument related members
327  void setArgumentList(ArgumentList *al);
329  void setDefinitionTemplateParameterLists(QList<ArgumentList> *lists);
331  void setType(const char *t);
332  void setAccessorType(ClassDef *cd,const char *t);
333 
334  // namespace related members
335  void setNamespace(NamespaceDef *nd);
336 
337  // member group related members
338  void setMemberGroup(MemberGroup *grp);
339  void setMemberGroupId(int id);
341 
342  // anonymous scope members
343  void setFromAnonymousScope(bool b);
345 
346  void enableCallGraph(bool e);
347  void enableCallerGraph(bool e);
348 
349  void setTemplateMaster(MemberDef *mt);
350  void addListReference(Definition *d);
351  void setDocsForDefinition(bool b);
352  void setGroupAlias(MemberDef *md);
353 
354  void cacheTypedefVal(ClassDef *val,const QCString &templSpec,const QCString &resolvedType);
356 
358 
359  // declaration <-> definition relation
360  void setMemberDefinition(MemberDef *md);
362 
363  void setAnonymousUsed();
364  void copyArgumentNames(MemberDef *bmd);
365 
366  void setCategory(ClassDef *);
368 
369  void setDocumentation(const char *d,const char *docFile,int docLine,bool stripWhiteSpace=TRUE);
370  void setBriefDescription(const char *b,const char *briefFile,int briefLine);
371  void setInbodyDocumentation(const char *d,const char *inbodyFile,int inbodyLine);
372 
373  void setHidden(bool b);
374 
375  //-----------------------------------------------------------------------------------
376  // --- actions ----
377  //-----------------------------------------------------------------------------------
378 
379  // output generation
380  void writeDeclaration(OutputList &ol,
381  ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd,
382  bool inGroup, ClassDef *inheritFrom=0,const char *inheritId=0);
383  void writeDocumentation(MemberList *ml,int memCount,int memTotal,OutputList &ol,
384  const char *scopeName,Definition *container,
385  bool inGroup,bool showEnumValues=FALSE,bool
386  showInline=FALSE);
387  void writeMemberDocSimple(OutputList &ol,Definition *container);
388  void writeEnumDeclaration(OutputList &typeDecl,
389  ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd);
390  void writeTagFile(FTextStream &);
391  void warnIfUndocumented();
392 
394  ArgumentList *actualArgs);
395 
397 
398  bool visited;
399 
400  protected:
401  void flushToDisk() const;
402  void loadFromDisk() const;
403  private:
404  void lock() const;
405  void unlock() const;
406  void saveToDisk() const;
407  void makeResident() const;
409  void _computeIsConstructor();
410  void _computeIsDestructor();
411  void _writeGroupInclude(OutputList &ol,bool inGroup);
412  void _writeCallGraph(OutputList &ol);
413  void _writeCallerGraph(OutputList &ol);
414  void _writeReimplements(OutputList &ol);
416  void _writeExamples(OutputList &ol);
418  void _writeEnumValues(OutputList &ol,Definition *container,
419  const QCString &cfname,const QCString &ciname,
420  const QCString &cname);
422  void _writeTagData(const DefType);
423  void _addToSearchIndex();
424 
425  static int s_indentLevel;
426  // disable copying of member defs
427  MemberDef(const MemberDef &);
428  MemberDef &operator=(const MemberDef &);
429 
430  void writeLink(OutputList &ol,
431  ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd,
432  bool onlyText=FALSE);
433 
435  uchar m_isLinkableCached; // 0 = not cached, 1=FALSE, 2=TRUE
436  uchar m_isConstructorCached; // 0 = not cached, 1=FALSE, 2=TRUE
437  uchar m_isDestructorCached; // 0 = not cached, 1=FALSE, 2=TRUE
438 };
439 
441 
442 #endif