memberdef.h

Go to the documentation of this file.
00001 /******************************************************************************
00002  *
00003  * 
00004  *
00005  * Copyright (C) 1997-2008 by Dimitri van Heesch.
00006  *
00007  * Permission to use, copy, modify, and distribute this software and its
00008  * documentation under the terms of the GNU General Public License is hereby 
00009  * granted. No representations are made about the suitability of this software 
00010  * for any purpose. It is provided "as is" without express or implied warranty.
00011  * See the GNU General Public License for more details.
00012  *
00013  * Documents produced by Doxygen are derivative works derived from the
00014  * input used in their production; they are not affected by this license.
00015  *
00016  */
00017 
00018 #ifndef MEMBERDEF_H
00019 #define MEMBERDEF_H
00020 
00021 #include "qtbc.h"
00022 #include <qlist.h>
00023 #include <qdict.h>
00024 #include <qstack.h>
00025 
00026 #include "entry.h"
00027 #include "definition.h"
00028 #include "sortdict.h"
00029 
00030 class ClassDef;
00031 class NamespaceDef;
00032 class GroupDef;
00033 class FileDef;
00034 class MemberList;
00035 class MemberGroup;
00036 class ExampleSDict;
00037 class OutputList;
00038 class GroupDef;
00039 class QTextStream;
00040 class ArgumentList;
00041 class MemberDefImpl;
00042 
00043 struct SourceReference
00044 {
00045   FileDef *fd;
00046   QCString anchor;
00047 };
00048 
00049 class MemberDef : public Definition
00050 {
00051   public:
00052     
00053     enum MemberType { 
00054       Define,
00055       Function, 
00056       Variable, 
00057       Typedef, 
00058       Enumeration, 
00059       EnumValue,
00060       Prototype,
00061       Signal,
00062       Slot,
00063       Friend,
00064       DCOP,
00065       Property,
00066       Event
00067     };
00068 
00069     MemberDef(const char *defFileName,int defLine,
00070               const char *type,const char *name,const char *args,
00071               const char *excp,Protection prot,Specifier virt,bool stat,
00072               bool related,MemberType t,const ArgumentList *tal,
00073               const ArgumentList *al);
00074    ~MemberDef(); 
00075     DefType definitionType() const        { return TypeMember; }
00076     
00077     //-----------------------------------------------------------------------------------
00078     // ----  getters -----
00079     //-----------------------------------------------------------------------------------
00080 
00081     // link id
00082     QCString getOutputFileBase() const;
00083     QCString getReference() const;
00084     QCString anchor() const;
00085 
00086     const char *declaration() const;
00087     const char *definition() const;
00088     const char *typeString() const;
00089     const char *argsString() const;
00090     const char *excpString() const;
00091     const char *bitfieldString() const;
00092     const char *extraTypeChars() const;
00093     const QCString &initializer() const;
00094     int initializerLines() const;
00095     int  getMemberSpecifiers() const;
00096     MemberList *getSectionList(Definition *d) const;
00097 
00098     // scope query members
00099     ClassDef *getClassDef() const;
00100     FileDef  *getFileDef() const;
00101     NamespaceDef* getNamespaceDef() const;
00102 
00103     // grabbing the property read/write accessor names
00104     const char *getReadAccessor() const;
00105     const char *getWriteAccessor() const;
00106     
00107     // querying the grouping definition
00108     GroupDef *getGroupDef() const;
00109     Grouping::GroupPri_t getGroupPri() const;
00110     const char *getGroupFileName() const;
00111     int getGroupStartLine() const;
00112     bool getGroupHasDocs() const;
00113     QCString qualifiedName() const;
00114     QCString objCMethodName(bool localLink,bool showStatic) const; 
00115 
00116     // direct kind info 
00117     Protection protection() const;
00118     Specifier virtualness(int count=0) const;
00119     MemberType memberType() const;
00120     QCString   memberTypeName() const;
00121 
00122     // getter methods
00123     bool isSignal() const;
00124     bool isSlot() const;
00125     bool isVariable() const;
00126     bool isEnumerate() const;
00127     bool isEnumValue() const;
00128     bool isTypedef() const;
00129     bool isFunction() const;
00130     bool isDefine() const;
00131     bool isFriend() const;
00132     bool isDCOP() const;
00133     bool isProperty() const;
00134     bool isEvent() const;
00135     bool isRelated() const;
00136     bool isStatic() const;
00137     bool isInline() const;
00138     bool isExplicit() const;
00139     bool isMutable() const;
00140     bool isGettable() const;
00141     bool isSettable() const;
00142     bool isReadable() const;
00143     bool isWritable() const;
00144     bool isAddable() const;
00145     bool isRemovable() const;
00146     bool isRaisable() const;
00147     bool isFinal() const;
00148     bool isAbstract() const;
00149     bool isOverride() const;
00150     bool isInitonly() const;
00151     bool isOptional() const;
00152     bool isRequired() const;
00153     bool isNonAtomic() const;
00154     bool isCopy() const;
00155     bool isAssign() const;
00156     bool isRetain() const;
00157     bool isNew() const;
00158     bool isSealed() const;
00159     bool isImplementation() const;
00160     bool isExternal() const;
00161     bool isTemplateSpecialization() const;
00162     bool hasDocumentedParams() const;
00163     bool hasDocumentedReturnType() const;
00164     bool isObjCMethod() const;
00165     bool isConstructor() const;
00166     bool isDestructor() const;
00167     bool hasOneLineInitializer() const;
00168     bool hasMultiLineInitializer() const;
00169     bool protectionVisible() const;
00170 
00171     // output info
00172     bool isLinkableInProject() const;
00173     bool isLinkable() const;
00174     bool hasDocumentation() const;  // overrides hasDocumentation in definition.h
00175     bool hasUserDocumentation() const; // overrides hasUserDocumentation
00176     bool isBriefSectionVisible() const;
00177     bool isDetailedSectionVisible(bool inGroup,bool inFile) const;
00178     bool isDetailedSectionLinkable() const;
00179     bool isFriendClass() const;
00180     bool isDocumentedFriendClass() const;
00181 
00182     MemberDef *reimplements() const;
00183     LockingPtr<MemberList> reimplementedBy() const;
00184 
00185     int inbodyLine() const;
00186     QCString inbodyFile() const;
00187     const QCString &inbodyDocumentation() const;
00188 
00189     ClassDef *relatedAlso() const;
00190 
00191     bool hasDocumentedEnumValues() const;
00192     MemberDef *getAnonymousEnumType() const;
00193     bool isDocsForDefinition() const;
00194     MemberDef *getEnumScope() const;
00195     LockingPtr<MemberList> enumFieldList() const;
00196 
00197     bool hasExamples();
00198     LockingPtr<ExampleSDict> getExamples() const;
00199     bool isPrototype() const;
00200 
00201     // argument related members
00202     LockingPtr<ArgumentList> argumentList() const;
00203     LockingPtr<ArgumentList> declArgumentList() const;
00204     LockingPtr<ArgumentList> templateArguments() const;
00205     LockingPtr< QList<ArgumentList> > definitionTemplateParameterLists() const;
00206 
00207     // member group related members
00208     int getMemberGroupId() const;
00209     MemberGroup *getMemberGroup() const;
00210 
00211     bool fromAnonymousScope() const;
00212     bool anonymousDeclShown() const;
00213 
00214     // callgraph related members
00215     bool hasCallGraph() const;
00216     bool hasCallerGraph() const;
00217     bool visibleMemberGroup(bool hideNoHeader);
00218 
00219     MemberDef *templateMaster() const;
00220     QCString getScopeString() const;
00221     ClassDef *getClassDefOfAnonymousType();
00222 
00223     // cached typedef functions
00224     bool isTypedefValCached() const;
00225     ClassDef *getCachedTypedefVal() const;
00226     QCString getCachedTypedefTemplSpec() const;
00227     QCString getCachedResolvedTypedef() const;
00228 
00229     MemberDef *memberDefinition() const;
00230     MemberDef *memberDeclaration() const;
00231     MemberDef *inheritsDocsFrom() const;
00232     MemberDef *getGroupAlias() const;
00233 
00234     //-----------------------------------------------------------------------------------
00235     // ----  setters -----
00236     //-----------------------------------------------------------------------------------
00237 
00238     // set functions
00239     void setMemberType(MemberType t);
00240     void setDefinition(const char *d);
00241     void setFileDef(FileDef *fd);
00242     void setAnchor(const char *a);
00243     void setProtection(Protection p);
00244     void setMemberSpecifiers(int s);
00245     void mergeMemberSpecifiers(int s);
00246     void setInitializer(const char *i);
00247     void setBitfields(const char *s);
00248     void setMaxInitLines(int lines);
00249     void setMemberClass(ClassDef *cd);
00250     void setSectionList(Definition *d,MemberList *sl);
00251     void setGroupDef(GroupDef *gd,Grouping::GroupPri_t pri,
00252                      const QCString &fileName,int startLine,bool hasDocs,
00253                      MemberDef *member=0);
00254     void setExplicitExternal(bool b);
00255     void setReadAccessor(const char *r);
00256     void setWriteAccessor(const char *w);
00257     void setTemplateSpecialization(bool b);
00258     
00259     void makeRelated();
00260     void setHasDocumentedParams(bool b);
00261     void setHasDocumentedReturnType(bool b);
00262     void setInheritsDocsFrom(MemberDef *md);
00263     void setTagInfo(TagInfo *i);
00264     void setArgsString(const char *as);
00265 
00266     // relation to other members
00267     void setReimplements(MemberDef *md);
00268     void insertReimplementedBy(MemberDef *md);
00269 
00270     // in-body documentation
00271     void setInbodyDocumentation(const char *docs,const char *file,int line);
00272 
00273     void setRelatedAlso(ClassDef *cd);
00274 
00275     // enumeration specific members
00276     void insertEnumField(MemberDef *md);
00277     void setEnumScope(MemberDef *md);
00278     void setEnumClassScope(ClassDef *cd);
00279     void setDocumentedEnumValues(bool value);
00280     void setAnonymousEnumType(MemberDef *md);
00281 
00282     // example related members
00283     bool addExample(const char *anchor,const char *name,const char *file);
00284     
00285     // prototype related members
00286     void setPrototype(bool p);
00287 
00288     // argument related members
00289     void setArgumentList(ArgumentList *al);
00290     void setDeclArgumentList(ArgumentList *al);
00291     void setDefinitionTemplateParameterLists(QList<ArgumentList> *lists);
00292     void setTypeConstraints(ArgumentList *al);
00293 
00294     // namespace related members
00295     void setNamespace(NamespaceDef *nd);
00296 
00297     // member group related members
00298     void setMemberGroup(MemberGroup *grp);
00299     void setMemberGroupId(int id);
00300     void makeImplementationDetail();
00301 
00302     // anonymous scope members
00303     void setFromAnonymousScope(bool b);
00304     void setFromAnonymousMember(MemberDef *m);
00305 
00306     void enableCallGraph(bool e);
00307     void enableCallerGraph(bool e);
00308 
00309     void setTemplateMaster(MemberDef *mt);
00310     void addListReference(Definition *d);
00311     void setDocsForDefinition(bool b);
00312     void setGroupAlias(MemberDef *md);
00313 
00314     void cacheTypedefVal(ClassDef *val,const QCString &templSpec,const QCString &resolvedType);
00315     void invalidateTypedefValCache();
00316     
00317     // declaration <-> definition relation
00318     void setMemberDefinition(MemberDef *md);
00319     void setMemberDeclaration(MemberDef *md);
00320         
00321     void setAnonymousUsed();
00322     void copyArgumentNames(MemberDef *bmd);
00323     
00324     //-----------------------------------------------------------------------------------
00325     // --- actions ----
00326     //-----------------------------------------------------------------------------------
00327 
00328     // output generation
00329     void writeDeclaration(OutputList &ol,
00330                    ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd,
00331                    bool inGroup); 
00332     void writeDocumentation(MemberList *ml,OutputList &ol,
00333                             const char *scopeName,Definition *container,
00334                             bool inGroup,bool showEnumValues=FALSE);
00335     void warnIfUndocumented();
00336     
00337     MemberDef *createTemplateInstanceMember(ArgumentList *formalArgs,
00338                ArgumentList *actualArgs);
00339 
00340     void writeEnumDeclaration(OutputList &typeDecl,
00341             ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd);
00342 
00343     void findSectionsInDocumentation();
00344     
00345     bool visited;
00346    
00347   protected:
00348     void flushToDisk() const;
00349     void loadFromDisk() const;
00350   private:
00351     void lock() const;
00352     void unlock() const;
00353     void saveToDisk() const;
00354     void makeResident() const;
00355 
00356     static int s_indentLevel;
00357     // disable copying of member defs
00358     MemberDef(const MemberDef &);
00359     MemberDef &operator=(const MemberDef &);
00360 
00361     void writeLink(OutputList &ol,
00362                    ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd,
00363                    bool onlyText=FALSE);
00364 
00365     MemberDefImpl *m_impl;
00366     int m_cacheHandle;
00367     off_t m_storagePos;     // location where the item is stored in file (if impl==0)
00368     bool m_flushPending;
00369 };
00370 
00371 #endif



Generated on Mon Mar 31 10:58:40 2008 by  doxygen 1.5.1