00001 /****************************************************************************** 00002 * 00003 * $Id: index.h,v 1.28 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 INDEX_H 00019 #define INDEX_H 00020 00021 #include "qtbc.h" 00022 #include <qfile.h> 00023 #include <qlist.h> 00024 00025 class MemberDef; 00026 class OutputList; 00027 00028 00029 class IndexIntf 00030 { 00031 public: 00032 virtual ~IndexIntf() {} 00033 virtual void initialize() = 0; 00034 virtual void finalize() = 0; 00035 virtual void incContentsDepth() = 0; 00036 virtual void decContentsDepth() = 0; 00037 virtual void addContentsItem(bool isDir, const char *name, const char *ref = 0, 00038 const char *file = 0, const char *anchor = 0) = 0; 00039 virtual void addIndexItem(const char *level1, const char *level2, const char *contRef, 00040 const char *memRef, const char *anchor,const MemberDef *md) = 0; 00041 virtual void addIndexFile(const char *name) = 0; 00042 }; 00043 00044 class IndexList : public IndexIntf 00045 { 00046 private: 00047 QList<IndexIntf> m_intfs; 00048 00049 void foreach(void (IndexIntf::*methodPtr)()) 00050 { 00051 QListIterator<IndexIntf> li(m_intfs); 00052 for (li.toFirst();li.current();++li) (li.current()->*methodPtr)(); 00053 } 00054 template<typename A1> 00055 void foreach(void (IndexIntf::*methodPtr)(A1),A1 a1) 00056 { 00057 QListIterator<IndexIntf> li(m_intfs); 00058 for (li.toFirst();li.current();++li) (li.current()->*methodPtr)(a1); 00059 } 00060 template<typename A1,typename A2,typename A3,typename A4,typename A5> 00061 void foreach(void (IndexIntf::*methodPtr)(A1,A2,A3,A4,A5),A1 a1,A2 a2,A3 a3,A4 a4,A5 a5) 00062 { 00063 QListIterator<IndexIntf> li(m_intfs); 00064 for (li.toFirst();li.current();++li) (li.current()->*methodPtr)(a1,a2,a3,a4,a5); 00065 } 00066 template<typename A1,typename A2,typename A3,typename A4,typename A5,typename A6> 00067 void foreach(void (IndexIntf::*methodPtr)(A1,A2,A3,A4,A5,A6),A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6) 00068 { 00069 QListIterator<IndexIntf> li(m_intfs); 00070 for (li.toFirst();li.current();++li) (li.current()->*methodPtr)(a1,a2,a3,a4,a5,a6); 00071 } 00072 00073 public: 00074 IndexList() { m_intfs.setAutoDelete(TRUE); } 00075 void addIndex(IndexIntf *intf) 00076 { m_intfs.append(intf); } 00077 void initialize() 00078 { foreach(&IndexIntf::initialize); } 00079 void finalize() 00080 { foreach(&IndexIntf::finalize); } 00081 void incContentsDepth() 00082 { foreach(&IndexIntf::incContentsDepth); } 00083 void decContentsDepth() 00084 { foreach(&IndexIntf::decContentsDepth); } 00085 void addContentsItem(bool isDir, const char *name, const char *ref = 0, 00086 const char *file = 0, const char *anchor = 0) 00087 { foreach<bool,const char *,const char *,const char *,const char*> 00088 (&IndexIntf::addContentsItem,isDir,name,ref,file,anchor); } 00089 void addIndexItem(const char *level1, const char *level2, const char *contRef, 00090 const char *memRef, const char *anchor,const MemberDef *md) 00091 { foreach<const char *,const char *,const char *,const char *,const char *,const MemberDef *> 00092 (&IndexIntf::addIndexItem,level1,level2,contRef,memRef,anchor,md); } 00093 void addIndexFile(const char *name) 00094 { foreach<const char *>(&IndexIntf::addIndexFile,name); } 00095 00096 }; 00097 00098 00099 enum IndexSections 00100 { 00101 isTitlePageStart, 00102 isTitlePageAuthor, 00103 isMainPage, 00104 isModuleIndex, 00105 isDirIndex, 00106 isNamespaceIndex, 00107 isClassHierarchyIndex, 00108 isCompoundIndex, 00109 isFileIndex, 00110 isPageIndex, 00111 isModuleDocumentation, 00112 isDirDocumentation, 00113 isNamespaceDocumentation, 00114 isClassDocumentation, 00115 isFileDocumentation, 00116 isExampleDocumentation, 00117 isPageDocumentation, 00118 isEndIndex 00119 }; 00120 00121 enum HighlightedItem 00122 { 00123 HLI_None=0, 00124 HLI_Main, 00125 HLI_Modules, 00126 HLI_Directories, 00127 HLI_Namespaces, 00128 HLI_Hierarchy, 00129 HLI_Classes, 00130 HLI_Annotated, 00131 HLI_Files, 00132 HLI_NamespaceMembers, 00133 HLI_Functions, 00134 HLI_Globals, 00135 HLI_Pages, 00136 HLI_Examples, 00137 HLI_Search, 00138 00139 HLI_ClassVisible, 00140 HLI_NamespaceVisible, 00141 HLI_FileVisible 00142 }; 00143 00144 enum ClassMemberHighlight 00145 { 00146 CMHL_All = 0, 00147 CMHL_Functions, 00148 CMHL_Variables, 00149 CMHL_Typedefs, 00150 CMHL_Enums, 00151 CMHL_EnumValues, 00152 CMHL_Properties, 00153 CMHL_Events, 00154 CMHL_Related, 00155 CMHL_Total = CMHL_Related+1 00156 }; 00157 00158 enum FileMemberHighlight 00159 { 00160 FMHL_All = 0, 00161 FMHL_Functions, 00162 FMHL_Variables, 00163 FMHL_Typedefs, 00164 FMHL_Enums, 00165 FMHL_EnumValues, 00166 FMHL_Defines, 00167 FMHL_Total = FMHL_Defines+1 00168 }; 00169 00170 enum NamespaceMemberHighlight 00171 { 00172 NMHL_All = 0, 00173 NMHL_Functions, 00174 NMHL_Variables, 00175 NMHL_Typedefs, 00176 NMHL_Enums, 00177 NMHL_EnumValues, 00178 NMHL_Total = FMHL_EnumValues+1 00179 }; 00180 00181 enum ClassHighlight 00182 { 00183 CHL_All = 0, 00184 CHL_Classes, 00185 CHL_Structs, 00186 CHL_Unions, 00187 CHL_Interfaces, 00188 CHL_Protocols, 00189 CHL_Categories, 00190 CHL_Exceptions, 00191 CHL_Total = CHL_Exceptions+1 00192 }; 00193 00194 void writeIndex(OutputList &ol); 00195 void writeHierarchicalIndex(OutputList &ol); 00196 void writeAlphabeticalIndex(OutputList &ol); 00197 void writeClassHierarchy(OutputList &ol); 00198 void writeAnnotatedIndex(OutputList &ol); 00199 void writeAnnotatedClassList(OutputList &ol); 00200 void writeMemberList(OutputList &ol,bool useSections); 00201 void writeSourceIndex(OutputList &ol); 00202 void writeHeaderIndex(OutputList &ol); 00203 void writeHeaderFileList(OutputList &ol); 00204 void writeExampleIndex(OutputList &ol); 00205 void writePageIndex(OutputList &ol); 00206 void writeFileIndex(OutputList &ol); 00207 void writeNamespaceIndex(OutputList &ol); 00208 void writeGroupIndex(OutputList &ol); 00209 void writeDirIndex(OutputList &ol); 00210 void writePackageIndex(OutputList &ol); 00211 void writeClassMemberIndex(OutputList &ol); 00212 void writeFileMemberIndex(OutputList &ol); 00213 void writeNamespaceMemberIndex(OutputList &ol); 00214 void writeGraphicalClassHierarchy(OutputList &ol); 00215 void writeGraphInfo(OutputList &ol); 00216 00217 void countDataStructures(); 00218 00219 extern int annotatedClasses; 00220 extern int hierarchyClasses; 00221 extern int documentedFiles; 00222 extern int documentedGroups; 00223 extern int documentedNamespaces; 00224 extern int indexedPages; 00225 extern int documentedClassMembers[CMHL_Total]; 00226 extern int documentedFileMembers[FMHL_Total]; 00227 extern int documentedNamespaceMembers[NMHL_Total]; 00228 extern int documentedHtmlFiles; 00229 extern int documentedPages; 00230 extern int documentedDirs; 00231 00232 void startTitle(OutputList &ol,const char *fileName); 00233 void endTitle(OutputList &ol,const char *fileName,const char *name); 00234 void startFile(OutputList &ol,const char *name,const char *manName, 00235 const char *title,HighlightedItem hli=HLI_None, 00236 bool additionalIndices=FALSE); 00237 void endFile(OutputList &ol,bool external=FALSE); 00238 00239 void initClassMemberIndices(); 00240 void initFileMemberIndices(); 00241 void initNamespaceMemberIndices(); 00242 void addClassMemberNameToIndex(MemberDef *md); 00243 void addFileMemberNameToIndex(MemberDef *md); 00244 void addNamespaceMemberNameToIndex(MemberDef *md); 00245 00246 #endif