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  isDirIndex,
37  isNamespaceIndex,
38  isConceptIndex,
39  isClassHierarchyIndex,
40  isCompoundIndex,
41  isFileIndex,
42  isPageIndex,
43  isModuleDocumentation,
44  isDirDocumentation,
45  isNamespaceDocumentation,
46  isClassDocumentation,
47  isConceptDocumentation,
48  isFileDocumentation,
49  isExampleDocumentation,
50  isPageDocumentation,
51  isPageDocumentation2,
52  isEndIndex
53 };
54 
55 enum class HighlightedItem
56 {
57  None=0,
58  Main,
59  Modules,
60  Namespaces,
61  ClassHierarchy,
62  InterfaceHierarchy,
63  ExceptionHierarchy,
64  Classes,
65  Concepts,
66  Interfaces,
67  Structs,
68  Exceptions,
69  AnnotatedClasses,
70  AnnotatedInterfaces,
71  AnnotatedStructs,
72  AnnotatedExceptions,
73  Files,
74  NamespaceMembers,
75  Functions,
76  Globals,
77  Pages,
78  Examples,
79  Search,
80  UserGroup,
81 
82  ClassVisible,
83  ConceptVisible,
84  InterfaceVisible,
85  StructVisible,
86  ExceptionVisible,
87  NamespaceVisible,
88  FileVisible
89 };
90 
91 // Note: we can't use enum class for the enums below as they are also used as an array index,
92 // so we wrap them in a namespace instead
93 
94 namespace ClassMemberHighlight
95 {
96  enum Enum : int
97  {
98  All = 0,
99  Functions,
100  Variables,
101  Typedefs,
102  Enums,
103  EnumValues,
104  Properties,
105  Events,
106  Related,
107  Total
108  };
109 } // namespace ClassMemberHighlight
110 
111 namespace FileMemberHighlight
112 {
113  enum Enum : int
114  {
115  All = 0,
116  Functions,
117  Variables,
118  Typedefs,
119  Sequences,
120  Dictionaries,
121  Enums,
122  EnumValues,
123  Defines,
124  Total
125  };
126 } // namespace FileMemberHighlight
127 
128 namespace NamespaceMemberHighlight
129 {
130  enum Enum : int
131  {
132  All = 0,
133  Functions,
134  Variables,
135  Typedefs,
136  Sequences,
137  Dictionaries,
138  Enums,
139  EnumValues,
140  Total
141  };
142 } // namespace NamespaceMemberHighlight
143 
144 class Index
145 {
146  public:
147  using MemberIndexList = std::vector<const MemberDef *>;
148  using MemberIndexMap = std::map<std::string,MemberIndexList>;
149 
150  static Index &instance();
151 
152  void countDataStructures();
153  void addClassMemberNameToIndex(const MemberDef *md);
154  void addFileMemberNameToIndex(const MemberDef *md);
155  void addNamespaceMemberNameToIndex(const MemberDef *md);
156  void sortMemberIndexLists();
157 
158  // ---- getters
159  int numAnnotatedClasses() const;
160  int numAnnotatedClassesPrinted() const;
161  int numHierarchyClasses() const;
162  int numAnnotatedInterfaces() const;
163  int numAnnotatedInterfacesPrinted() const;
164  int numHierarchyInterfaces() const;
165  int numAnnotatedStructs() const;
166  int numAnnotatedStructsPrinted() const;
167  int numAnnotatedExceptions() const;
168  int numAnnotatedExceptionsPrinted() const;
169  int numHierarchyExceptions() const;
170  int numDocumentedGroups() const;
171  int numDocumentedNamespaces() const;
172  int numDocumentedConcepts() const;
173  int numIndexedPages() const;
174  int numDocumentedFiles() const;
175  int numDocumentedPages() const;
176  int numDocumentedDirs() const;
177  int numDocumentedClassMembers(ClassMemberHighlight::Enum e) const;
178  int numDocumentedFileMembers(FileMemberHighlight::Enum e) const;
179  int numDocumentedNamespaceMembers(NamespaceMemberHighlight::Enum e) const;
180  MemberIndexMap isClassIndexLetterUsed(ClassMemberHighlight::Enum e) const;
181  MemberIndexMap isFileIndexLetterUsed(FileMemberHighlight::Enum e) const;
182  MemberIndexMap isNamespaceIndexLetterUsed(NamespaceMemberHighlight::Enum e) const;
183 
184  private:
185  void resetDocumentedClassMembers(int i);
186  void resetDocumentedFileMembers(int i);
187  void resetDocumentedNamespaceMembers(int i);
188  void incrementDocumentedClassMembers(int i,const std::string &letter,const MemberDef *md);
189  void incrementDocumentedFileMembers(int i,const std::string &letter,const MemberDef *md);
190  void incrementDocumentedNamespaceMembers(int i,const std::string &letter,const MemberDef *md);
191  Index();
192  ~Index();
193  struct Private;
194  std::unique_ptr<Private> p;
195 };
196 
197 void writeGraphInfo(OutputList &ol);
198 void writeIndexHierarchy(OutputList &ol);
199 void startTitle(OutputList &ol,const QCString &fileName,const DefinitionMutable *def=0);
200 void endTitle(OutputList &ol,const QCString &fileName,const QCString &name);
201 void startFile(OutputList &ol,const QCString &name,const QCString &manName,
202  const QCString &title,HighlightedItem hli=HighlightedItem::None,
203  bool additionalIndices=FALSE,const QCString &altSidebarName=QCString(), int hierarchyLevel=0);
204 void endFile(OutputList &ol,bool skipNavIndex=FALSE,bool skipEndContents=FALSE,
205  const QCString &navPath=QCString());
206 void endFileWithNavPath(OutputList &ol,const Definition *d);
207 
208 #endif
Definition: index.cpp:67
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:55
A model of a class/file/namespace member symbol.
Definition: memberdef.h:45
Definition: index.h:128
Definition: definition.h:301
Definition: index.h:94
Definition: index.h:111
Definition: index.h:144
Class representing a list of output generators that are written to in parallel.
Definition: outputlist.h:463
This is an alternative implementation of QCString.
Definition: qcstring.h:92