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 <qlist.h>
23 #include "types.h"
24 
25 class LayoutParser;
26 class MemberList;
27 class QTextStream;
28 
29 /** @brief Base class representing a piece of a documentation page */
31 {
32  virtual ~LayoutDocEntry() {}
33  enum Kind {
34  // Generic items for all pages
40 
41  // Class specific items
46 
47  // Namespace specific items
50 
51  // File specific items
56 
57  // Group specific items
61 
62  // Directory specific items
64 
65  };
66  virtual Kind kind() const = 0;
67 };
68 
69 /** @brief Represents of a piece of a documentation page without configurable parts */
71 {
72  public:
73  LayoutDocEntrySimple(Kind k) : m_kind(k) {}
74  Kind kind() const { return m_kind; }
75  private:
77 };
78 
80 {
82  LayoutDocEntrySimple(k), m_title(tl) {}
83  QCString title(SrcLangExt lang) const;
84 private:
86 };
87 
88 /** @brief Represents of a member declaration list with configurable title and subtitle. */
90 {
92  const QCString &tl,const QCString &ss)
93  : type(tp), m_title(tl), m_subscript(ss) {}
94 
95  Kind kind() const { return MemberDecl; }
97  QCString title(SrcLangExt lang) const;
98  QCString subtitle(SrcLangExt lang) const;
99 private:
102 };
103 
104 /** @brief Represents of a member definition list with configurable title. */
106 {
108  : type(tp), m_title(tl) {}
109 
110  Kind kind() const { return MemberDef; }
112  QCString title(SrcLangExt lang) const;
113 private:
115 };
116 
117 /** @brief Base class for the layout of a navigation item at the top of the HTML pages. */
119 {
120  public:
121  enum Kind {
136  //Dirs,
139  UserGroup
140  };
142  const QCString &tl,const QCString &intro,bool prepend=FALSE)
143  : m_parent(parent), m_kind(k), m_visible(vs), m_baseFile(bf), m_title(tl), m_intro(intro)
144  { m_children.setAutoDelete(TRUE);
145  if (parent) { if (prepend) parent->prependChild(this); else parent->addChild(this); }
146  }
147  LayoutNavEntry *parent() const { return m_parent; }
148  Kind kind() const { return m_kind; }
149  QCString baseFile() const { return m_baseFile; }
150  QCString title() const { return m_title; }
151  QCString intro() const { return m_intro; }
152  QCString url() const;
153  bool visible() { return m_visible; }
154  void clear() { m_children.clear(); }
155  void addChild(LayoutNavEntry *e) { m_children.append(e); }
156  void prependChild(LayoutNavEntry *e) { m_children.prepend(e); }
157  const QList<LayoutNavEntry> &children() const { return m_children; }
158  LayoutNavEntry *find(LayoutNavEntry::Kind k,const char *file=0) const;
159 
160  private:
161  LayoutNavEntry() : m_parent(0) {}
164  bool m_visible;
169  friend class LayoutDocManager;
170 };
171 
172 /** @brief Singleton providing access to the (user configurable) layout of the documentation */
174 {
175  class Private;
176  public:
178  {
179  Class, Namespace, File, Group, Directory,
180  NrParts
181  };
182  /** Returns a reference to this singleton. */
183  static LayoutDocManager &instance();
184 
185  /** Returns the list of LayoutDocEntry's in representation order for a given page identified by @a part. */
186  const QList<LayoutDocEntry> &docEntries(LayoutPart part) const;
187 
188  /** returns the (invisible) root of the navigation tree. */
189  LayoutNavEntry *rootNavEntry() const;
190 
191  /** Parses a user provided layout */
192  void parse(QTextStream &t,const char *fileName);
193  void init();
194  private:
195  void addEntry(LayoutPart p,LayoutDocEntry*e);
196  void clear(LayoutPart p);
198  ~LayoutDocManager();
200  friend class LayoutParser;
201 };
202 
203 void writeDefaultLayoutFile(const char *fileName);
204 
205 #endif
206 
void writeDefaultLayoutFile(const char *fileName)
Definition: layout.cpp:1397
This file contains a number of basic enums and types.
void addChild(LayoutNavEntry *e)
Definition: layout.h:155
LayoutNavEntry(LayoutNavEntry *parent, Kind k, bool vs, const QCString &bf, const QCString &tl, const QCString &intro, bool prepend=FALSE)
Definition: layout.h:141
Represents of a piece of a documentation page without configurable parts.
Definition: layout.h:70
LayoutNavEntry * m_parent
Definition: layout.h:162
MemberListType type
Definition: layout.h:96
const bool FALSE
Definition: qglobal.h:370
LayoutNavEntry()
Definition: layout.h:161
Kind m_kind
Definition: layout.h:163
const std::string instance
virtual ~LayoutDocEntry()
Definition: layout.h:32
init
Definition: train.py:42
SrcLangExt
Definition: types.h:41
const QList< LayoutNavEntry > & children() const
Definition: layout.h:157
Represents of a member definition list with configurable title.
Definition: layout.h:105
Base class for the layout of a navigation item at the top of the HTML pages.
Definition: layout.h:118
Singleton providing access to the (user configurable) layout of the documentation.
Definition: layout.h:173
Represents of a member declaration list with configurable title and subtitle.
Definition: layout.h:89
QCString m_title
Definition: layout.h:166
const double e
bool visible()
Definition: layout.h:153
fileName
Definition: dumpTree.py:9
QCString intro() const
Definition: layout.h:151
LayoutDocEntrySection(Kind k, const QCString &tl)
Definition: layout.h:81
LayoutDocEntryMemberDecl(MemberListType tp, const QCString &tl, const QCString &ss)
Definition: layout.h:91
p
Definition: test.py:223
bool m_visible
Definition: layout.h:164
Private * d
Definition: layout.h:199
LayoutDocEntrySimple(Kind k)
Definition: layout.h:73
Kind kind() const
Definition: layout.h:95
The QTextStream class provides basic functions for reading and writing text using a QIODevice...
Definition: qtextstream.h:53
MemberListType type
Definition: layout.h:111
QCString baseFile() const
Definition: layout.h:149
QList< LayoutNavEntry > m_children
Definition: layout.h:168
void clear()
Definition: layout.h:154
LayoutDocEntryMemberDef(MemberListType tp, const QCString &tl)
Definition: layout.h:107
QCString m_title
Definition: layout.h:85
virtual Kind kind() const =0
Base class representing a piece of a documentation page.
Definition: layout.h:30
QCString title() const
Definition: layout.h:150
QCString m_baseFile
Definition: layout.h:165
void prependChild(LayoutNavEntry *e)
Definition: layout.h:156
MemberListType
Definition: types.h:104
vector< vector< double > > clear
Kind kind() const
Definition: layout.h:148
LayoutNavEntry * parent() const
Definition: layout.h:147
def parent(G, child, parent_type)
Definition: graph.py:67
const bool TRUE
Definition: qglobal.h:371
QCString m_intro
Definition: layout.h:167
Kind kind() const
Definition: layout.h:110
Kind kind() const
Definition: layout.h:74