Doxygen
layout.h
浏览该文件的文档.
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 
26 class LayoutParser;
27 struct LayoutNavEntry;
28 class MemberList;
29 
30 /** @brief Base class representing a piece of a documentation page */
32 {
33  virtual ~LayoutDocEntry() {}
34  enum Kind {
35  // Generic items for all pages
41 
42  // Class specific items
47 
48  // Concept specific items
50 
51  // Namespace specific items
55 
56  // File specific items
61 
62  // Group specific items
66 
67  // Directory specific items
69 
70  };
71  virtual Kind kind() const = 0;
72 };
73 
74 /** @brief Represents of a piece of a documentation page without configurable parts */
76 {
77  public:
79  Kind kind() const { return m_kind; }
80  private:
82 };
83 
85 {
87  LayoutDocEntrySimple(k), m_title(tl) {}
88  QCString title(SrcLangExt lang) const;
89 private:
91 };
92 
93 /** @brief Represents of a member declaration list with configurable title and subtitle. */
95 {
97  const QCString &tl,const QCString &ss)
98  : type(tp), m_title(tl), m_subscript(ss) {}
99 
100  Kind kind() const { return MemberDecl; }
102  QCString title(SrcLangExt lang) const;
103  QCString subtitle(SrcLangExt lang) const;
104 private:
107 };
108 
109 /** @brief Represents of a member definition list with configurable title. */
111 {
113  : type(tp), m_title(tl) {}
114 
115  Kind kind() const { return MemberDef; }
117  QCString title(SrcLangExt lang) const;
118 private:
120 };
121 
122 using LayoutNavEntryList = std::vector< std::unique_ptr<LayoutNavEntry> >;
123 
124 /** @brief Base class for the layout of a navigation item at the top of the HTML pages. */
126 {
127  public:
128  enum Kind {
129  None = -1,
159  };
161  const QCString &tl,const QCString &intro,bool prepend=false)
163  {
164  if (parent)
165  {
166  if (prepend) parent->prependChild(this); else parent->addChild(this);
167  }
168  }
169  LayoutNavEntry *parent() const { return m_parent; }
170  Kind kind() const { return m_kind; }
171  QCString baseFile() const { return m_baseFile; }
172  QCString title() const { return m_title; }
173  QCString intro() const { return m_intro; }
174  QCString url() const;
175  bool visible() { return m_visible; }
176  void clear() { m_children.clear(); }
177  void addChild(LayoutNavEntry *e) { m_children.push_back(std::unique_ptr<LayoutNavEntry>(e)); }
178  void prependChild(LayoutNavEntry *e) { m_children.insert(m_children.begin(),std::unique_ptr<LayoutNavEntry>(e)); }
179  const LayoutNavEntryList &children() const { return m_children; }
180  LayoutNavEntry *find(LayoutNavEntry::Kind k,const QCString &file=QCString()) const;
181 
182  private:
186  bool m_visible;
191  friend class LayoutDocManager;
192 };
193 
194 using LayoutDocEntryList = std::vector< std::unique_ptr<LayoutDocEntry> >;
195 
196 /** @brief Singleton providing access to the (user configurable) layout of the documentation */
198 {
199  class Private;
200  public:
202  {
205  };
206  /** Returns a reference to this singleton. */
207  static LayoutDocManager &instance();
208 
209  /** Returns the list of LayoutDocEntry's in representation order for a given page identified by @a part. */
210  const LayoutDocEntryList &docEntries(LayoutPart part) const;
211 
212  /** returns the (invisible) root of the navigation tree. */
213  LayoutNavEntry *rootNavEntry() const;
214 
215  /** Parses a user provided layout */
216  void parse(const QCString &fileName);
217  void init();
218  private:
220  void clear(LayoutPart p);
223  std::unique_ptr<Private> d;
224  friend class LayoutParser;
225 };
226 
227 void writeDefaultLayoutFile(const QCString &fileName);
228 
229 #endif
230 
LayoutDocEntry::GroupPageDocs
@ GroupPageDocs
Definition: layout.h:65
LayoutNavEntry::Interfaces
@ Interfaces
Definition: layout.h:142
LayoutDocEntry::Kind
Kind
Definition: layout.h:34
writeDefaultLayoutFile
void writeDefaultLayoutFile(const QCString &fileName)
Definition: layout.cpp:1614
LayoutNavEntry::LayoutNavEntry
LayoutNavEntry(LayoutNavEntry *parent, Kind k, bool vs, const QCString &bf, const QCString &tl, const QCString &intro, bool prepend=false)
Definition: layout.h:160
LayoutDocEntryMemberDecl::m_subscript
QCString m_subscript
Definition: layout.h:106
LayoutNavEntry
Base class for the layout of a navigation item at the top of the HTML pages.
Definition: layout.h:125
LayoutDocEntryMemberDecl::type
MemberListType type
Definition: layout.h:101
LayoutDocEntryMemberDecl
Represents of a member declaration list with configurable title and subtitle.
Definition: layout.h:94
LayoutDocEntry::NamespaceNestedNamespaces
@ NamespaceNestedNamespaces
Definition: layout.h:52
LayoutDocManager::Directory
@ Directory
Definition: layout.h:203
LayoutNavEntry::kind
Kind kind() const
Definition: layout.h:170
LayoutDocManager::rootNavEntry
LayoutNavEntry * rootNavEntry() const
returns the (invisible) root of the navigation tree.
Definition: layout.cpp:1585
LayoutDocEntry::GroupConcepts
@ GroupConcepts
Definition: layout.h:63
LayoutNavEntry::ExceptionList
@ ExceptionList
Definition: layout.h:150
MemberListType
MemberListType
Definition: types.h:100
LayoutNavEntry::m_visible
bool m_visible
Definition: layout.h:186
LayoutDocEntry::GroupFiles
@ GroupFiles
Definition: layout.h:64
LayoutDocEntry::NamespaceInlineClasses
@ NamespaceInlineClasses
Definition: layout.h:54
LayoutDocEntry::MemberDef
@ MemberDef
Definition: layout.h:38
LayoutNavEntry::Kind
Kind
Definition: layout.h:128
LayoutDocEntry::FileClasses
@ FileClasses
Definition: layout.h:57
types.h
This file contains a number of basic enums and types.
LayoutDocEntry::ConceptDefinition
@ ConceptDefinition
Definition: layout.h:49
LayoutDocEntrySection::LayoutDocEntrySection
LayoutDocEntrySection(Kind k, const QCString &tl)
Definition: layout.h:86
LayoutDocManager::File
@ File
Definition: layout.h:203
LayoutDocManager::d
std::unique_ptr< Private > d
Definition: layout.h:223
LayoutDocEntryMemberDef::LayoutDocEntryMemberDef
LayoutDocEntryMemberDef(MemberListType tp, const QCString &tl)
Definition: layout.h:112
LayoutNavEntry::find
LayoutNavEntry * find(LayoutNavEntry::Kind k, const QCString &file=QCString()) const
Definition: layout.cpp:107
LayoutNavEntry::FileList
@ FileList
Definition: layout.h:154
LayoutNavEntry::User
@ User
Definition: layout.h:157
LayoutParser
Definition: layout.cpp:163
LayoutDocEntryMemberDef::m_title
QCString m_title
Definition: layout.h:119
LayoutDocEntryMemberDef::title
QCString title(SrcLangExt lang) const
Definition: layout.cpp:1680
LayoutDocEntry::ClassInheritanceGraph
@ ClassInheritanceGraph
Definition: layout.h:44
LayoutDocEntryList
std::vector< std::unique_ptr< LayoutDocEntry > > LayoutDocEntryList
Definition: layout.h:194
SrcLangExt
SrcLangExt
Language as given by extension
Definition: types.h:41
LayoutDocEntry::MemberDeclStart
@ MemberDeclStart
Definition: layout.h:37
LayoutNavEntry::StructList
@ StructList
Definition: layout.h:147
LayoutNavEntry::m_title
QCString m_title
Definition: layout.h:188
LayoutNavEntry::url
QCString url() const
Definition: layout.cpp:127
LayoutNavEntry::UserGroup
@ UserGroup
Definition: layout.h:158
LayoutNavEntry::m_children
LayoutNavEntryList m_children
Definition: layout.h:190
LayoutDocEntry::NamespaceClasses
@ NamespaceClasses
Definition: layout.h:53
LayoutDocEntry::GroupClasses
@ GroupClasses
Definition: layout.h:63
LayoutNavEntry::Exceptions
@ Exceptions
Definition: layout.h:149
LayoutDocManager::Concept
@ Concept
Definition: layout.h:203
LayoutDocManager::Class
@ Class
Definition: layout.h:203
LayoutDocEntry::ClassIncludes
@ ClassIncludes
Definition: layout.h:43
LayoutDocEntry::FileNamespaces
@ FileNamespaces
Definition: layout.h:57
LayoutDocManager::NrParts
@ NrParts
Definition: layout.h:204
LayoutDocEntryMemberDef::type
MemberListType type
Definition: layout.h:116
LayoutDocEntry::FileConcepts
@ FileConcepts
Definition: layout.h:57
LayoutDocManager::docEntries
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:1580
LayoutDocEntry::MemberDefEnd
@ MemberDefEnd
Definition: layout.h:38
LayoutDocEntry::DirSubDirs
@ DirSubDirs
Definition: layout.h:68
LayoutDocManager::init
void init()
Definition: layout.cpp:1556
LayoutDocEntry::NamespaceNestedConstantGroups
@ NamespaceNestedConstantGroups
Definition: layout.h:52
LayoutDocEntry::GroupInlineClasses
@ GroupInlineClasses
Definition: layout.h:63
LayoutNavEntry::StructIndex
@ StructIndex
Definition: layout.h:148
LayoutNavEntry::None
@ None
Definition: layout.h:129
LayoutDocEntrySimple::m_kind
Kind m_kind
Definition: layout.h:81
LayoutDocManager::LayoutPart
LayoutPart
Definition: layout.h:201
LayoutDocManager::Group
@ Group
Definition: layout.h:203
LayoutDocEntry::ClassCollaborationGraph
@ ClassCollaborationGraph
Definition: layout.h:45
LayoutNavEntry::ExceptionHierarchy
@ ExceptionHierarchy
Definition: layout.h:152
LayoutDocEntryMemberDecl::title
QCString title(SrcLangExt lang) const
Definition: layout.cpp:1668
LayoutDocManager::Namespace
@ Namespace
Definition: layout.h:203
LayoutNavEntry::NamespaceMembers
@ NamespaceMembers
Definition: layout.h:135
LayoutDocManager
Singleton providing access to the (user configurable) layout of the documentation
Definition: layout.h:197
LayoutDocEntry::FileStructs
@ FileStructs
Definition: layout.h:57
LayoutDocEntryMemberDef
Represents of a member definition list with configurable title.
Definition: layout.h:110
LayoutNavEntry::Files
@ Files
Definition: layout.h:153
LayoutDocEntry::FileIncludes
@ FileIncludes
Definition: layout.h:58
LayoutDocEntrySimple
Represents of a piece of a documentation page without configurable parts
Definition: layout.h:75
LayoutDocEntryMemberDef::kind
Kind kind() const
Definition: layout.h:115
LayoutDocManager::~LayoutDocManager
~LayoutDocManager()
Definition: layout.cpp:1569
LayoutNavEntry::Modules
@ Modules
Definition: layout.h:132
LayoutDocEntrySection
Definition: layout.h:84
LayoutDocEntry::MemberDeclEnd
@ MemberDeclEnd
Definition: layout.h:37
LayoutNavEntry::m_baseFile
QCString m_baseFile
Definition: layout.h:187
LayoutDocEntryMemberDecl::LayoutDocEntryMemberDecl
LayoutDocEntryMemberDecl(MemberListType tp, const QCString &tl, const QCString &ss)
Definition: layout.h:96
LayoutNavEntryList
std::vector< std::unique_ptr< LayoutNavEntry > > LayoutNavEntryList
Definition: layout.h:122
LayoutDocEntry::MemberDefStart
@ MemberDefStart
Definition: layout.h:38
LayoutDocEntry::DirFiles
@ DirFiles
Definition: layout.h:68
LayoutDocEntry::NamespaceExceptions
@ NamespaceExceptions
Definition: layout.h:53
LayoutNavEntry::Pages
@ Pages
Definition: layout.h:131
LayoutDocEntry::FileConstantGroups
@ FileConstantGroups
Definition: layout.h:57
LayoutNavEntry::intro
QCString intro() const
Definition: layout.h:173
LayoutNavEntry::addChild
void addChild(LayoutNavEntry *e)
Definition: layout.h:177
LayoutNavEntry::Examples
@ Examples
Definition: layout.h:156
LayoutNavEntry::FileGlobals
@ FileGlobals
Definition: layout.h:155
LayoutDocEntry::GroupGraph
@ GroupGraph
Definition: layout.h:65
LayoutDocEntry::NamespaceStructs
@ NamespaceStructs
Definition: layout.h:53
LayoutDocEntryMemberDecl::kind
Kind kind() const
Definition: layout.h:100
LayoutDocEntry
Base class representing a piece of a documentation page
Definition: layout.h:31
LayoutNavEntry::InterfaceList
@ InterfaceList
Definition: layout.h:143
LayoutDocEntry::GroupNestedGroups
@ GroupNestedGroups
Definition: layout.h:64
LayoutNavEntry::visible
bool visible()
Definition: layout.h:175
LayoutDocManager::LayoutDocManager
LayoutDocManager()
Definition: layout.cpp:1550
LayoutDocEntry::~LayoutDocEntry
virtual ~LayoutDocEntry()
Definition: layout.h:33
LayoutNavEntry::m_kind
Kind m_kind
Definition: layout.h:185
LayoutDocManager::addEntry
void addEntry(LayoutPart p, LayoutDocEntry *e)
Definition: layout.cpp:1590
LayoutNavEntry::Structs
@ Structs
Definition: layout.h:146
LayoutDocEntrySimple::LayoutDocEntrySimple
LayoutDocEntrySimple(Kind k)
Definition: layout.h:78
LayoutDocEntry::kind
virtual Kind kind() const =0
LayoutDocEntryMemberDecl::subtitle
QCString subtitle(SrcLangExt lang) const
Definition: layout.cpp:1673
LayoutNavEntry::m_parent
LayoutNavEntry * m_parent
Definition: layout.h:184
LayoutDocManager::Private
Definition: layout.cpp:1543
LayoutNavEntry::ClassIndex
@ ClassIndex
Definition: layout.h:139
LayoutNavEntry::Concepts
@ Concepts
Definition: layout.h:136
LayoutDocEntry::ClassAllMembersLink
@ ClassAllMembersLink
Definition: layout.h:45
LayoutDocEntry::GroupDirs
@ GroupDirs
Definition: layout.h:64
LayoutNavEntry::m_intro
QCString m_intro
Definition: layout.h:189
LayoutDocManager::clear
void clear(LayoutPart p)
Definition: layout.cpp:1595
LayoutDocEntry::DetailedDesc
@ DetailedDesc
Definition: layout.h:39
LayoutDocManager::instance
static LayoutDocManager & instance()
Returns a reference to this singleton.
Definition: layout.cpp:1574
LayoutDocEntry::FileInterfaces
@ FileInterfaces
Definition: layout.h:57
LayoutDocEntrySimple::kind
Kind kind() const
Definition: layout.h:79
LayoutNavEntry::LayoutNavEntry
LayoutNavEntry()
Definition: layout.h:183
LayoutNavEntry::ClassList
@ ClassList
Definition: layout.h:138
LayoutNavEntry::Classes
@ Classes
Definition: layout.h:137
LayoutDocEntry::MemberGroups
@ MemberGroups
Definition: layout.h:36
LayoutDocEntry::ClassInlineClasses
@ ClassInlineClasses
Definition: layout.h:43
LayoutDocEntrySection::m_title
QCString m_title
Definition: layout.h:90
LayoutNavEntry::NamespaceList
@ NamespaceList
Definition: layout.h:134
LayoutNavEntry::Namespaces
@ Namespaces
Definition: layout.h:133
LayoutNavEntry::title
QCString title() const
Definition: layout.h:172
LayoutDocEntryMemberDecl::m_title
QCString m_title
Definition: layout.h:105
LayoutDocEntry::BriefDesc
@ BriefDesc
Definition: layout.h:39
LayoutDocEntry::NamespaceConcepts
@ NamespaceConcepts
Definition: layout.h:53
LayoutDocEntry::DirGraph
@ DirGraph
Definition: layout.h:68
LayoutDocEntry::FileIncludeGraph
@ FileIncludeGraph
Definition: layout.h:58
LayoutDocEntry::FileIncludedByGraph
@ FileIncludedByGraph
Definition: layout.h:59
LayoutNavEntry::ClassHierarchy
@ ClassHierarchy
Definition: layout.h:140
LayoutNavEntry::prependChild
void prependChild(LayoutNavEntry *e)
Definition: layout.h:178
LayoutDocEntry::ClassUsedFiles
@ ClassUsedFiles
Definition: layout.h:46
LayoutDocEntry::FileSourceLink
@ FileSourceLink
Definition: layout.h:59
LayoutNavEntry::InterfaceIndex
@ InterfaceIndex
Definition: layout.h:144
LayoutDocEntry::ClassNestedClasses
@ ClassNestedClasses
Definition: layout.h:44
LayoutNavEntry::ClassMembers
@ ClassMembers
Definition: layout.h:141
LayoutDocManager::parse
void parse(const QCString &fileName)
Parses a user provided layout
Definition: layout.cpp:1600
LayoutNavEntry::clear
void clear()
Definition: layout.h:176
LayoutNavEntry::children
const LayoutNavEntryList & children() const
Definition: layout.h:179
LayoutNavEntry::baseFile
QCString baseFile() const
Definition: layout.h:171
LayoutDocEntry::FileExceptions
@ FileExceptions
Definition: layout.h:57
LayoutNavEntry::ExceptionIndex
@ ExceptionIndex
Definition: layout.h:151
LayoutNavEntry::MainPage
@ MainPage
Definition: layout.h:130
LayoutNavEntry::InterfaceHierarchy
@ InterfaceHierarchy
Definition: layout.h:145
LayoutDocEntry::NamespaceInterfaces
@ NamespaceInterfaces
Definition: layout.h:53
MemberList
A list of MemberDef objects as shown in documentation sections.
Definition: memberlist.h:81
LayoutDocEntry::FileInlineClasses
@ FileInlineClasses
Definition: layout.h:60
LayoutDocEntry::GroupNamespaces
@ GroupNamespaces
Definition: layout.h:63
LayoutDocEntry::MemberDecl
@ MemberDecl
Definition: layout.h:37
LayoutDocEntrySection::title
QCString title(SrcLangExt lang) const
Definition: layout.cpp:1661
LayoutDocEntry::AuthorSection
@ AuthorSection
Definition: layout.h:40
LayoutNavEntry::parent
LayoutNavEntry * parent() const
Definition: layout.h:169
FALSE
#define FALSE
Definition: qcstring.h:33
QCString
This is an alternative implementation of QCString.
Definition: qcstring.h:108