Doxygen
Loading...
Searching...
No Matches
layout.h
Go to the documentation of this file.
1/******************************************************************************
2 *
3 *
4 *
5 *
6 * Copyright (C) 1997-2015 by Dimitri van Heesch.
7 *
8 * Permission to use, copy, modify, and distribute this software and its
9 * documentation under the terms of the GNU General Public License is hereby
10 * granted. No representations are made about the suitability of this software
11 * for any purpose. It is provided "as is" without express or implied warranty.
12 * See the GNU General Public License for more details.
13 *
14 * Documents produced by Doxygen are derivative works derived from the
15 * input used in their production; they are not affected by this license.
16 *
17 */
18
19#ifndef LAYOUT_H
20#define LAYOUT_H
21
22#include <memory>
23#include <vector>
24#include "types.h"
25#include "construct.h"
26
27class LayoutParser;
28struct LayoutNavEntry;
29class MemberList;
30
31/** @brief Base class representing a piece of a documentation page */
33{
35
36#define ENTRY_SPECIFICATIONS \
37 /* Generic items for all pages */ \
38 ESPEC(MemberGroups) \
39 ESPEC(MemberDeclStart) ESPEC(MemberDeclEnd) ESPEC(MemberDecl) \
40 ESPEC(MemberDefStart) ESPEC(MemberDefEnd) ESPEC(MemberDef) \
41 ESPEC(BriefDesc) ESPEC(DetailedDesc) \
42 ESPEC(AuthorSection) \
43 /* Class specific items */ \
44 ESPEC(ClassIncludes) ESPEC(ClassInlineClasses) \
45 ESPEC(ClassInheritanceGraph) ESPEC(ClassNestedClasses) \
46 ESPEC(ClassCollaborationGraph) ESPEC(ClassAllMembersLink) \
47 ESPEC(ClassUsedFiles) \
48 /* Concept specific items */ \
49 ESPEC(ConceptDefinition) \
50 /* Namespace specific items */ \
51 ESPEC(NamespaceNestedNamespaces) ESPEC(NamespaceNestedConstantGroups) \
52 ESPEC(NamespaceClasses) ESPEC(NamespaceConcepts) ESPEC(NamespaceInterfaces) ESPEC(NamespaceStructs) ESPEC(NamespaceExceptions) \
53 ESPEC(NamespaceInlineClasses) \
54 /* File specific items */ \
55 ESPEC(FileClasses) ESPEC(FileConcepts) ESPEC(FileInterfaces) ESPEC(FileStructs) ESPEC(FileExceptions) ESPEC(FileConstantGroups) ESPEC(FileNamespaces) \
56 ESPEC(FileIncludes) ESPEC(FileIncludeGraph) \
57 ESPEC(FileIncludedByGraph) ESPEC(FileSourceLink) \
58 ESPEC(FileInlineClasses) \
59 /* C++20 Modules */ \
60 ESPEC(ModuleExports) ESPEC(ModuleClasses) ESPEC(ModuleConcepts) ESPEC(ModuleUsedFiles) \
61 /* Group specific items */ \
62 ESPEC(GroupClasses) ESPEC(GroupConcepts) ESPEC(GroupModules) ESPEC(GroupInlineClasses) ESPEC(GroupNamespaces) \
63 ESPEC(GroupDirs) ESPEC(GroupNestedGroups) ESPEC(GroupFiles) \
64 ESPEC(GroupGraph) ESPEC(GroupPageDocs) \
65 /* Directory specific items */ \
66 ESPEC(DirSubDirs) ESPEC(DirFiles) ESPEC(DirGraph)
67
68 enum Kind {
69#define ESPEC(x) x,
71#undef ESPEC
72 };
73 virtual Kind kind() const = 0;
74 std::string entryToString()
75 {
76 switch (kind())
77 {
78#define ESPEC(x) case x: return #x; break;
80#undef ESPEC
81 default: return "unknown"; // to satisfy compiler
82 }
83 }
84};
85
86/** @brief Represents of a piece of a documentation page without configurable parts */
88{
89 public:
91 Kind kind() const override { return m_kind; }
92 bool visible() const { return m_visible; }
93 private:
96};
97
99{
100 LayoutDocEntrySection(Kind k,const QCString &tl,bool v) :
101 LayoutDocEntrySimple(k,v), m_title(tl) {}
102 QCString title(SrcLangExt lang) const;
103private:
105};
106
107/** @brief Represents of a member declaration list with configurable title and subtitle. */
109{
111 const QCString &tl,const QCString &ss)
112 : type(tp), m_title(tl), m_subscript(ss) {}
113
114 Kind kind() const override { return MemberDecl; }
116 QCString title(SrcLangExt lang) const;
117 QCString subtitle(SrcLangExt lang) const;
118private:
121};
122
123/** @brief Represents of a member definition list with configurable title. */
125{
128
129 Kind kind() const override { return MemberDef; }
131 QCString title(SrcLangExt lang) const;
132private:
134};
135
136using LayoutNavEntryList = std::vector< std::unique_ptr<LayoutNavEntry> >;
137
138/** @brief Base class for the layout of a navigation item at the top of the HTML pages. */
140{
141#define NAV_SPECIFICATIONS \
142 NSPEC(None, = -1) \
143 NSPEC(MainPage,) \
144 NSPEC(Pages,) \
145 NSPEC(Modules,) \
146 NSPEC(ModuleList,) \
147 NSPEC(ModuleMembers,) \
148 NSPEC(Topics,) \
149 NSPEC(Namespaces,) \
150 NSPEC(NamespaceList,) \
151 NSPEC(NamespaceMembers,) \
152 NSPEC(Concepts,) \
153 NSPEC(Classes,) \
154 NSPEC(ClassList,) \
155 NSPEC(ClassIndex,) \
156 NSPEC(ClassHierarchy,) \
157 NSPEC(ClassMembers,) \
158 NSPEC(Interfaces,) \
159 NSPEC(InterfaceList,) \
160 NSPEC(InterfaceIndex,) \
161 NSPEC(InterfaceHierarchy,) \
162 NSPEC(Structs,) \
163 NSPEC(StructList,) \
164 NSPEC(StructIndex,) \
165 NSPEC(Exceptions,) \
166 NSPEC(ExceptionList,) \
167 NSPEC(ExceptionIndex,) \
168 NSPEC(ExceptionHierarchy,) \
169 NSPEC(Files,) \
170 NSPEC(FileList,) \
171 NSPEC(FileGlobals,) \
172 NSPEC(Examples,) \
173 NSPEC(User,) \
174 NSPEC(UserGroup,)
175
176 public:
177 enum Kind {
178#define NSPEC(x,y) x y,
180#undef NSPEC
181 };
182 std::string navToString()
183 {
184 switch (kind())
185 {
186#define NSPEC(x,y) case x: return #x; break;
188#undef NSPEC
189 default: return "unknown"; // to satisfy compiler
190 }
191 }
192
194 const QCString &tl,const QCString &intro)
195 : m_parent(parent), m_kind(k), m_visible(vs), m_baseFile(bf), m_title(tl), m_intro(intro) {}
196 LayoutNavEntry *parent() const { return m_parent; }
197 Kind kind() const { return m_kind; }
198 QCString baseFile() const { return m_baseFile; }
199 QCString title() const { return m_title; }
200 QCString intro() const { return m_intro; }
201 QCString url() const;
202 void setVisible(bool v) { m_visible = v; }
203 bool visible() { return m_visible; }
204 void clear() { m_children.clear(); }
205 void addChild(std::unique_ptr<LayoutNavEntry> &&e)
206 { m_children.push_back(std::move(e)); }
207 void prependChild(std::unique_ptr<LayoutNavEntry> &&e)
208 { m_children.insert(m_children.begin(),std::move(e)); }
209 const LayoutNavEntryList &children() const { return m_children; }
211
212 private:
213 LayoutNavEntry() : m_parent(nullptr), m_kind(None), m_visible(true) {}
221 friend class LayoutDocManager;
222};
223
224using LayoutDocEntryPtr = std::unique_ptr<LayoutDocEntry>;
225using LayoutDocEntryList = std::vector<LayoutDocEntryPtr>;
226
227#define PART_SPECIFICATIONS \
228 PSPEC(Undefined, = -1) \
229 PSPEC(Class,) PSPEC(Concept,) PSPEC(Namespace,) PSPEC(File,) PSPEC(Group,) PSPEC(Directory,) PSPEC(Module,) \
230 PSPEC(NrParts,)
231/** @brief Singleton providing access to the (user configurable) layout of the documentation */
233{
234 class Private;
235 public:
237 {
238#define PSPEC(x,y) x y,
240#undef PSPEC
241 };
242 /** Returns a reference to this singleton. */
243 static LayoutDocManager &instance();
244 static std::string partToString(int k)
245 {
246 switch (k)
247 {
248#define PSPEC(x,y) case x: return #x; break;
250#undef PSPEC
251 default: return "unknown"; // to satisfy compiler
252 }
253 }
254 /** Returns the list of LayoutDocEntry's in representation order for a given page identified by @a part. */
255 const LayoutDocEntryList &docEntries(LayoutPart part) const;
256
257 /** returns the (invisible) root of the navigation tree. */
260 const QCString &tl,const QCString &intro);
261
262 /** Parses a user provided layout */
263 void parse(const QCString &fileName, const char* data = nullptr);
264 void init();
265 private:
267 void clear(LayoutPart p);
271 std::unique_ptr<Private> d;
272 friend class LayoutParser;
273};
274
275void writeDefaultLayoutFile(const QCString &fileName);
276
277#endif
278
Singleton providing access to the (user configurable) layout of the documentation.
Definition layout.h:233
static std::string partToString(int k)
Definition layout.h:244
std::unique_ptr< Private > d
Definition layout.h:271
LayoutNavEntry * createChildNavEntry(LayoutNavEntry *root, LayoutNavEntry::Kind k, bool vs, const QCString &bf, const QCString &tl, const QCString &intro)
Definition layout.cpp:1439
void clear(LayoutPart p)
Definition layout.cpp:1454
static LayoutDocManager & instance()
Returns a reference to this singleton.
Definition layout.cpp:1423
void parse(const QCString &fileName, const char *data=nullptr)
Parses a user provided layout.
Definition layout.cpp:1459
friend class LayoutParser
Definition layout.h:272
void addEntry(LayoutPart p, LayoutDocEntryPtr &&e)
Definition layout.cpp:1449
LayoutNavEntry * rootNavEntry() const
returns the (invisible) root of the navigation tree.
Definition layout.cpp:1434
const LayoutDocEntryList & docEntries(LayoutPart part) const
Returns the list of LayoutDocEntry's in representation order for a given page identified by part.
Definition layout.cpp:1429
A model of a class/file/namespace member symbol.
Definition memberdef.h:48
A list of MemberDef objects as shown in documentation sections.
Definition memberlist.h:108
Wrapper class for the MemberListType type.
Definition types.h:184
This is an alternative implementation of QCString.
Definition qcstring.h:101
#define NON_COPYABLE(cls)
Macro to help implementing the rule of 5 for a non-copyable & movable class.
Definition construct.h:37
#define ABSTRACT_BASE_CLASS(cls)
Macro to implement rule of 5 for an abstract base class.
Definition construct.h:20
void writeDefaultLayoutFile(const QCString &fileName)
Definition layout.cpp:1479
std::unique_ptr< LayoutDocEntry > LayoutDocEntryPtr
Definition layout.h:224
std::vector< std::unique_ptr< LayoutNavEntry > > LayoutNavEntryList
Definition layout.h:136
std::vector< LayoutDocEntryPtr > LayoutDocEntryList
Definition layout.h:225
Base class representing a piece of a documentation page.
Definition layout.h:33
std::string entryToString()
Definition layout.h:74
virtual Kind kind() const =0
Kind
Definition layout.h:68
@ ENTRY_SPECIFICATIONS
Definition layout.h:70
LayoutDocEntryMemberDecl(MemberListType tp, const QCString &tl, const QCString &ss)
Definition layout.h:110
QCString title(SrcLangExt lang) const
Definition layout.cpp:1533
MemberListType type
Definition layout.h:115
Kind kind() const override
Definition layout.h:114
QCString subtitle(SrcLangExt lang) const
Definition layout.cpp:1538
QCString m_subscript
Definition layout.h:120
QCString m_title
Definition layout.h:119
QCString m_title
Definition layout.h:133
MemberListType type
Definition layout.h:130
Kind kind() const override
Definition layout.h:129
QCString title(SrcLangExt lang) const
Definition layout.cpp:1545
LayoutDocEntryMemberDef(MemberListType tp, const QCString &tl)
Definition layout.h:126
LayoutDocEntrySection(Kind k, const QCString &tl, bool v)
Definition layout.h:100
QCString title(SrcLangExt lang) const
Definition layout.cpp:1526
QCString m_title
Definition layout.h:104
Kind kind() const override
Definition layout.h:91
bool visible() const
Definition layout.h:92
bool m_visible
Definition layout.h:95
Kind m_kind
Definition layout.h:94
LayoutDocEntrySimple(Kind k, bool v)
Definition layout.h:90
Base class for the layout of a navigation item at the top of the HTML pages.
Definition layout.h:140
QCString title() const
Definition layout.h:199
QCString m_intro
Definition layout.h:219
bool m_visible
Definition layout.h:216
bool visible()
Definition layout.h:203
void setVisible(bool v)
Definition layout.h:202
LayoutNavEntryList m_children
Definition layout.h:220
QCString url() const
Definition layout.cpp:140
const LayoutNavEntryList & children() const
Definition layout.h:209
void addChild(std::unique_ptr< LayoutNavEntry > &&e)
Definition layout.h:205
LayoutNavEntry * parent() const
Definition layout.h:196
LayoutNavEntry()
Definition layout.h:213
std::string navToString()
Definition layout.h:182
QCString m_baseFile
Definition layout.h:217
Kind m_kind
Definition layout.h:215
QCString intro() const
Definition layout.h:200
QCString baseFile() const
Definition layout.h:198
LayoutNavEntry * find(LayoutNavEntry::Kind k, const QCString &file=QCString()) const
Definition layout.cpp:122
Kind kind() const
Definition layout.h:197
void prependChild(std::unique_ptr< LayoutNavEntry > &&e)
Definition layout.h:207
void clear()
Definition layout.h:204
Kind
Definition layout.h:177
@ NAV_SPECIFICATIONS
Definition layout.h:179
LayoutNavEntry * m_parent
Definition layout.h:214
LayoutNavEntry(LayoutNavEntry *parent, Kind k, bool vs, const QCString &bf, const QCString &tl, const QCString &intro)
Definition layout.h:193
friend class LayoutDocManager
Definition layout.h:221
QCString m_title
Definition layout.h:218
This file contains a number of basic enums and types.
SrcLangExt
Language as given by extension.
Definition types.h:42