00001 /****************************************************************************** 00002 * 00003 * $Id: groupdef.h,v 1.18 2001/03/19 19:27:40 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 GROUPDEF_H 00019 #define GROUPDEF_H 00020 00021 #include "qtbc.h" 00022 #include "sortdict.h" 00023 #include "definition.h" 00024 #include "memberlist.h" 00025 #include "memberdef.h" 00026 #include "htmlhelp.h" 00027 00028 class FileList; 00029 class ClassSDict; 00030 class FileDef; 00031 class ClassDef; 00032 class NamespaceDef; 00033 class GroupList; 00034 class OutputList; 00035 class NamespaceSDict; 00036 class MemberGroupSDict; 00037 class MemberNameInfoSDict; 00038 class PageSDict; 00039 class PageDef; 00040 class DirDef; 00041 class DirList; 00042 00043 class GroupDef : public Definition 00044 { 00045 public: 00046 GroupDef(const char *fileName,int line,const char *name,const char *title,const char *refFileName=0); 00047 ~GroupDef(); 00048 DefType definitionType() const { return TypeGroup; } 00049 QCString getOutputFileBase() const; 00050 const char *groupTitle() const { return title; } 00051 void setGroupTitle( const char *newtitle ); 00052 bool hasGroupTitle( ) { return titleSet; } 00053 void addFile(const FileDef *def); 00054 bool addClass(const ClassDef *def); 00055 bool addNamespace(const NamespaceDef *def); 00056 void addGroup(const GroupDef *def); 00057 void addParentGroup(const GroupDef *def); 00058 void addPage(PageDef *def); 00059 void addExample(const PageDef *def); 00060 void addDir(const DirDef *dd); 00061 bool insertMember(MemberDef *def,bool docOnly=FALSE); 00062 void removeMember(MemberDef *md); 00063 bool containsGroup(const GroupDef *def); // true if def is already a subgroup 00064 void writeDetailedDocumentation(OutputList &ol); 00065 void writeDocumentation(OutputList &ol); 00066 void writeMemberDocumentation(OutputList &ol); 00067 void writeMemberPages(OutputList &ol); 00068 void writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) const; 00069 int countMembers() const; 00070 bool isLinkableInProject() const 00071 { 00072 return !isReference(); 00073 } 00074 bool isLinkable() const 00075 { 00076 return TRUE; 00077 } 00078 bool isASubGroup() const; 00079 void computeAnchors(); 00080 00081 void addMembersToMemberGroup(); 00082 void distributeMemberGroupDocumentation(); 00083 void findSectionsInDocumentation(); 00084 00085 void addListReferences(); 00086 00087 bool visited; // number of times accessed for output - KPW 00088 00089 friend void writeGroupTreeNode(OutputList&, GroupDef*, int); 00090 // make accessible for writing tree view of group in index.cpp - KPW 00091 00092 void setGroupScope(Definition *d) { groupScope = d; } 00093 Definition *getGroupScope() const { return groupScope; } 00094 00095 MemberList *getMemberList(MemberList::ListType lt) const; 00096 const QList<MemberList> &getMemberLists() const { return m_memberLists; } 00097 00098 /* user defined member groups */ 00099 MemberGroupSDict *getMemberGroupSDict() const { return memberGroupSDict; } 00100 00101 FileList * getFiles() const { return fileList; } 00102 ClassSDict * getClasses() const { return classSDict; } 00103 NamespaceSDict * getNamespaces() const { return namespaceSDict; } 00104 GroupList * getSubGroups() const { return groupList; } 00105 PageSDict * getPages() const { return pageDict; } 00106 DirList * getDirs() const { return dirList; } 00107 //MemberList* getMembers() const { return allMemberList; } 00108 00109 protected: 00110 void addMemberListToGroup(MemberList *,bool (MemberDef::*)() const); 00111 00112 private: 00113 MemberList *createMemberList(MemberList::ListType lt); 00114 void addMemberToList(MemberList::ListType lt,MemberDef *md); 00115 void writeMemberDeclarations(OutputList &ol,MemberList::ListType lt,const QCString &title); 00116 void writeMemberDocumentation(OutputList &ol,MemberList::ListType lt,const QCString &title); 00117 void removeMemberFromList(MemberList::ListType lt,MemberDef *md); 00118 00119 QCString title; // title of the group 00120 bool titleSet; // true if title is not the same as the name 00121 QCString fileName; // base name of the generated file 00122 FileList *fileList; // list of files in the group 00123 ClassSDict *classSDict; // list of classes in the group 00124 NamespaceSDict *namespaceSDict; // list of namespaces in the group 00125 GroupList *groupList; // list of sub groups. 00126 PageSDict *pageDict; // list of pages in the group 00127 PageSDict *exampleDict; // list of examples in the group 00128 DirList *dirList; // list of directories in the group 00129 00130 MemberList *allMemberList; 00131 MemberNameInfoSDict *allMemberNameInfoSDict; 00132 00133 Definition *groupScope; 00134 00135 QList<MemberList> m_memberLists; 00136 MemberGroupSDict *memberGroupSDict; 00137 00138 }; 00139 00140 class GroupSDict : public SDict<GroupDef> 00141 { 00142 public: 00143 GroupSDict(uint size) : SDict<GroupDef>(size) {} 00144 virtual ~GroupSDict() {} 00145 int compareItems(GCI item1,GCI item2) 00146 { 00147 return strcmp(((GroupDef*)item1)->groupTitle(),((GroupDef*)item2)->groupTitle()); 00148 } 00149 }; 00150 00151 class GroupList : public QList<GroupDef> 00152 { 00153 public: 00154 int compareItems(GCI item1,GCI item2) 00155 { 00156 return strcmp(((GroupDef*)item1)->groupTitle(),((GroupDef*)item2)->groupTitle()); 00157 } 00158 }; 00159 00160 class GroupListIterator : public QListIterator<GroupDef> 00161 { 00162 public: 00163 GroupListIterator(const GroupList &l) : QListIterator<GroupDef>(l) {} 00164 virtual ~GroupListIterator() {} 00165 }; 00166 00167 void addClassToGroups(Entry *root,ClassDef *cd); 00168 void addNamespaceToGroups(Entry *root,NamespaceDef *nd); 00169 void addGroupToGroups(Entry *root,GroupDef *subGroup); 00170 void addMemberToGroups(Entry *root,MemberDef *md); 00171 void addPageToGroups(Entry *root,PageDef *pd); 00172 void addExampleToGroups(Entry *root,PageDef *eg); 00173 void addDirToGroups(Entry *root,DirDef *dd); 00174 00175 #endif 00176