classdef.h

Go to the documentation of this file.
00001 /******************************************************************************
00002  *
00003  * $Id: classdef.h,v 1.39 2001/03/19 19:27:39 root Exp $
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 CLASSDEF_H
00019 #define CLASSDEF_H
00020 
00021 #include "qtbc.h"
00022 #include <qlist.h>
00023 #include <qdict.h>
00024 #include <qstrlist.h>
00025 
00026 //#include "entry.h"
00027 #include "memberlist.h"
00028 #include "definition.h"
00029 #include "sortdict.h"
00030 
00031 class MemberDict;
00032 class ClassList;
00033 class ClassSDict;
00034 class OutputList;
00035 class FileDef;
00036 class BaseClassList;
00037 class NamespaceDef;
00038 class MemberDef;
00039 class ExampleSDict;
00040 class MemberNameInfoSDict;
00041 class UsesClassDict;
00042 class MemberGroupSDict;
00043 class QTextStream;
00044 class PackageDef;
00045 class GroupDef;
00046 class StringDict;
00047 struct IncludeInfo;
00048 class ClassDefImpl;
00049 
00055 class ClassDef : public Definition
00056 {
00057   public:
00059     enum CompoundType { Class, //=Entry::CLASS_SEC, 
00060                         Struct, //=Entry::STRUCT_SEC, 
00061                         Union, //=Entry::UNION_SEC,
00062                         Interface, //=Entry::INTERFACE_SEC,
00063                         Protocol, //=Entry::PROTOCOL_SEC,
00064                         Category, //=Entry::CATEGORY_SEC,
00065                         Exception //=Entry::EXCEPTION_SEC
00066                       };
00067 
00083     ClassDef(const char *fileName,int startLine,
00084              const char *name,CompoundType ct,
00085              const char *ref=0,const char *fName=0,
00086              bool isSymbol=TRUE);
00088    ~ClassDef();
00089 
00090     //-----------------------------------------------------------------------------------
00091     // --- getters 
00092     //-----------------------------------------------------------------------------------
00093 
00095     DefType definitionType() const { return TypeClass; }
00096 
00098     QCString getOutputFileBase() const; 
00099     QCString getInstanceOutputFileBase() const; 
00100     QCString getFileBase() const;
00101 
00103     QCString getSourceFileBase() const; 
00104 
00106     QCString getReference() const;
00107 
00109     bool isReference() const;
00110 
00112     bool isLocal() const;
00113 
00115     ClassSDict *getInnerClasses();
00116 
00118     bool hasDocumentation() const;
00119 
00121     QCString displayName() const;
00122 
00124     CompoundType compoundType() const;
00125 
00127     QCString compoundTypeString() const;
00128 
00132     BaseClassList *baseClasses() const;
00133     
00136     BaseClassList *subClasses() const;
00137 
00141     MemberNameInfoSDict *memberNameInfoSDict() const;
00142 
00146     Protection protection() const;
00147 
00150     bool isLinkableInProject() const;
00151 
00155     bool isLinkable() const;
00156 
00158     bool isVisibleInHierarchy();
00159     
00163     ArgumentList *templateArguments() const;
00164 
00168     NamespaceDef *getNamespaceDef() const;
00169 
00173     FileDef      *getFileDef() const;
00174 
00178     MemberDef    *getMemberByName(const QCString &) const;
00179     
00184     bool isBaseClass(ClassDef *bcd,bool followInstances,int level=0);
00185 
00189     bool isAccessibleMember(MemberDef *md);
00190 
00194     QDict<ClassDef> *getTemplateInstances() const;
00195 
00199     ClassDef *templateMaster() const;
00200 
00202     bool isTemplate() const;
00203 
00204     IncludeInfo *includeInfo() const;
00205     
00206     UsesClassDict *usedImplementationClasses() const;
00207 
00208     UsesClassDict *usedByImplementationClasses() const;
00209 
00210     UsesClassDict *usedInterfaceClasses() const;
00211 
00212     bool isTemplateArgument() const;
00213 
00218     virtual Definition *findInnerCompound(const char *name);
00219 
00227     void getTemplateParameterLists(QList<ArgumentList> &lists) const;
00228 
00229     QCString qualifiedNameWithTemplateParameters(
00230         QList<ArgumentList> *actualParams=0) const;
00231 
00235     bool isAbstract() const;
00236 
00238     bool isObjectiveC() const;
00239 
00241     ClassDef *categoryOf() const;
00242 
00246     QCString className() const;
00247 
00249     MemberList *getMemberList(MemberList::ListType lt);
00250 
00252     const QList<MemberList> &getMemberLists() const;
00253 
00255     MemberGroupSDict *getMemberGroupSDict() const;
00256 
00257     QDict<int> *getTemplateBaseClassNames() const;
00258 
00259     ClassDef *getVariableInstance(const char *templSpec);
00260 
00261     bool isUsedOnly() const;
00262 
00263     //-----------------------------------------------------------------------------------
00264     // --- setters ----
00265     //-----------------------------------------------------------------------------------
00266 
00267     void insertBaseClass(ClassDef *,const char *name,Protection p,Specifier s,const char *t=0);
00268     void insertSubClass(ClassDef *,Protection p,Specifier s,const char *t=0);
00269     void setIncludeFile(FileDef *fd,const char *incName,bool local,bool force); 
00270     void insertMember(MemberDef *);
00271     void insertUsedFile(const char *);
00272     bool addExample(const char *anchor,const char *name, const char *file);
00273     void mergeCategory(ClassDef *category);
00274     void setNamespace(NamespaceDef *nd);
00275     void setFileDef(FileDef *fd);
00276     void setSubGrouping(bool enabled);
00277     void setProtection(Protection p);
00278     void setGroupDefForAllMembers(GroupDef *g,Grouping::GroupPri_t pri,const QCString &fileName,int startLine,bool hasDocs);
00279     void addInnerCompound(Definition *d);
00280     ClassDef *insertTemplateInstance(const QCString &fileName,int startLine,
00281                                 const QCString &templSpec,bool &freshInstance);
00282     void addUsedClass(ClassDef *cd,const char *accessName);
00283     void addUsedByClass(ClassDef *cd,const char *accessName);
00284     void setIsStatic(bool b);
00285     void setIsObjectiveC(bool b);
00286     void setCompoundType(CompoundType t);
00287     void setClassName(const char *name);
00288 
00289     void setTemplateArguments(ArgumentList *al);
00290     void setTemplateBaseClassNames(QDict<int> *templateNames);
00291     void setTemplateMaster(ClassDef *tm);
00292     void setTypeConstraints(ArgumentList *al);
00293     void addMembersToTemplateInstance(ClassDef *cd,const char *templSpec);
00294     void makeTemplateArgument(bool b=TRUE);
00295     void setCategoryOf(ClassDef *cd);
00296     void setUsedOnly(bool b);
00297 
00298     //-----------------------------------------------------------------------------------
00299     // --- actions ----
00300     //-----------------------------------------------------------------------------------
00301 
00302     void findSectionsInDocumentation();
00303     void addMembersToMemberGroup();
00304     void addListReferences();
00305     void computeAnchors();
00306     void mergeMembers();
00307     void distributeMemberGroupDocumentation();
00308     void writeDocumentation(OutputList &ol);
00309     void writeClassDiagrams(OutputList &ol);
00310     void writeDocumentationForInnerClasses(OutputList &ol);
00311     void writeMemberDocumentation(OutputList &ol);
00312     void writeMemberPages(OutputList &ol);
00313     void writeMemberList(OutputList &ol);
00314     void writeDeclaration(OutputList &ol,MemberDef *md,bool inGroup);
00315     void writeDetailedDescription(OutputList &ol,const QCString &pageType,bool exampleFlag);
00316     void writeQuickMemberLinks(OutputList &ol,MemberDef *md) const;
00317     
00318     bool visited;
00319 
00320   protected:
00321     void addUsedInterfaceClasses(MemberDef *md,const char *typeStr);
00322     bool hasExamples();
00323     bool hasNonReferenceSuperClass();
00324     void showUsedFiles(OutputList &ol);
00325 
00326   private: 
00327     void internalInsertMember(MemberDef *md,Protection prot,bool addToAllList);
00328     QCString getMemberListFileName() const;
00329     void addMemberToList(MemberList::ListType lt,MemberDef *md);
00330     MemberList *createMemberList(MemberList::ListType lt);
00331     void writeMemberDeclarations(OutputList &ol,MemberList::ListType lt,const QCString &title,
00332                                  const char *subTitle=0);
00333     void writeMemberDocumentation(OutputList &ol,MemberList::ListType lt,const QCString &title);
00334     void writePlainMemberDeclaration(OutputList &ol,MemberList::ListType lt,bool inGroup);
00335     
00336     ClassDefImpl *m_impl;
00337 
00338 };
00339 
00342 struct UsesClassDef
00343 {
00344   UsesClassDef(ClassDef *cd) : classDef(cd) 
00345   { 
00346     accessors = new QDict<void>(17); 
00347     containment = TRUE;
00348   }
00349  ~UsesClassDef()
00350   {
00351     delete accessors;
00352   }
00353   void addAccessor(const char *s)
00354   {
00355     if (accessors->find(s)==0)
00356     {
00357       accessors->insert(s,(void *)666);
00358     }
00359   }
00361   ClassDef *classDef;
00362 
00366   QDict<void> *accessors;
00367 
00369   QCString templSpecifiers;
00370 
00371   bool containment;
00372 };
00373 
00376 class UsesClassDict : public QDict<UsesClassDef>
00377 {
00378   public:
00379     UsesClassDict(int size) : QDict<UsesClassDef>(size) {}
00380    ~UsesClassDict() {}
00381 };
00382 
00385 class UsesClassDictIterator : public QDictIterator<UsesClassDef>
00386 {
00387   public:
00388     UsesClassDictIterator(const QDict<UsesClassDef> &d) 
00389       : QDictIterator<UsesClassDef>(d) {}
00390    ~UsesClassDictIterator() {}
00391 };
00392 
00395 struct BaseClassDef
00396 {
00397   BaseClassDef(ClassDef *cd,const char *n,Protection p,
00398                Specifier v,const char *t) : 
00399         classDef(cd), usedName(n), prot(p), virt(v), templSpecifiers(t) {}
00400 
00402   ClassDef *classDef;
00403 
00407   QCString   usedName; 
00408   
00412   Protection prot;     
00413 
00417   Specifier  virt;
00418 
00420   QCString templSpecifiers;
00421 };
00422 
00427 class BaseClassList : public QList<BaseClassDef>
00428 {
00429   public:
00430    ~BaseClassList() {}
00431     int compareItems(GCI item1,GCI item2)
00432     {
00433       ClassDef *c1=((BaseClassDef *)item1)->classDef;
00434       ClassDef *c2=((BaseClassDef *)item2)->classDef;
00435       if (c1==0 || c2==0) 
00436         return FALSE;
00437       else
00438         return stricmp(c1->name(),c2->name());
00439     }
00440 };
00441 
00444 class BaseClassListIterator : public QListIterator<BaseClassDef>
00445 {
00446   public:
00447     BaseClassListIterator(const BaseClassList &bcl) : 
00448       QListIterator<BaseClassDef>(bcl) {}
00449 };
00450 
00451 #endif



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