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