1 /******************************************************************************
6 * Copyright (C) 1997-2015 by Dimitri van Heesch.
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.
14 * Documents produced by Doxygen are derivative works derived from the
15 * input used in their production; they are not affected by this license.
29 /** @brief Base class representing a piece of a documentation page */
32 virtual ~LayoutDocEntry() {}
34 // Generic items for all pages
36 MemberDeclStart, MemberDeclEnd, MemberDecl,
37 MemberDefStart, MemberDefEnd, MemberDef,
38 BriefDesc, DetailedDesc,
41 // Class specific items
42 ClassIncludes, ClassInlineClasses,
43 ClassInheritanceGraph, ClassNestedClasses,
44 ClassCollaborationGraph, ClassAllMembersLink,
47 // Namespace specific items
48 NamespaceNestedNamespaces, NamespaceNestedConstantGroups,
49 NamespaceClasses, NamespaceInterfaces, NamespaceStructs, NamespaceExceptions,
50 NamespaceInlineClasses,
52 // File specific items
53 FileClasses, FileInterfaces, FileStructs, FileExceptions, FileConstantGroups, FileNamespaces,
54 FileIncludes, FileIncludeGraph,
55 FileIncludedByGraph, FileSourceLink,
58 // Group specific items
59 GroupClasses, GroupInlineClasses, GroupNamespaces,
60 GroupDirs, GroupNestedGroups, GroupFiles,
61 GroupGraph, GroupPageDocs,
63 // Directory specific items
64 DirSubDirs, DirFiles, DirGraph
67 virtual Kind kind() const = 0;
70 /** @brief Represents of a piece of a documentation page without configurable parts */
71 struct LayoutDocEntrySimple : LayoutDocEntry
74 LayoutDocEntrySimple(Kind k) : m_kind(k) {}
75 Kind kind() const { return m_kind; }
80 struct LayoutDocEntrySection: public LayoutDocEntrySimple
82 LayoutDocEntrySection(Kind k,const QCString &tl) :
83 LayoutDocEntrySimple(k), m_title(tl) {}
84 QCString title(SrcLangExt lang) const;
89 /** @brief Represents of a member declaration list with configurable title and subtitle. */
90 struct LayoutDocEntryMemberDecl: public LayoutDocEntry
92 LayoutDocEntryMemberDecl(MemberListType tp,
93 const QCString &tl,const QCString &ss)
94 : type(tp), m_title(tl), m_subscript(ss) {}
96 Kind kind() const { return MemberDecl; }
98 QCString title(SrcLangExt lang) const;
99 QCString subtitle(SrcLangExt lang) const;
102 QCString m_subscript;
105 /** @brief Represents of a member definition list with configurable title. */
106 struct LayoutDocEntryMemberDef: public LayoutDocEntry
108 LayoutDocEntryMemberDef(MemberListType tp,const QCString &tl)
109 : type(tp), m_title(tl) {}
111 Kind kind() const { return MemberDef; }
113 QCString title(SrcLangExt lang) const;
118 /** @brief Base class for the layout of a navigation item at the top of the HTML pages. */
119 struct LayoutNavEntry
153 LayoutNavEntry(LayoutNavEntry *parent,Kind k,bool vs,const QCString &bf,
154 const QCString &tl,const QCString &intro,bool prepend=FALSE)
155 : m_parent(parent), m_kind(k), m_visible(vs), m_baseFile(bf), m_title(tl), m_intro(intro)
156 { m_children.setAutoDelete(TRUE);
157 if (parent) { if (prepend) parent->prependChild(this); else parent->addChild(this); }
159 LayoutNavEntry *parent() const { return m_parent; }
160 Kind kind() const { return m_kind; }
161 QCString baseFile() const { return m_baseFile; }
162 QCString title() const { return m_title; }
163 QCString intro() const { return m_intro; }
164 QCString url() const;
165 bool visible() { return m_visible; }
166 void clear() { m_children.clear(); }
167 void addChild(LayoutNavEntry *e) { m_children.append(e); }
168 void prependChild(LayoutNavEntry *e) { m_children.prepend(e); }
169 const QList<LayoutNavEntry> &children() const { return m_children; }
170 LayoutNavEntry *find(LayoutNavEntry::Kind k,const char *file=0) const;
173 LayoutNavEntry() : m_parent(0), m_kind(None), m_visible(FALSE) {}
174 LayoutNavEntry *m_parent;
180 QList<LayoutNavEntry> m_children;
181 friend class LayoutDocManager;
184 /** @brief Singleton providing access to the (user configurable) layout of the documentation */
185 class LayoutDocManager
191 Class, Namespace, File, Group, Directory,
194 /** Returns a reference to this singleton. */
195 static LayoutDocManager &instance();
197 /** Returns the list of LayoutDocEntry's in representation order for a given page identified by @a part. */
198 const QList<LayoutDocEntry> &docEntries(LayoutPart part) const;
200 /** returns the (invisible) root of the navigation tree. */
201 LayoutNavEntry *rootNavEntry() const;
203 /** Parses a user provided layout */
204 void parse(QTextStream &t,const char *fileName);
207 void addEntry(LayoutPart p,LayoutDocEntry*e);
208 void clear(LayoutPart p);
212 friend class LayoutParser;
215 void writeDefaultLayoutFile(const char *fileName);