index.h 6.96 KB
Newer Older
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1 2
/******************************************************************************
 *
3
 * 
Dimitri van Heesch's avatar
Dimitri van Heesch committed
4
 *
5
 * Copyright (C) 1997-2008 by Dimitri van Heesch.
Dimitri van Heesch's avatar
Dimitri van Heesch committed
6 7 8 9 10 11 12
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation under the terms of the GNU General Public License is hereby 
 * granted. No representations are made about the suitability of this software 
 * for any purpose. It is provided "as is" without express or implied warranty.
 * See the GNU General Public License for more details.
 *
Dimitri van Heesch's avatar
Dimitri van Heesch committed
13 14
 * Documents produced by Doxygen are derivative works derived from the
 * input used in their production; they are not affected by this license.
Dimitri van Heesch's avatar
Dimitri van Heesch committed
15 16 17 18 19 20
 *
 */

#ifndef INDEX_H
#define INDEX_H

21
#include "qtbc.h"
Dimitri van Heesch's avatar
Dimitri van Heesch committed
22
#include <qfile.h>
Dimitri van Heesch's avatar
Dimitri van Heesch committed
23
#include <qlist.h>
Dimitri van Heesch's avatar
Dimitri van Heesch committed
24

25
class MemberDef;
26
class OutputList;
27

Dimitri van Heesch's avatar
Dimitri van Heesch committed
28 29 30 31 32 33 34 35 36 37 38 39

class IndexIntf
{
  public:
    virtual ~IndexIntf() {}
    virtual void initialize() = 0;
    virtual void finalize() = 0;
    virtual void incContentsDepth() = 0;
    virtual void decContentsDepth() = 0;
    virtual void addContentsItem(bool isDir, const char *name, const char *ref = 0, 
                                 const char *file = 0, const char *anchor = 0) = 0;
    virtual void addIndexItem(const char *level1, const char *level2, const char *contRef, 
40
                              const char *memRef, const char *anchor,const MemberDef *md) = 0;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
41 42 43 44 45
    virtual void addIndexFile(const char *name) = 0;
};

class IndexList : public IndexIntf
{
46 47 48
  private:
    QList<IndexIntf> m_intfs;

Dimitri van Heesch's avatar
Dimitri van Heesch committed
49 50 51 52
    void foreach(void (IndexIntf::*methodPtr)())
    {
      QListIterator<IndexIntf> li(m_intfs);
      for (li.toFirst();li.current();++li) (li.current()->*methodPtr)();
53
    }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
54 55 56 57 58
    template<typename A1>
    void foreach(void (IndexIntf::*methodPtr)(A1),A1 a1)
    {
      QListIterator<IndexIntf> li(m_intfs);
      for (li.toFirst();li.current();++li) (li.current()->*methodPtr)(a1);
59
    }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
60 61 62 63 64
    template<typename A1,typename A2,typename A3,typename A4,typename A5>
    void foreach(void (IndexIntf::*methodPtr)(A1,A2,A3,A4,A5),A1 a1,A2 a2,A3 a3,A4 a4,A5 a5)
    {
      QListIterator<IndexIntf> li(m_intfs);
      for (li.toFirst();li.current();++li) (li.current()->*methodPtr)(a1,a2,a3,a4,a5);
65 66 67 68 69 70 71
    }
    template<typename A1,typename A2,typename A3,typename A4,typename A5,typename A6>
    void foreach(void (IndexIntf::*methodPtr)(A1,A2,A3,A4,A5,A6),A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6)
    {
      QListIterator<IndexIntf> li(m_intfs);
      for (li.toFirst();li.current();++li) (li.current()->*methodPtr)(a1,a2,a3,a4,a5,a6);
    }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89

  public:
    IndexList() { m_intfs.setAutoDelete(TRUE); }
    void addIndex(IndexIntf *intf) 
    { m_intfs.append(intf); }
    void initialize() 
    { foreach(&IndexIntf::initialize); }
    void finalize() 
    { foreach(&IndexIntf::finalize); }
    void incContentsDepth()
    { foreach(&IndexIntf::incContentsDepth); }
    void decContentsDepth()
    { foreach(&IndexIntf::decContentsDepth); }
    void addContentsItem(bool isDir, const char *name, const char *ref = 0, 
                         const char *file = 0, const char *anchor = 0)
    { foreach<bool,const char *,const char *,const char *,const char*>
             (&IndexIntf::addContentsItem,isDir,name,ref,file,anchor); }
    void addIndexItem(const char *level1, const char *level2, const char *contRef, 
90 91 92
                      const char *memRef, const char *anchor,const MemberDef *md)
    { foreach<const char *,const char *,const char *,const char *,const char *,const MemberDef *>
             (&IndexIntf::addIndexItem,level1,level2,contRef,memRef,anchor,md); }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
93 94 95 96 97 98
    void addIndexFile(const char *name) 
    { foreach<const char *>(&IndexIntf::addIndexFile,name); }

};


