doxygen
index.h
1 /******************************************************************************
2  *
3  * Copyright (C) 1997-2021 by Dimitri van Heesch.
4  *
5  * Permission to use, copy, modify, and distribute this software and its
6  * documentation under the terms of the GNU General Public License is hereby
7  * granted. No representations are made about the suitability of this software
8  * for any purpose. It is provided "as is" without express or implied warranty.
9  * See the GNU General Public License for more details.
10  *
11  * Documents produced by Doxygen are derivative works derived from the
12  * input used in their production; they are not affected by this license.
13  *
14  */
15 
16 #ifndef INDEX_H
17 #define INDEX_H
18 
19 #include <memory>
20 #include <vector>
21 #include <map>
22 #include "qcstring.h"
23 
24 class Definition;
25 class OutputList;
26 class DefinitionMutable;
27 class NamespaceDef;
28 class MemberDef;
29 
30 enum class IndexSection
31 {
32  isTitlePageStart,
33  isTitlePageAuthor,
34  isMainPage,
35  isModuleIndex,
36  isTopicIndex,
37  isDirIndex,
38  isNamespaceIndex,
39  isConceptIndex,
40  isClassHierarchyIndex,
41  isCompoundIndex,
42  isFileIndex,
43  isPageIndex,
44  isModuleDocumentation,
45  isTopicDocumentation,
46  isDirDocumentation,
47  isNamespaceDocumentation,
48  isClassDocumentation,
49  isConceptDocumentation,
50  isFileDocumentation,
51  isExampleDocumentation,
52  isPageDocumentation,
53  isPageDocumentation2,
54  isEndIndex
55 };
56 
57 enum class HighlightedItem
58 {
59  None=0,
60  Main,
61  Modules,
62  Namespaces,
63  Topics,
64  ClassHierarchy,
65  InterfaceHierarchy,
66  ExceptionHierarchy,
67  Classes,
68  Concepts,
69  Interfaces,
70  Structs,
71  Exceptions,
72  AnnotatedClasses,
73  AnnotatedInterfaces,
74  AnnotatedStructs,
75  AnnotatedExceptions,
76  Files,
77  NamespaceMembers,
78  ModuleMembers,
79  Functions,
80  Globals,
81  Pages,
82  Examples,
83  Search,
84  UserGroup,
85 
86  ClassVisible,
87  ConceptVisible,
88  InterfaceVisible,
89  StructVisible,
90  ExceptionVisible,
91  NamespaceVisible,
92  FileVisible,
93  ModuleVisible
94 };
95 
96 // Note: we can't use enum class for the enums below as they are also used as an array index,
97 // so we wrap them in a namespace instead
98 
99 namespace ClassMemberHighlight
100 {
101  enum Enum : int
102  {
103  All = 0,
104  Functions,
105  Variables,
106  Typedefs,
107  Enums,
108  EnumValues,
109  Properties,
110  Events,
111  Related,
112  Total
113  };
114 } // namespace ClassMemberHighlight
115 
116 namespace FileMemberHighlight
117 {
118  enum Enum : int
119  {
120  All = 0,
121  Functions,
122  Variables,
123  Typedefs,
124  Sequences,
125  Dictionaries,
126  Enums,
127  EnumValues,
128  Defines,
129  Total
130  };
131 } // namespace FileMemberHighlight
132 
133 namespace NamespaceMemberHighlight
134 {
135  enum Enum : int
136  {
137  All = 0,
138  Functions,
139  Variables,
140  Typedefs,
141  Sequences,
142  Dictionaries,
143  Enums,
144  EnumValues,
145  Total
146  };
147 } // namespace NamespaceMemberHighlight
148 
149 namespace ModuleMemberHighlight
150 {
151  enum Enum : int
152  {
153  All = 0,
154  Functions,
155  Variables,
156  Typedefs,
157  Enums,
158  EnumValues,
159  Total
160  };
161 } // namespace ModuleMemberHighlight
162 
163 class Index
164 {
165  public:
166  using MemberIndexList = std::vector<const MemberDef *>;
167  using MemberIndexMap = std::map<std::string,MemberIndexList>;
168 
169  static Index &instance();
170 
171  void countDataStructures();
172  void addClassMemberNameToIndex(const MemberDef *md);
173  void addFileMemberNameToIndex(const MemberDef *md);
174  void addNamespaceMemberNameToIndex(const MemberDef *md);
175  void addModuleMemberNameToIndex(const MemberDef *md);
176  void sortMemberIndexLists();
177 
178  // ---- getters
179  int numAnnotatedClasses() const;
180  int numAnnotatedClassesPrinted() const;
181  int numHierarchyClasses() const;
182  int numAnnotatedInterfaces() const;
183  int numAnnotatedInterfacesPrinted() const;
184  int numHierarchyInterfaces() const;
185  int numAnnotatedStructs() const;
186  int numAnnotatedStructsPrinted() const;
187  int numAnnotatedExceptions() const;
188  int numAnnotatedExceptionsPrinted() const;
189  int numHierarchyExceptions() const;
190  int numDocumentedGroups() const;
191  int numDocumentedNamespaces() const;
192  int numDocumentedConcepts() const;
193  int numDocumentedModules() const;
194  int numIndexedPages() const;
195  int numDocumentedFiles() const;
196  int numDocumentedPages() const;
197  int numDocumentedDirs() const;
198  int numDocumentedClassMembers(ClassMemberHighlight::Enum e) const;
199  int numDocumentedFileMembers(FileMemberHighlight::Enum e) const;
200  int numDocumentedNamespaceMembers(NamespaceMemberHighlight::Enum e) const;
201  int numDocumentedModuleMembers(ModuleMemberHighlight::Enum e) const;
202  MemberIndexMap isClassIndexLetterUsed(ClassMemberHighlight::Enum e) const;
203  MemberIndexMap isFileIndexLetterUsed(FileMemberHighlight::Enum e) const;
204  MemberIndexMap isNamespaceIndexLetterUsed(NamespaceMemberHighlight::Enum e) const;
205  MemberIndexMap isModuleIndexLetterUsed(ModuleMemberHighlight::Enum e) const;
206 
207  private:
208  void resetDocumentedClassMembers(int i);
209  void resetDocumentedFileMembers(int i);
210  void resetDocumentedNamespaceMembers(int i);
211  void resetDocumentedModuleMembers(int i);
212  void incrementDocumentedClassMembers(int i,const std::string &letter,const MemberDef *md);
213  void incrementDocumentedFileMembers(int i,const std::string &letter,const MemberDef *md);
214  void incrementDocumentedNamespaceMembers(int i,const std::string &letter,const MemberDef *md);
215  void incrementDocumentedModuleMembers(int i,const std::string &letter,const MemberDef *md);
216  Index();
217  ~Index();
218  struct Private;
219  std::unique_ptr<Private> p;
220 };
221 
222 void writeGraphInfo(OutputList &ol);
223 void writeIndexHierarchy(OutputList &ol);
224 void startTitle(OutputList &ol,const QCString &fileName,const DefinitionMutable *def=nullptr);
225 void endTitle(OutputList &ol,const QCString &fileName,const QCString &name);
226 void startFile(OutputList &ol,const QCString &name,const QCString &manName,
227  const QCString &title,HighlightedItem hli=HighlightedItem::None,
228  bool additionalIndices=FALSE,const QCString &altSidebarName=QCString(), int hierarchyLevel=0);
229 void endFile(OutputList &ol,bool skipNavIndex=FALSE,bool skipEndContents=FALSE,
230  const QCString &navPath=QCString());
231 void endFileWithNavPath(OutputList &ol,const Definition *d);
232 
233 #endif
Definition: index.cpp:68
The common base class of all entity definitions found in the sources.
Definition: definition.h:74
An abstract interface of a namespace symbol.
Definition: namespacedef.h:54
A model of a class/file/namespace member symbol.
Definition: memberdef.h:47
Definition: index.h:133
Definition: definition.h:305
Definition: index.h:99
Definition: index.h:116
Definition: index.h:149
Definition: index.h:163
Class representing a list of output generators that are written to in parallel.
Definition: outputlist.h:530
This is an alternative implementation of QCString.
Definition: qcstring.h:93