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 <utility>
20 #include <vector>
21 #include <memory>
22 
23 #include "qcstring.h"
24 
25 class Definition;
26 class DefinitionMutable;
27 class NamespaceDef;
28 class MemberDef;
29 class OutputList;
30 
31 /** \brief Abstract interface for index generators. */
32 class IndexIntf
33 {
34  public:
35  virtual ~IndexIntf() {}
36  virtual void initialize() = 0;
37  virtual void finalize() = 0;
38  virtual void incContentsDepth() = 0;
39  virtual void decContentsDepth() = 0;
40  virtual void addContentsItem(bool isDir, const QCString &name, const QCString &ref,
41  const QCString &file, const QCString &anchor, bool separateIndex,
42  bool addToNavIndex,const Definition *def) = 0;
43  virtual void addIndexItem(const Definition *context,const MemberDef *md,
44  const QCString &sectionAnchor,const QCString &title) = 0;
45  virtual void addIndexFile(const QCString &name) = 0;
46  virtual void addImageFile(const QCString &name) = 0;
47  virtual void addStyleSheetFile(const QCString &name) = 0;
48 };
49 
50 /** \brief A list of index interfaces.
51  *
52  * This class itself implements all methods of IndexIntf and
53  * just forwards the calls to all items in the list.
54  */
55 class IndexList : public IndexIntf
56 {
57  private:
58  std::vector< std::unique_ptr<IndexIntf> > m_intfs;
59 
60  // For each index format we forward the method call.
61  // We use C++11 variadic templates and perfect forwarding to implement foreach() generically,
62  // and split the types of the methods from the arguments passed to allow implicit conversions.
63  template<class... Ts,class... As>
64  void foreach(void (IndexIntf::*methodPtr)(Ts...),As&&... args)
65  {
66  for (const auto &intf : m_intfs)
67  {
68  (intf.get()->*methodPtr)(std::forward<As>(args)...);
69  }
70  }
71 
72  public:
73  /** Creates a list of indexes */
75 
76  /** Add an index generator to the list, using a syntax similar to std::make_unique<T>() */
77  template<class T,class... As>
78  void addIndex(As&&... args)
79  { m_intfs.push_back(std::make_unique<T>(std::forward<As>(args)...)); }
80 
81  void disable()
82  { m_enabled = FALSE; }
83  void enable()
84  { m_enabled = TRUE; }
85  bool isEnabled() const
86  { return m_enabled; }
87 
88  // IndexIntf implementation
89  void initialize()
90  { foreach(&IndexIntf::initialize); }
91  void finalize()
92  { foreach(&IndexIntf::finalize); }
94  { if (m_enabled) foreach(&IndexIntf::incContentsDepth); }
96  { if (m_enabled) foreach(&IndexIntf::decContentsDepth); }
97  void addContentsItem(bool isDir, const QCString &name, const QCString &ref,
98  const QCString &file, const QCString &anchor,bool separateIndex=FALSE,bool addToNavIndex=FALSE,
99  const Definition *def=0)
100  { if (m_enabled) foreach(&IndexIntf::addContentsItem,isDir,name,ref,file,anchor,separateIndex,addToNavIndex,def); }
101  void addIndexItem(const Definition *context,const MemberDef *md,const QCString &sectionAnchor=QCString(),const QCString &title=QCString())
102  { if (m_enabled) foreach(&IndexIntf::addIndexItem,context,md,sectionAnchor,title); }
103  void addIndexFile(const QCString &name)
104  { if (m_enabled) foreach(&IndexIntf::addIndexFile,name); }
105  void addImageFile(const QCString &name)
106  { if (m_enabled) foreach(&IndexIntf::addImageFile,name); }
107  void addStyleSheetFile(const QCString &name)
108  { if (m_enabled) foreach(&IndexIntf::addStyleSheetFile,name); }
109 
110  private:
111  bool m_enabled;
112 };
113 
114 
116 {
138 };
139 
141 {
145  //HLI_Directories,
167 
175 };
176 
178 {
179  CMHL_All = 0,
189 };
190 
192 {
193  FMHL_All = 0,
203 };
204 
206 {
207  NMHL_All = 0,
216 };
217 
219 {
220  CHL_All = 0,
229 };
230 
231 void writeGraphInfo(OutputList &ol);
233 
234 void countDataStructures();
235 
236 extern int annotatedClasses;
237 extern int annotatedInterfaces;
238 extern int annotatedStructs;
239 extern int annotatedExceptions;
240 extern int hierarchyClasses;
241 extern int hierarchyInterfaces;
242 extern int hierarchyExceptions;
243 extern int documentedFiles;
244 extern int documentedGroups;
245 extern int documentedNamespaces;
246 extern int documentedConcepts;
247 extern int indexedPages;
251 extern int documentedDirs;
252 extern int documentedPages;
253 
254 void startTitle(OutputList &ol,const QCString &fileName,const DefinitionMutable *def=0);
255 void endTitle(OutputList &ol,const QCString &fileName,const QCString &name);
256 void startFile(OutputList &ol,const QCString &name,const QCString &manName,
257  const QCString &title,HighlightedItem hli=HLI_None,
258  bool additionalIndices=FALSE,const QCString &altSidebarName=QCString());
259 void endFile(OutputList &ol,bool skipNavIndex=FALSE,bool skipEndContents=FALSE,
260  const QCString &navPath=QCString());
261 void endFileWithNavPath(const Definition *d,OutputList &ol);
262 
264 void initFileMemberIndices();
266 void addClassMemberNameToIndex(const MemberDef *md);
267 void addFileMemberNameToIndex(const MemberDef *md);
269 void sortMemberIndexLists();
270 QCString fixSpaces(const QCString &s);
271 
272 int countVisibleMembers(const NamespaceDef *nd);
273 
274 #endif
isExampleDocumentation
@ isExampleDocumentation
Definition: index.h:134
initClassMemberIndices
void initClassMemberIndices()
Definition: index.cpp:2649
documentedFileMembers
int documentedFileMembers[FMHL_Total]
Definition: index.cpp:72
IndexList::m_intfs
std::vector< std::unique_ptr< IndexIntf > > m_intfs
Definition: index.h:58
isDirDocumentation
@ isDirDocumentation
Definition: index.h:129
HLI_Functions
@ HLI_Functions
Definition: index.h:161
HLI_Classes
@ HLI_Classes
Definition: index.h:150
isNamespaceIndex
@ isNamespaceIndex
Definition: index.h:122
NamespaceMemberHighlight
NamespaceMemberHighlight
Definition: index.h:205
CMHL_EnumValues
@ CMHL_EnumValues
Definition: index.h:184
CMHL_Functions
@ CMHL_Functions
Definition: index.h:180
Definition
The common base class of all entity definitions found in the sources.
Definition: definition.h:76
NamespaceDef
An abstract interface of a namespace symbol.
Definition: namespacedef.h:54
initFileMemberIndices
void initFileMemberIndices()
Definition: index.cpp:2801
HLI_Modules
@ HLI_Modules
Definition: index.h:144
endFile
void endFile(OutputList &ol, bool skipNavIndex=FALSE, bool skipEndContents=FALSE, const QCString &navPath=QCString())
Definition: index.cpp:254
HLI_AnnotatedStructs
@ HLI_AnnotatedStructs
Definition: index.h:157
isFileIndex
@ isFileIndex
Definition: index.h:126
HLI_InterfaceHierarchy
@ HLI_InterfaceHierarchy
Definition: index.h:148
isCompoundIndex
@ isCompoundIndex
Definition: index.h:125
isTitlePageStart
@ isTitlePageStart
Definition: index.h:117
startFile
void startFile(OutputList &ol, const QCString &name, const QCString &manName, const QCString &title, HighlightedItem hli=HLI_None, bool additionalIndices=FALSE, const QCString &altSidebarName=QCString())
Definition: index.cpp:235
addClassMemberNameToIndex
void addClassMemberNameToIndex(const MemberDef *md)
Definition: index.cpp:2659
HLI_InterfaceVisible
@ HLI_InterfaceVisible
Definition: index.h:170
isPageIndex
@ isPageIndex
Definition: index.h:127
IndexIntf::initialize
virtual void initialize()=0
CHL_Structs
@ CHL_Structs
Definition: index.h:222
IndexList::addStyleSheetFile
void addStyleSheetFile(const QCString &name)
Definition: index.h:107
IndexIntf::addImageFile
virtual void addImageFile(const QCString &name)=0
IndexList::decContentsDepth
void decContentsDepth()
Definition: index.h:95
endTitle
void endTitle(OutputList &ol, const QCString &fileName, const QCString &name)
Definition: index.cpp:228
IndexIntf::addIndexFile
virtual void addIndexFile(const QCString &name)=0
ClassHighlight
ClassHighlight
Definition: index.h:218
CMHL_Typedefs
@ CMHL_Typedefs
Definition: index.h:182
HLI_UserGroup
@ HLI_UserGroup
Definition: index.h:166
IndexList::addIndexItem
void addIndexItem(const Definition *context, const MemberDef *md, const QCString &sectionAnchor=QCString(), const QCString &title=QCString())
Definition: index.h:101
HLI_Globals
@ HLI_Globals
Definition: index.h:162
sortMemberIndexLists
void sortMemberIndexLists()
Definition: index.cpp:2887
IndexList::addIndex
void addIndex(As &&... args)
Add an index generator to the list, using a syntax similar to std::make_unique<T>()
Definition: index.h:78
documentedNamespaceMembers
int documentedNamespaceMembers[NMHL_Total]
Definition: index.cpp:73
isClassDocumentation
@ isClassDocumentation
Definition: index.h:131
isModuleDocumentation
@ isModuleDocumentation
Definition: index.h:128
HLI_Examples
@ HLI_Examples
Definition: index.h:164
isConceptIndex
@ isConceptIndex
Definition: index.h:123
addFileMemberNameToIndex
void addFileMemberNameToIndex(const MemberDef *md)
Definition: index.cpp:2811
IndexList::m_enabled
bool m_enabled
Definition: index.h:111
qcstring.h
FMHL_All
@ FMHL_All
Definition: index.h:193
countDataStructures
void countDataStructures()
Definition: index.cpp:87
CMHL_Enums
@ CMHL_Enums
Definition: index.h:183
HLI_AnnotatedExceptions
@ HLI_AnnotatedExceptions
Definition: index.h:158
CHL_Categories
@ CHL_Categories
Definition: index.h:226
HLI_AnnotatedClasses
@ HLI_AnnotatedClasses
Definition: index.h:155
HLI_ClassHierarchy
@ HLI_ClassHierarchy
Definition: index.h:147
HLI_Files
@ HLI_Files
Definition: index.h:159
IndexIntf::addStyleSheetFile
virtual void addStyleSheetFile(const QCString &name)=0
HLI_Concepts
@ HLI_Concepts
Definition: index.h:151
initNamespaceMemberIndices
void initNamespaceMemberIndices()
Definition: index.cpp:2733
writeGraphInfo
void writeGraphInfo(OutputList &ol)
Definition: index.cpp:3686
annotatedExceptions
int annotatedExceptions
Definition: index.cpp:64
CHL_Interfaces
@ CHL_Interfaces
Definition: index.h:224
OutputList
Class representing a list of output generators that are written to in parallel.
Definition: outputlist.h:37
hierarchyExceptions
int hierarchyExceptions
Definition: index.cpp:66
HLI_Search
@ HLI_Search
Definition: index.h:165
MemberDef
A model of a class/file/namespace member symbol.
Definition: memberdef.h:45
isNamespaceDocumentation
@ isNamespaceDocumentation
Definition: index.h:130
FMHL_Dictionaries
@ FMHL_Dictionaries
Definition: index.h:198
NMHL_Functions
@ NMHL_Functions
Definition: index.h:208
isDirIndex
@ isDirIndex
Definition: index.h:121
annotatedClasses
int annotatedClasses
Definition: index.cpp:56
FMHL_Defines
@ FMHL_Defines
Definition: index.h:201
IndexList::addContentsItem
void addContentsItem(bool isDir, const QCString &name, const QCString &ref, const QCString &file, const QCString &anchor, bool separateIndex=FALSE, bool addToNavIndex=FALSE, const Definition *def=0)
Definition: index.h:97
NMHL_EnumValues
@ NMHL_EnumValues
Definition: index.h:214
isEndIndex
@ isEndIndex
Definition: index.h:137
IndexList::addImageFile
void addImageFile(const QCString &name)
Definition: index.h:105
hierarchyClasses
int hierarchyClasses
Definition: index.cpp:58
DefinitionMutable
Definition: definition.h:308
NMHL_Dictionaries
@ NMHL_Dictionaries
Definition: index.h:212
IndexIntf::~IndexIntf
virtual ~IndexIntf()
Definition: index.h:35
CHL_Classes
@ CHL_Classes
Definition: index.h:221
documentedNamespaces
int documentedNamespaces
Definition: index.cpp:68
HLI_Namespaces
@ HLI_Namespaces
Definition: index.h:146
IndexList::finalize
void finalize()
Definition: index.h:91
IndexList
A list of index interfaces.
Definition: index.h:55
documentedDirs
int documentedDirs
Definition: index.cpp:76
NMHL_Sequences
@ NMHL_Sequences
Definition: index.h:211
documentedFiles
int documentedFiles
Definition: index.cpp:74
HLI_ConceptVisible
@ HLI_ConceptVisible
Definition: index.h:169
IndexList::incContentsDepth
void incContentsDepth()
Definition: index.h:93
IndexIntf::finalize
virtual void finalize()=0
countVisibleMembers
int countVisibleMembers(const NamespaceDef *nd)
Definition: index.cpp:1591
NMHL_Variables
@ NMHL_Variables
Definition: index.h:209
TRUE
#define TRUE
Definition: qcstring.h:36
IndexList::enable
void enable()
Definition: index.h:83
HLI_AnnotatedInterfaces
@ HLI_AnnotatedInterfaces
Definition: index.h:156
documentedGroups
int documentedGroups
Definition: index.cpp:67
HLI_ExceptionVisible
@ HLI_ExceptionVisible
Definition: index.h:172
isModuleIndex
@ isModuleIndex
Definition: index.h:120
HLI_Exceptions
@ HLI_Exceptions
Definition: index.h:154
documentedConcepts
int documentedConcepts
Definition: index.cpp:69
CMHL_Events
@ CMHL_Events
Definition: index.h:186
isClassHierarchyIndex
@ isClassHierarchyIndex
Definition: index.h:124
IndexList::addIndexFile
void addIndexFile(const QCString &name)
Definition: index.h:103
NMHL_Enums
@ NMHL_Enums
Definition: index.h:213
CHL_Unions
@ CHL_Unions
Definition: index.h:223
IndexList::initialize
void initialize()
Definition: index.h:89
NMHL_Typedefs
@ NMHL_Typedefs
Definition: index.h:210
FMHL_Variables
@ FMHL_Variables
Definition: index.h:195
CHL_All
@ CHL_All
Definition: index.h:220
HLI_FileVisible
@ HLI_FileVisible
Definition: index.h:174
HLI_NamespaceVisible
@ HLI_NamespaceVisible
Definition: index.h:173
CHL_Total
@ CHL_Total
Definition: index.h:228
writeIndexHierarchy
void writeIndexHierarchy(OutputList &ol)
Definition: index.cpp:5155
IndexIntf::addIndexItem
virtual void addIndexItem(const Definition *context, const MemberDef *md, const QCString &sectionAnchor, const QCString &title)=0
isTitlePageAuthor
@ isTitlePageAuthor
Definition: index.h:118
NMHL_All
@ NMHL_All
Definition: index.h:207
endFileWithNavPath
void endFileWithNavPath(const Definition *d, OutputList &ol)
Definition: index.cpp:274
FMHL_EnumValues
@ FMHL_EnumValues
Definition: index.h:200
FileMemberHighlight
FileMemberHighlight
Definition: index.h:191
isFileDocumentation
@ isFileDocumentation
Definition: index.h:133
startTitle
void startTitle(OutputList &ol, const QCString &fileName, const DefinitionMutable *def=0)
Definition: index.cpp:219
CMHL_Properties
@ CMHL_Properties
Definition: index.h:185
IndexIntf::addContentsItem
virtual void addContentsItem(bool isDir, const QCString &name, const QCString &ref, const QCString &file, const QCString &anchor, bool separateIndex, bool addToNavIndex, const Definition *def)=0
CHL_Protocols
@ CHL_Protocols
Definition: index.h:225
NMHL_Total
@ NMHL_Total
Definition: index.h:215
IndexSections
IndexSections
Definition: index.h:115
CMHL_Variables
@ CMHL_Variables
Definition: index.h:181
isPageDocumentation
@ isPageDocumentation
Definition: index.h:135
isPageDocumentation2
@ isPageDocumentation2
Definition: index.h:136
isMainPage
@ isMainPage
Definition: index.h:119
FMHL_Typedefs
@ FMHL_Typedefs
Definition: index.h:196
HLI_ClassVisible
@ HLI_ClassVisible
Definition: index.h:168
CMHL_Related
@ CMHL_Related
Definition: index.h:187
CHL_Exceptions
@ CHL_Exceptions
Definition: index.h:227
HLI_Main
@ HLI_Main
Definition: index.h:143
annotatedStructs
int annotatedStructs
Definition: index.cpp:62
FMHL_Enums
@ FMHL_Enums
Definition: index.h:199
HLI_NamespaceMembers
@ HLI_NamespaceMembers
Definition: index.h:160
HLI_Structs
@ HLI_Structs
Definition: index.h:153
IndexIntf::decContentsDepth
virtual void decContentsDepth()=0
ClassMemberHighlight
ClassMemberHighlight
Definition: index.h:177
hierarchyInterfaces
int hierarchyInterfaces
Definition: index.cpp:61
HLI_Interfaces
@ HLI_Interfaces
Definition: index.h:152
IndexList::disable
void disable()
Definition: index.h:81
HLI_ExceptionHierarchy
@ HLI_ExceptionHierarchy
Definition: index.h:149
IndexIntf::incContentsDepth
virtual void incContentsDepth()=0
FMHL_Total
@ FMHL_Total
Definition: index.h:202
fixSpaces
QCString fixSpaces(const QCString &s)
Definition: index.cpp:214
FMHL_Functions
@ FMHL_Functions
Definition: index.h:194
HLI_None
@ HLI_None
Definition: index.h:142
IndexList::isEnabled
bool isEnabled() const
Definition: index.h:85
FMHL_Sequences
@ FMHL_Sequences
Definition: index.h:197
documentedPages
int documentedPages
Definition: index.cpp:75
HLI_StructVisible
@ HLI_StructVisible
Definition: index.h:171
IndexList::IndexList
IndexList()
Creates a list of indexes
Definition: index.h:74
HLI_Pages
@ HLI_Pages
Definition: index.h:163
IndexIntf
Abstract interface for index generators.
Definition: index.h:32
HighlightedItem
HighlightedItem
Definition: index.h:140
CMHL_Total
@ CMHL_Total
Definition: index.h:188
indexedPages
int indexedPages
Definition: index.cpp:70
CMHL_All
@ CMHL_All
Definition: index.h:179
documentedClassMembers
int documentedClassMembers[CMHL_Total]
Definition: index.cpp:71
annotatedInterfaces
int annotatedInterfaces
Definition: index.cpp:59
addNamespaceMemberNameToIndex
void addNamespaceMemberNameToIndex(const MemberDef *md)
Definition: index.cpp:2743
FALSE
#define FALSE
Definition: qcstring.h:33
isConceptDocumentation
@ isConceptDocumentation
Definition: index.h:132
QCString
This is an alternative implementation of QCString.
Definition: qcstring.h:108