1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
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
182
183
184
185
186
187
188
189
190
191
192
193
194
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
|
/******************************************************************************
*
*
*
*
* Copyright (C) 1997-2015 by Dimitri van Heesch.
*
* 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.
*
* Documents produced by Doxygen are derivative works derived from the
* input used in their production; they are not affected by this license.
*
*/
#ifndef LAYOUT_H
#define LAYOUT_H
#include <qlist.h>
#include "types.h"
class LayoutParser;
class MemberList;
class QTextStream;
/** @brief Base class representing a piece of a documentation page */
struct LayoutDocEntry
{
virtual ~LayoutDocEntry() {}
enum Kind {
// Generic items for all pages
MemberGroups,
MemberDeclStart, MemberDeclEnd, MemberDecl,
MemberDefStart, MemberDefEnd, MemberDef,
BriefDesc, DetailedDesc,
AuthorSection,
// Class specific items
ClassIncludes, ClassInlineClasses,
ClassInheritanceGraph, ClassNestedClasses,
ClassCollaborationGraph, ClassAllMembersLink,
ClassUsedFiles,
// Namespace specific items
NamespaceNestedNamespaces, NamespaceNestedConstantGroups,
NamespaceClasses, NamespaceInterfaces, NamespaceStructs, NamespaceExceptions,
NamespaceInlineClasses,
// File specific items
FileClasses, FileInterfaces, FileStructs, FileExceptions, FileConstantGroups, FileNamespaces,
FileIncludes, FileIncludeGraph,
FileIncludedByGraph, FileSourceLink,
FileInlineClasses,
// Group specific items
GroupClasses, GroupInlineClasses, GroupNamespaces,
GroupDirs, GroupNestedGroups, GroupFiles,
GroupGraph, GroupPageDocs,
// Directory specific items
DirSubDirs, DirFiles, DirGraph
};
virtual Kind kind() const = 0;
};
/** @brief Represents of a piece of a documentation page without configurable parts */
struct LayoutDocEntrySimple : LayoutDocEntry
{
public:
LayoutDocEntrySimple(Kind k) : m_kind(k) {}
Kind kind() const { return m_kind; }
private:
Kind m_kind;
};
struct LayoutDocEntrySection: public LayoutDocEntrySimple
{
LayoutDocEntrySection(Kind k,const QCString &tl) :
LayoutDocEntrySimple(k), m_title(tl) {}
QCString title(SrcLangExt lang) const;
private:
QCString m_title;
};
/** @brief Represents of a member declaration list with configurable title and subtitle. */
struct LayoutDocEntryMemberDecl: public LayoutDocEntry
{
LayoutDocEntryMemberDecl(MemberListType tp,
const QCString &tl,const QCString &ss)
: type(tp), m_title(tl), m_subscript(ss) {}
Kind kind() const { return MemberDecl; }
MemberListType type;
QCString title(SrcLangExt lang) const;
QCString subtitle(SrcLangExt lang) const;
private:
QCString m_title;
QCString m_subscript;
};
/** @brief Represents of a member definition list with configurable title. */
struct LayoutDocEntryMemberDef: public LayoutDocEntry
{
LayoutDocEntryMemberDef(MemberListType tp,const QCString &tl)
: type(tp), m_title(tl) {}
Kind kind() const { return MemberDef; }
MemberListType type;
QCString title(SrcLangExt lang) const;
private:
QCString m_title;
};
/** @brief Base class for the layout of a navigation item at the top of the HTML pages. */
struct LayoutNavEntry
{
public:
enum Kind {
None = -1,
MainPage,
Pages,
Modules,
Namespaces,
NamespaceList,
NamespaceMembers,
Classes,
ClassList,
ClassIndex,
ClassHierarchy,
ClassMembers,
Interfaces,
InterfaceList,
InterfaceIndex,
InterfaceHierarchy,
Structs,
StructList,
StructIndex,
Exceptions,
ExceptionList,
ExceptionIndex,
ExceptionHierarchy,
Files,
FileList,
FileGlobals,
Examples,
User,
UserGroup
};
LayoutNavEntry(LayoutNavEntry *parent,Kind k,bool vs,const QCString &bf,
const QCString &tl,const QCString &intro,bool prepend=FALSE)
: m_parent(parent), m_kind(k), m_visible(vs), m_baseFile(bf), m_title(tl), m_intro(intro)
{ m_children.setAutoDelete(TRUE);
if (parent) { if (prepend) parent->prependChild(this); else parent->addChild(this); }
}
LayoutNavEntry *parent() const { return m_parent; }
Kind kind() const { return m_kind; }
QCString baseFile() const { return m_baseFile; }
QCString title() const { return m_title; }
QCString intro() const { return m_intro; }
QCString url() const;
bool visible() const { return m_visible; }
void addChild(LayoutNavEntry *e) { m_children.append(e); }
void prependChild(LayoutNavEntry *e) { m_children.prepend(e); }
const QList<LayoutNavEntry> &children() const { return m_children; }
LayoutNavEntry *find(LayoutNavEntry::Kind k,const char *file=0) const;
private:
LayoutNavEntry() : m_parent(0), m_kind(None), m_visible(FALSE) {}
LayoutNavEntry *m_parent;
void clear() { m_children.clear(); }
Kind m_kind;
bool m_visible;
QCString m_baseFile;
QCString m_title;
QCString m_intro;
QList<LayoutNavEntry> m_children;
friend class LayoutDocManager;
friend class LayoutParser;
};
/** @brief Singleton providing access to the (user configurable) layout of the documentation */
class LayoutDocManager
{
class Private;
public:
enum LayoutPart
{
Class, Namespace, File, Group, Directory,
NrParts
};
/** Returns a reference to this singleton. */
static LayoutDocManager &instance();
/** Returns the list of LayoutDocEntry's in representation order for a given page identified by @a part. */
const QList<LayoutDocEntry> &docEntries(LayoutPart part) const;
/** returns the (invisible) root of the navigation tree. */
LayoutNavEntry *rootNavEntry() const;
/** Parses a user provided layout */
void parse(const char *fileName);
void init();
void writeDefault(const char *fileName) const;
private:
void addEntry(LayoutPart p,LayoutDocEntry*e);
void clear(LayoutPart p);
LayoutDocManager();
~LayoutDocManager();
Private *d;
friend class LayoutParser;
};
#endif
|