Root/
Source at commit 1322 created 12 years 7 months ago. By meklort, Add doxygen to utils folder | |
---|---|
1 | /******************************************************************************␊ |
2 | *␊ |
3 | * $Id: index.h,v 1.28 2001/03/19 19:27:40 root Exp $␊ |
4 | *␊ |
5 | * Copyright (C) 1997-2011 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 INDEX_H␊ |
19 | #define INDEX_H␊ |
20 | ␊ |
21 | #include "qtbc.h"␊ |
22 | #include <qfile.h>␊ |
23 | #include <qlist.h>␊ |
24 | ␊ |
25 | class Definition;␊ |
26 | class MemberDef;␊ |
27 | class OutputList;␊ |
28 | class FTextStream;␊ |
29 | ␊ |
30 | /** \brief Abstract interface for index generators. */␊ |
31 | class IndexIntf␊ |
32 | {␊ |
33 | public:␊ |
34 | virtual ~IndexIntf() {}␊ |
35 | virtual void initialize() = 0;␊ |
36 | virtual void finalize() = 0;␊ |
37 | virtual void incContentsDepth() = 0;␊ |
38 | virtual void decContentsDepth() = 0;␊ |
39 | virtual void addContentsItem(bool isDir, const char *name, const char *ref = 0, ␊ |
40 | const char *file = 0, const char *anchor = 0) = 0;␊ |
41 | virtual void addIndexItem(Definition *context,MemberDef *md,const char *title) = 0;␊ |
42 | virtual void addIndexFile(const char *name) = 0;␊ |
43 | virtual void addImageFile(const char *name) = 0;␊ |
44 | virtual void addStyleSheetFile(const char *name) = 0;␊ |
45 | };␊ |
46 | ␊ |
47 | /** \brief A list of index interfaces.␊ |
48 | *␊ |
49 | * This class itself implements all methods of IndexIntf and␊ |
50 | * just forwards the calls to all items in the list.␊ |
51 | */␊ |
52 | class IndexList : public IndexIntf␊ |
53 | {␊ |
54 | private:␊ |
55 | QList<IndexIntf> m_intfs;␊ |
56 | ␊ |
57 | // --- foreach implementations for various number of arguments␊ |
58 | ␊ |
59 | void foreach(void (IndexIntf::*methodPtr)())␊ |
60 | {␊ |
61 | QListIterator<IndexIntf> li(m_intfs);␊ |
62 | for (li.toFirst();li.current();++li) (li.current()->*methodPtr)();␊ |
63 | }␊ |
64 | ␊ |
65 | template<typename A1>␊ |
66 | void foreach(void (IndexIntf::*methodPtr)(A1),A1 a1)␊ |
67 | {␊ |
68 | QListIterator<IndexIntf> li(m_intfs);␊ |
69 | for (li.toFirst();li.current();++li) (li.current()->*methodPtr)(a1);␊ |
70 | }␊ |
71 | ␊ |
72 | template<typename A1,typename A2,typename A3>␊ |
73 | void foreach(void (IndexIntf::*methodPtr)(A1,A2,A3),A1 a1,A2 a2,A3 a3)␊ |
74 | {␊ |
75 | QListIterator<IndexIntf> li(m_intfs);␊ |
76 | for (li.toFirst();li.current();++li) (li.current()->*methodPtr)(a1,a2,a3);␊ |
77 | }␊ |
78 | ␊ |
79 | template<typename A1,typename A2,typename A3,typename A4>␊ |
80 | void foreach(void (IndexIntf::*methodPtr)(A1,A2,A3,A4),A1 a1,A2 a2,A3 a3,A4 a4)␊ |
81 | {␊ |
82 | QListIterator<IndexIntf> li(m_intfs);␊ |
83 | for (li.toFirst();li.current();++li) (li.current()->*methodPtr)(a1,a2,a3,a4);␊ |
84 | }␊ |
85 | ␊ |
86 | template<typename A1,typename A2,typename A3,typename A4,typename A5>␊ |
87 | void foreach(void (IndexIntf::*methodPtr)(A1,A2,A3,A4,A5),A1 a1,A2 a2,A3 a3,A4 a4,A5 a5)␊ |
88 | {␊ |
89 | QListIterator<IndexIntf> li(m_intfs);␊ |
90 | for (li.toFirst();li.current();++li) (li.current()->*methodPtr)(a1,a2,a3,a4,a5);␊ |
91 | }␊ |
92 | ␊ |
93 | public:␊ |
94 | /** Creates a list of indexes */␊ |
95 | IndexList() { m_intfs.setAutoDelete(TRUE); }␊ |
96 | /** Add an index generator to the list */␊ |
97 | void addIndex(IndexIntf *intf) ␊ |
98 | { m_intfs.append(intf); }␊ |
99 | ␊ |
100 | // IndexIntf implementation␊ |
101 | void initialize() ␊ |
102 | { foreach(&IndexIntf::initialize); }␊ |
103 | void finalize() ␊ |
104 | { foreach(&IndexIntf::finalize); }␊ |
105 | void incContentsDepth()␊ |
106 | { foreach(&IndexIntf::incContentsDepth); }␊ |
107 | void decContentsDepth()␊ |
108 | { foreach(&IndexIntf::decContentsDepth); }␊ |
109 | void addContentsItem(bool isDir, const char *name, const char *ref = 0, ␊ |
110 | const char *file = 0, const char *anchor = 0)␊ |
111 | { foreach<bool,const char *,const char *,const char *,const char*>␊ |
112 | (&IndexIntf::addContentsItem,isDir,name,ref,file,anchor); }␊ |
113 | void addIndexItem(Definition *context,MemberDef *md,const char *title=0)␊ |
114 | { foreach<Definition *,MemberDef *>␊ |
115 | (&IndexIntf::addIndexItem,context,md,title); }␊ |
116 | void addIndexFile(const char *name) ␊ |
117 | { foreach<const char *>(&IndexIntf::addIndexFile,name); }␊ |
118 | void addImageFile(const char *name) ␊ |
119 | { foreach<const char *>(&IndexIntf::addImageFile,name); }␊ |
120 | void addStyleSheetFile(const char *name) ␊ |
121 | { foreach<const char *>(&IndexIntf::addStyleSheetFile,name); }␊ |
122 | ␊ |
123 | };␊ |
124 | ␊ |
125 | ␊ |
126 | enum IndexSections␊ |
127 | {␊ |
128 | isTitlePageStart,␊ |
129 | isTitlePageAuthor,␊ |
130 | isMainPage,␊ |
131 | isModuleIndex,␊ |
132 | isDirIndex,␊ |
133 | isNamespaceIndex,␊ |
134 | isClassHierarchyIndex,␊ |
135 | isCompoundIndex,␊ |
136 | isFileIndex,␊ |
137 | isPageIndex,␊ |
138 | isModuleDocumentation,␊ |
139 | isDirDocumentation,␊ |
140 | isNamespaceDocumentation,␊ |
141 | isClassDocumentation,␊ |
142 | isFileDocumentation,␊ |
143 | isExampleDocumentation,␊ |
144 | isPageDocumentation,␊ |
145 | isPageDocumentation2,␊ |
146 | isEndIndex␊ |
147 | };␊ |
148 | ␊ |
149 | enum HighlightedItem␊ |
150 | {␊ |
151 | HLI_None=0,␊ |
152 | HLI_Main,␊ |
153 | HLI_Modules,␊ |
154 | HLI_Directories,␊ |
155 | HLI_Namespaces,␊ |
156 | HLI_Hierarchy,␊ |
157 | HLI_Classes,␊ |
158 | HLI_Annotated,␊ |
159 | HLI_Files,␊ |
160 | HLI_NamespaceMembers,␊ |
161 | HLI_Functions,␊ |
162 | HLI_Globals,␊ |
163 | HLI_Pages,␊ |
164 | HLI_Examples,␊ |
165 | HLI_Search,␊ |
166 | ␊ |
167 | HLI_ClassVisible,␊ |
168 | HLI_NamespaceVisible,␊ |
169 | HLI_FileVisible␊ |
170 | };␊ |
171 | ␊ |
172 | enum ClassMemberHighlight␊ |
173 | {␊ |
174 | CMHL_All = 0,␊ |
175 | CMHL_Functions,␊ |
176 | CMHL_Variables,␊ |
177 | CMHL_Typedefs,␊ |
178 | CMHL_Enums,␊ |
179 | CMHL_EnumValues,␊ |
180 | CMHL_Properties,␊ |
181 | CMHL_Events,␊ |
182 | CMHL_Related,␊ |
183 | CMHL_Total = CMHL_Related+1␊ |
184 | };␊ |
185 | ␊ |
186 | enum FileMemberHighlight␊ |
187 | {␊ |
188 | FMHL_All = 0,␊ |
189 | FMHL_Functions,␊ |
190 | FMHL_Variables,␊ |
191 | FMHL_Typedefs,␊ |
192 | FMHL_Enums,␊ |
193 | FMHL_EnumValues,␊ |
194 | FMHL_Defines,␊ |
195 | FMHL_Total = FMHL_Defines+1␊ |
196 | };␊ |
197 | ␊ |
198 | enum NamespaceMemberHighlight␊ |
199 | {␊ |
200 | NMHL_All = 0,␊ |
201 | NMHL_Functions,␊ |
202 | NMHL_Variables,␊ |
203 | NMHL_Typedefs,␊ |
204 | NMHL_Enums,␊ |
205 | NMHL_EnumValues,␊ |
206 | NMHL_Total = NMHL_EnumValues+1␊ |
207 | };␊ |
208 | ␊ |
209 | enum ClassHighlight␊ |
210 | {␊ |
211 | CHL_All = 0,␊ |
212 | CHL_Classes,␊ |
213 | CHL_Structs,␊ |
214 | CHL_Unions,␊ |
215 | CHL_Interfaces,␊ |
216 | CHL_Protocols,␊ |
217 | CHL_Categories,␊ |
218 | CHL_Exceptions,␊ |
219 | CHL_Total = CHL_Exceptions+1␊ |
220 | };␊ |
221 | ␊ |
222 | void writeIndex(OutputList &ol);␊ |
223 | void writeHierarchicalIndex(OutputList &ol);␊ |
224 | void writeAlphabeticalIndex(OutputList &ol);␊ |
225 | void writeClassHierarchy(OutputList &ol);␊ |
226 | void writeAnnotatedIndex(OutputList &ol);␊ |
227 | void writeAnnotatedClassList(OutputList &ol);␊ |
228 | void writeMemberList(OutputList &ol,bool useSections);␊ |
229 | void writeSourceIndex(OutputList &ol);␊ |
230 | void writeHeaderIndex(OutputList &ol);␊ |
231 | void writeHeaderFileList(OutputList &ol);␊ |
232 | void writeExampleIndex(OutputList &ol);␊ |
233 | void writePageIndex(OutputList &ol);␊ |
234 | void writeFileIndex(OutputList &ol);␊ |
235 | void writeNamespaceIndex(OutputList &ol);␊ |
236 | void writeGroupIndex(OutputList &ol);␊ |
237 | void writeDirIndex(OutputList &ol);␊ |
238 | void writePackageIndex(OutputList &ol);␊ |
239 | void writeClassMemberIndex(OutputList &ol);␊ |
240 | void writeFileMemberIndex(OutputList &ol);␊ |
241 | void writeNamespaceMemberIndex(OutputList &ol);␊ |
242 | void writeGraphicalClassHierarchy(OutputList &ol);␊ |
243 | void writeGraphInfo(OutputList &ol);␊ |
244 | ␊ |
245 | void countDataStructures();␊ |
246 | ␊ |
247 | extern int annotatedClasses;␊ |
248 | extern int hierarchyClasses;␊ |
249 | extern int documentedFiles;␊ |
250 | extern int documentedGroups;␊ |
251 | extern int documentedNamespaces;␊ |
252 | extern int indexedPages;␊ |
253 | extern int documentedClassMembers[CMHL_Total];␊ |
254 | extern int documentedFileMembers[FMHL_Total];␊ |
255 | extern int documentedNamespaceMembers[NMHL_Total];␊ |
256 | extern int documentedHtmlFiles;␊ |
257 | extern int documentedPages;␊ |
258 | extern int documentedDirs;␊ |
259 | ␊ |
260 | void startTitle(OutputList &ol,const char *fileName,Definition *def=0);␊ |
261 | void endTitle(OutputList &ol,const char *fileName,const char *name);␊ |
262 | void startFile(OutputList &ol,const char *name,const char *manName,␊ |
263 | const char *title,HighlightedItem hli=HLI_None,␊ |
264 | bool additionalIndices=FALSE,const char *altSidebarName=0);␊ |
265 | void endFile(OutputList &ol,bool skipNavIndex=FALSE);␊ |
266 | ␊ |
267 | void initClassMemberIndices();␊ |
268 | void initFileMemberIndices();␊ |
269 | void initNamespaceMemberIndices();␊ |
270 | void addClassMemberNameToIndex(MemberDef *md);␊ |
271 | void addFileMemberNameToIndex(MemberDef *md);␊ |
272 | void addNamespaceMemberNameToIndex(MemberDef *md);␊ |
273 | ␊ |
274 | // search engine␊ |
275 | void writeJavascriptSearchIndex();␊ |
276 | void writeSearchCategories(FTextStream &t);␊ |
277 | ␊ |
278 | #endif␊ |
279 |