ISLEman
memberdef.h
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
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;
77  MemberList *getSectionList(Definition *d) const;
78  QCString displayDefinition() const;
79 
80  // scope query members
81  ClassDef *getClassDef() const;
82  FileDef *getFileDef() const;
83  NamespaceDef* getNamespaceDef() 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;
92  Grouping::GroupPri_t getGroupPri() 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;
210  MemberDef *getAnonymousEnumType() 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;
223  ArgumentList *declArgumentList() const;
224  ArgumentList *templateArguments() 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;
233  MemberDef *fromAnonymousMember() 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);
288  void setGroupDef(GroupDef *gd,Grouping::GroupPri_t pri,
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);
306  void insertReimplementedBy(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);
318  void setAnonymousEnumType(MemberDef *md);
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);
328  void setDeclArgumentList(ArgumentList *al);
329  void setDefinitionTemplateParameterLists(QList<ArgumentList> *lists);
330  void setTypeConstraints(ArgumentList *al);
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);
340  void makeImplementationDetail();
341 
342  // anonymous scope members
343  void setFromAnonymousScope(bool b);
344  void setFromAnonymousMember(MemberDef *m);
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);
355  void invalidateTypedefValCache();
356 
357  void invalidateCachedArgumentTypes();
358 
359  // declaration <-> definition relation
360  void setMemberDefinition(MemberDef *md);
361  void setMemberDeclaration(MemberDef *md);
362 
363  void setAnonymousUsed();
364  void copyArgumentNames(MemberDef *bmd);
365 
366  void setCategory(ClassDef *);
367  void setCategoryRelation(MemberDef *);
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  void warnIfUndocumentedParams();
393 
394  MemberDef *createTemplateInstanceMember(ArgumentList *formalArgs,
395  ArgumentList *actualArgs);
396 
397  void findSectionsInDocumentation();
398 
399  bool visited;
400 
401  protected:
402  void flushToDisk() const;
403  void loadFromDisk() const;
404  private:
405  void lock() const;
406  void unlock() const;
407  void saveToDisk() const;
408  void makeResident() const;
409  void _computeLinkableInProject();
410  void _computeIsConstructor();
411  void _computeIsDestructor();
412  void _writeGroupInclude(OutputList &ol,bool inGroup);
413  void _writeCallGraph(OutputList &ol);
414  void _writeCallerGraph(OutputList &ol);
415  void _writeReimplements(OutputList &ol);
416  void _writeReimplementedBy(OutputList &ol);
417  void _writeExamples(OutputList &ol);
418  void _writeTypeConstraints(OutputList &ol);
419  void _writeEnumValues(OutputList &ol,Definition *container,
420  const QCString &cfname,const QCString &ciname,
421  const QCString &cname);
422  void _writeCategoryRelation(OutputList &ol);
423  void _writeTagData(const DefType);
424  void _addToSearchIndex();
425 
426  static int s_indentLevel;
427  // disable copying of member defs
428  MemberDef(const MemberDef &);
429  MemberDef &operator=(const MemberDef &);
430 
431  void writeLink(OutputList &ol,
432  ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd,
433  bool onlyText=FALSE);
434 
435  MemberDefImpl *m_impl;
436  uchar m_isLinkableCached; // 0 = not cached, 1=FALSE, 2=TRUE
437  uchar m_isConstructorCached; // 0 = not cached, 1=FALSE, 2=TRUE
438  uchar m_isDestructorCached; // 0 = not cached, 1=FALSE, 2=TRUE
439 };
440 
441 void combineDeclarationAndDefinition(MemberDef *mdec,MemberDef *mdef);
442 
443 #endif
bool isReference() const
Definition: memberdef.cpp:5156
Definition: qstrlist.h:57
This class represents an function or template argument list.
Definition: arguments.h:89
This file contains a number of basic enums and types.
The common base class of all entity definitions found in the sources.
Definition: definition.h:92
A model of a namespace symbol.
Definition: namespacedef.h:39
QCString qualifiedName() const
Definition: memberdef.cpp:3997
QCString getOutputFileBase() const
Definition: memberdef.cpp:949
A model of a class/file/namespace member symbol.
Definition: memberdef.h:43
DefType definitionType() const
Definition: memberdef.h:53
int briefLine() const
Definition: definition.cpp:1789
A model of a file symbol.
Definition: filedef.h:64
GroupPri_t
Grouping priority.
Definition: types.h:65
QCString documentation() const
Definition: memberdef.cpp:5114
This struct is used to capture the tag file information for an Entry.
Definition: entry.h:50
QCString anchor() const
Definition: memberdef.cpp:1039
Simplified and optimized version of QTextStream.
Definition: ftextstream.h:11
int docLine() const
Definition: definition.cpp:1695
bool isLinkable() const
Definition: memberdef.cpp:1169
Relationship
Kind of member relationship.
Definition: types.h:38
bool isBriefSectionVisible() const
Definition: memberdef.cpp:1297
QCString inbodyFile() const
Definition: definition.cpp:1811
A class representing a group of members.
Definition: membergroup.h:40
void writeDocumentation(MemberList *ml, int memCount, int memTotal, OutputList &ol, const char *scopeName, Definition *container, bool inGroup, bool showEnumValues=FALSE, bool showInline=FALSE)
Definition: memberdef.cpp:2541
const QCString & name() const
Definition: definition.h:114
void setDocumentation(const char *d, const char *docFile, int docLine, bool stripWhiteSpace=TRUE)
Definition: memberdef.cpp:1134
DefType
Definition: definition.h:71
void setInbodyDocumentation(const char *d, const char *inbodyFile, int inbodyLine)
Definition: memberdef.cpp:1146
Specifier
Virtualness of a member.
Definition: types.h:29
QCString briefFile() const
Definition: definition.cpp:1794
A list of MemberDef objects.
Definition: memberlist.h:32
bool isLinkableInProject() const
Definition: memberdef.cpp:1158
The QTextStream class provides basic functions for reading and writing text using a QIODevice...
Definition: qtextstream.h:53
~MemberDef()
Definition: memberdef.cpp:861
Class representing a list of output generators that are written to in parallel.
Definition: outputlist.h:54
bool hasDocumentation() const
Definition: memberdef.cpp:3303
Definition: memberdef.cpp:470
ClassDef * getClassDefOfAnonymousType()
Definition: memberdef.cpp:1244
Protection
Protection level of members.
Definition: types.h:26
int inbodyLine() const
Definition: definition.cpp:1806
QCString briefDescription(bool abbr=FALSE) const
Definition: memberdef.cpp:5102
QCString getReference() const
Definition: memberdef.cpp:1009
A sorted dictionary of Example objects.
Definition: example.h:36
This is an alternative implementation of QCString.
Definition: qcstring.h:131
A model of a group of symbols.
Definition: groupdef.h:45
QCString docFile() const
Definition: definition.cpp:1700
A class representing of a compound symbol.
Definition: classdef.h:59
void setBriefDescription(const char *b, const char *briefFile, int briefLine)
Definition: memberdef.cpp:1140
void writeDeclaration(OutputList &ol, ClassDef *cd, NamespaceDef *nd, FileDef *fd, GroupDef *gd, bool inGroup, ClassDef *inheritFrom=0, const char *inheritId=0)
Definition: memberdef.cpp:1419
MemberDef(const char *defFileName, int defLine, int defColumn, const char *type, const char *name, const char *args, const char *excp, Protection prot, Specifier virt, bool stat, Relationship related, MemberType t, const ArgumentList *tal, const ArgumentList *al)
Definition: memberdef.cpp:744
QCString displayName(bool=TRUE) const
Definition: memberdef.cpp:4916