Dimitri van Heesch's avatar
Dimitri van Heesch committed
99 100 101 102
enum IndexSections
{
  isTitlePageStart,
  isTitlePageAuthor,
103
  isMainPage,
Dimitri van Heesch's avatar
Dimitri van Heesch committed
104
  isModuleIndex,
105
  isDirIndex,
106
  isNamespaceIndex,
Dimitri van Heesch's avatar
Dimitri van Heesch committed
107 108 109
  isClassHierarchyIndex,
  isCompoundIndex,
  isFileIndex,
Dimitri van Heesch's avatar
Dimitri van Heesch committed
110
  isPageIndex,
Dimitri van Heesch's avatar
Dimitri van Heesch committed
111
  isModuleDocumentation,
112
  isDirDocumentation,
113
  isNamespaceDocumentation,
Dimitri van Heesch's avatar
Dimitri van Heesch committed
114 115 116 117
  isClassDocumentation,
  isFileDocumentation,
  isExampleDocumentation,
  isPageDocumentation,
118
  isPageDocumentation2,
Dimitri van Heesch's avatar
Dimitri van Heesch committed
119 120 121
  isEndIndex
};

122 123 124 125 126
enum HighlightedItem
{
  HLI_None=0,
  HLI_Main,
  HLI_Modules,
127
  HLI_Directories,
128 129 130 131 132 133 134 135 136 137
  HLI_Namespaces,
  HLI_Hierarchy,
  HLI_Classes,
  HLI_Annotated,
  HLI_Files,
  HLI_NamespaceMembers,
  HLI_Functions,
  HLI_Globals,
  HLI_Pages,
  HLI_Examples,
138 139 140 141 142
  HLI_Search,

  HLI_ClassVisible,
  HLI_NamespaceVisible,
  HLI_FileVisible
143
};
144

145 146 147 148 149 150 151 152 153 154
enum ClassMemberHighlight
{
  CMHL_All = 0,
  CMHL_Functions,
  CMHL_Variables,
  CMHL_Typedefs,
  CMHL_Enums,
  CMHL_EnumValues,
  CMHL_Properties,
  CMHL_Events,
155
  CMHL_Related,
156
  CMHL_Total = CMHL_Related+1
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181
};

enum FileMemberHighlight
{
  FMHL_All = 0,
  FMHL_Functions,
  FMHL_Variables,
  FMHL_Typedefs,
  FMHL_Enums,
  FMHL_EnumValues,
  FMHL_Defines,
  FMHL_Total = FMHL_Defines+1
};

enum NamespaceMemberHighlight
{
  NMHL_All = 0,
  NMHL_Functions,
  NMHL_Variables,
  NMHL_Typedefs,
  NMHL_Enums,
  NMHL_EnumValues,
  NMHL_Total = FMHL_EnumValues+1
};

182 183 184 185 186 187 188 189 190 191 192 193 194
enum ClassHighlight
{
  CHL_All = 0,
  CHL_Classes,
  CHL_Structs,
  CHL_Unions,
  CHL_Interfaces,
  CHL_Protocols,
  CHL_Categories,
  CHL_Exceptions,
  CHL_Total = CHL_Exceptions+1
};

195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219
void writeIndex(OutputList &ol);
void writeHierarchicalIndex(OutputList &ol);
void writeAlphabeticalIndex(OutputList &ol);
void writeClassHierarchy(OutputList &ol);
void writeAnnotatedIndex(OutputList &ol);
void writeAnnotatedClassList(OutputList &ol);
void writeMemberList(OutputList &ol,bool useSections);
void writeSourceIndex(OutputList &ol);
void writeHeaderIndex(OutputList &ol);
void writeHeaderFileList(OutputList &ol);
void writeExampleIndex(OutputList &ol);
void writePageIndex(OutputList &ol);
void writeFileIndex(OutputList &ol);
void writeNamespaceIndex(OutputList &ol);
void writeGroupIndex(OutputList &ol);
void writeDirIndex(OutputList &ol);
void writePackageIndex(OutputList &ol);
void writeClassMemberIndex(OutputList &ol);
void writeFileMemberIndex(OutputList &ol);
void writeNamespaceMemberIndex(OutputList &ol);
void writeGraphicalClassHierarchy(OutputList &ol);
void writeGraphInfo(OutputList &ol);

void countDataStructures();

220 221 222 223 224 225 226 227 228 229 230
extern int annotatedClasses;
extern int hierarchyClasses;
extern int documentedFiles;
extern int documentedGroups;
extern int documentedNamespaces;
extern int indexedPages;
extern int documentedClassMembers[CMHL_Total];
extern int documentedFileMembers[FMHL_Total];
extern int documentedNamespaceMembers[NMHL_Total];
extern int documentedHtmlFiles;
extern int documentedPages;
231
extern int documentedDirs;
232

233 234
void startTitle(OutputList &ol,const char *fileName);
void endTitle(OutputList &ol,const char *fileName,const char *name);
235
void startFile(OutputList &ol,const char *name,const char *manName,
236 237
               const char *title,HighlightedItem hli=HLI_None,
               bool additionalIndices=FALSE);
238
void endFile(OutputList &ol,bool external=FALSE);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
239

240 241 242 243 244 245 246
void initClassMemberIndices();
void initFileMemberIndices();
void initNamespaceMemberIndices();
void addClassMemberNameToIndex(MemberDef *md);
void addFileMemberNameToIndex(MemberDef *md);
void addNamespaceMemberNameToIndex(MemberDef *md);

Dimitri van Heesch's avatar
Dimitri van Heesch committed
247
#endif