index.h
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  *
4  *
5  * Copyright (C) 1997-2015 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 <qlist.h>
22 #include <qcstring.h>
23 
24 class Definition;
25 class MemberDef;
26 class OutputList;
27 class FTextStream;
28 
29 /** \brief Abstract interface for index generators. */
30 class IndexIntf
31 {
32  public:
33  virtual ~IndexIntf() {}
34  virtual void initialize() = 0;
35  virtual void finalize() = 0;
36  virtual void incContentsDepth() = 0;
37  virtual void decContentsDepth() = 0;
38  virtual void addContentsItem(bool isDir, const char *name, const char *ref,
39  const char *file, const char *anchor, bool separateIndex,
40  bool addToNavIndex,Definition *def) = 0;
41  virtual void addIndexItem(Definition *context,MemberDef *md,
42  const char *sectionAnchor,const char *title) = 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:
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>
74  void foreach(void (IndexIntf::*methodPtr)(A1,A2,A3),A1 a1,A2 a2,A3 a3)
75  {
76  QListIterator<IndexIntf> li(m_intfs);
77  for (li.toFirst();li.current();++li) (li.current()->*methodPtr)(a1,a2,a3);
78  }
79 
80  template<typename A1,typename A2,typename A3,typename A4>
81  void foreach(void (IndexIntf::*methodPtr)(A1,A2,A3,A4),A1 a1,A2 a2,A3 a3,A4 a4)
82  {
83  QListIterator<IndexIntf> li(m_intfs);
84  for (li.toFirst();li.current();++li) (li.current()->*methodPtr)(a1,a2,a3,a4);
85  }
86 
87  template<typename A1,typename A2,typename A3,typename A4,typename A5>
88  void foreach(void (IndexIntf::*methodPtr)(A1,A2,A3,A4,A5),A1 a1,A2 a2,A3 a3,A4 a4,A5 a5)
89  {
90  QListIterator<IndexIntf> li(m_intfs);
91  for (li.toFirst();li.current();++li) (li.current()->*methodPtr)(a1,a2,a3,a4,a5);
92  }
93 
94  template<typename A1,typename A2,typename A3,typename A4,typename A5,typename A6>
95  void foreach(void (IndexIntf::*methodPtr)(A1,A2,A3,A4,A5,A6),A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6)
96  {
97  QListIterator<IndexIntf> li(m_intfs);
98  for (li.toFirst();li.current();++li) (li.current()->*methodPtr)(a1,a2,a3,a4,a5,a6);
99  }
100 
101  template<typename A1,typename A2,typename A3,typename A4,typename A5,typename A6,typename A7,typename A8>
102  void foreach(void (IndexIntf::*methodPtr)(A1,A2,A3,A4,A5,A6,A7,A8),A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6,A7 a7,A8 a8)
103  {
104  QListIterator<IndexIntf> li(m_intfs);
105  for (li.toFirst();li.current();++li) (li.current()->*methodPtr)(a1,a2,a3,a4,a5,a6,a7,a8);
106  }
107 
108  template<typename A1,typename A2,typename A3,typename A4,typename A5,typename A6,typename A7,typename A8,typename A9>
109  void foreach(void (IndexIntf::*methodPtr)(A1,A2,A3,A4,A5,A6,A7,A8,A9),A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6,A7 a7,A8 a8,A9 a9)
110  {
111  QListIterator<IndexIntf> li(m_intfs);
112  for (li.toFirst();li.current();++li) (li.current()->*methodPtr)(a1,a2,a3,a4,a5,a6,a7,a8,a9);
113  }
114 
115  public:
116  /** Creates a list of indexes */
117  IndexList() { m_intfs.setAutoDelete(TRUE); m_enabled=TRUE; }
118  /** Add an index generator to the list */
119  void addIndex(IndexIntf *intf)
120  { m_intfs.append(intf); }
121  void disable()
122  { m_enabled = FALSE; }
123  void enable()
124  { m_enabled = TRUE; }
125  bool isEnabled() const
126  { return m_enabled; }
127 
128  // IndexIntf implementation
129  void initialize()
130  { foreach(&IndexIntf::initialize); }
131  void finalize()
132  { foreach(&IndexIntf::finalize); }
134  { if (m_enabled) foreach(&IndexIntf::incContentsDepth); }
136  { if (m_enabled) foreach(&IndexIntf::decContentsDepth); }
137  void addContentsItem(bool isDir, const char *name, const char *ref,
138  const char *file, const char *anchor,bool separateIndex=FALSE,bool addToNavIndex=FALSE,
139  Definition *def=0)
140  { if (m_enabled) foreach<bool,const char *,const char *,const char *,const char*,bool,bool,Definition *>
141  (&IndexIntf::addContentsItem,isDir,name,ref,file,anchor,separateIndex,addToNavIndex,def); }
142  void addIndexItem(Definition *context,MemberDef *md,const char *sectionAnchor=0,const char *title=0)
143  { if (m_enabled) foreach<Definition *,MemberDef *,const char *,const char *>
144  (&IndexIntf::addIndexItem,context,md,sectionAnchor,title); }
145  void addIndexFile(const char *name)
146  { if (m_enabled) foreach<const char *>(&IndexIntf::addIndexFile,name); }
147  void addImageFile(const char *name)
148  { if (m_enabled) foreach<const char *>(&IndexIntf::addImageFile,name); }
149  void addStyleSheetFile(const char *name)
150  { if (m_enabled) foreach<const char *>(&IndexIntf::addStyleSheetFile,name); }
151 
152  private:
153  bool m_enabled;
154 };
155 
156 
158 {
178 };
179 
181 {
185  //HLI_Directories,
198 
202 };
203 
205 {
206  CMHL_All = 0,
216 };
217 
219 {
220  FMHL_All = 0,
228 };
229 
231 {
232  NMHL_All = 0,
239 };
240 
242 {
243  CHL_All = 0,
252 };
253 
254 void writeGraphInfo(OutputList &ol);
256 
257 void countDataStructures();
258 
259 extern int annotatedClasses;
260 extern int hierarchyClasses;
261 extern int documentedFiles;
262 extern int documentedGroups;
263 extern int documentedNamespaces;
264 extern int indexedPages;
268 extern int documentedDirs;
269 extern int documentedHtmlFiles;
270 extern int documentedPages;
271 
272 void startTitle(OutputList &ol,const char *fileName,Definition *def=0);
273 void endTitle(OutputList &ol,const char *fileName,const char *name);
274 void startFile(OutputList &ol,const char *name,const char *manName,
275  const char *title,HighlightedItem hli=HLI_None,
276  bool additionalIndices=FALSE,const char *altSidebarName=0);
277 void endFile(OutputList &ol,bool skipNavIndex=FALSE,bool skipEndContents=FALSE,
278  const QCString &navPath=QCString());
280 
282 void initFileMemberIndices();
287 QCString fixSpaces(const QCString &s);
288 
289 #endif
static QCString name
Definition: declinfo.cpp:673
int documentedHtmlFiles
Definition: index.cpp:65
void startFile(OutputList &ol, const char *name, const char *manName, const char *title, HighlightedItem hli=HLI_None, bool additionalIndices=FALSE, const char *altSidebarName=0)
Definition: index.cpp:244
void countDataStructures()
Definition: index.cpp:77
int documentedDirs
Definition: index.cpp:67
#define a6
bool isEnabled() const
Definition: index.h:125
void append(const type *d)
Definition: qlist.h:73
void startTitle(OutputList &ol, const char *fileName, Definition *def=0)
Definition: index.cpp:228
QList< IndexIntf > m_intfs
Definition: index.h:56
IndexSections
Definition: index.h:157
const bool FALSE
Definition: qglobal.h:370
virtual void addStyleSheetFile(const char *name)=0
void writeIndexHierarchy(OutputList &ol)
Definition: index.cpp:4279
void writeGraphInfo(OutputList &ol)
Definition: index.cpp:3245
Simplified and optimized version of QTextStream.
Definition: ftextstream.h:11
int documentedGroups
Definition: index.cpp:59
int documentedClassMembers[CMHL_Total]
Definition: index.cpp:62
virtual void initialize()=0
void addFileMemberNameToIndex(MemberDef *md)
Definition: index.cpp:2406
ClassMemberHighlight
Definition: index.h:204
void initClassMemberIndices()
Definition: index.cpp:2254
#define a5
#define a2
Definition: index.h:243
void decContentsDepth()
Definition: index.h:135
void addIndexItem(Definition *context, MemberDef *md, const char *sectionAnchor=0, const char *title=0)
Definition: index.h:142
FileMemberHighlight
Definition: index.h:218
#define a3
void endFile(OutputList &ol, bool skipNavIndex=FALSE, bool skipEndContents=FALSE, const QCString &navPath=QCString())
Definition: index.cpp:263
void endTitle(OutputList &ol, const char *fileName, const char *name)
Definition: index.cpp:237
fileName
Definition: dumpTree.py:9
virtual ~IndexIntf()
Definition: index.h:33
virtual void addImageFile(const char *name)=0
void addNamespaceMemberNameToIndex(MemberDef *md)
Definition: index.cpp:2349
void addStyleSheetFile(const char *name)
Definition: index.h:149
virtual void finalize()=0
void addImageFile(const char *name)
Definition: index.h:147
void initialize()
Definition: index.h:129
type * current() const
Definition: qlist.h:146
int documentedFileMembers[FMHL_Total]
Definition: index.cpp:63
void addClassMemberNameToIndex(MemberDef *md)
Definition: index.cpp:2264
void enable()
Definition: index.h:123
void finalize()
Definition: index.h:131
int documentedFiles
Definition: index.cpp:58
void addContentsItem(bool isDir, const char *name, const char *ref, const char *file, const char *anchor, bool separateIndex=FALSE, bool addToNavIndex=FALSE, Definition *def=0)
Definition: index.h:137
Abstract interface for index generators.
Definition: index.h:30
void initNamespaceMemberIndices()
Definition: index.cpp:2339
int documentedNamespaceMembers[NMHL_Total]
Definition: index.cpp:64
IndexList()
Definition: index.h:117
int indexedPages
Definition: index.cpp:61
virtual void addIndexFile(const char *name)=0
int annotatedClasses
Definition: index.cpp:55
int hierarchyClasses
Definition: index.cpp:57
virtual void addContentsItem(bool isDir, const char *name, const char *ref, const char *file, const char *anchor, bool separateIndex, bool addToNavIndex, Definition *def)=0
QCString fixSpaces(const QCString &s)
Definition: index.cpp:223
bool m_enabled
Definition: index.h:153
int documentedPages
Definition: index.cpp:66
#define a4
HighlightedItem
Definition: index.h:180
void addIndexFile(const char *name)
Definition: index.h:145
void disable()
Definition: index.h:121
ClassHighlight
Definition: index.h:241
virtual void decContentsDepth()=0
void endFileWithNavPath(Definition *d, OutputList &ol)
Definition: index.cpp:282
void setAutoDelete(bool enable)
Definition: qlist.h:99
void addIndex(IndexIntf *intf)
Definition: index.h:119
virtual void incContentsDepth()=0
A list of index interfaces.
Definition: index.h:53
void incContentsDepth()
Definition: index.h:133
static QCString * s
Definition: config.cpp:1042
const bool TRUE
Definition: qglobal.h:371
int documentedNamespaces
Definition: index.cpp:60
NamespaceMemberHighlight
Definition: index.h:230
virtual void addIndexItem(Definition *context, MemberDef *md, const char *sectionAnchor, const char *title)=0
#define a1
type * toFirst()
Definition: qlist.h:135
void initFileMemberIndices()
Definition: index.cpp:2396