Warning: That file was not part of the compilation database. It may have many parsing errors.

1/****************************************************************************
2**
3** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4** Contact: http://www.qt-project.org/legal
5**
6** This file is part of the tools applications of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and Digia. For licensing terms and
14** conditions see http://qt.digia.com/licensing. For further information
15** use the contact form at http://qt.digia.com/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 2.1 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 2.1 requirements
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24**
25** In addition, as a special exception, Digia gives you certain additional
26** rights. These rights are described in the Digia Qt LGPL Exception
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28**
29** GNU General Public License Usage
30** Alternatively, this file may be used under the terms of the GNU
31** General Public License version 3.0 as published by the Free Software
32** Foundation and appearing in the file LICENSE.GPL included in the
33** packaging of this file. Please review the following information to
34** ensure the GNU General Public License version 3.0 requirements will be
35** met: http://www.gnu.org/copyleft/gpl.html.
36**
37**
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42/*
43 htmlgenerator.h
44*/
45
46#ifndef HTMLGENERATOR_H
47#define HTMLGENERATOR_H
48
49#include <qmap.h>
50#include <qregexp.h>
51#include <QXmlStreamWriter>
52
53#include "codemarker.h"
54#include "config.h"
55#include "pagegenerator.h"
56
57QT_BEGIN_NAMESPACE
58
59class HelpProjectWriter;
60
61class HtmlGenerator : public PageGenerator
62{
63 public:
64 enum SinceType {
65 Namespace,
66 Class,
67 MemberFunction,
68 NamespaceFunction,
69 GlobalFunction,
70 Macro,
71 Enum,
72 Typedef,
73 Property,
74 Variable,
75 QmlClass,
76 QmlProperty,
77 QmlSignal,
78 QmlMethod,
79 LastSinceType
80 };
81
82 public:
83 HtmlGenerator();
84 ~HtmlGenerator();
85
86 virtual void initializeGenerator(const Config& config);
87 virtual void terminateGenerator();
88 virtual QString format();
89 virtual void generateTree(const Tree *tree);
90 void generateManifestFiles();
91
92 QString protectEnc(const QString &string);
93 static QString protect(const QString &string, const QString &encoding = "ISO-8859-1");
94 static QString cleanRef(const QString& ref);
95 static QString sinceTitle(int i) { return sinceTitles[i]; }
96 static QString fullDocumentLocation(const Node *node);
97
98 protected:
99 virtual void startText(const Node *relative, CodeMarker *marker);
100 virtual int generateAtom(const Atom *atom,
101 const Node *relative,
102 CodeMarker *marker);
103 virtual void generateClassLikeNode(const InnerNode *inner, CodeMarker *marker);
104 virtual void generateFakeNode(const FakeNode *fake, CodeMarker *marker);
105 virtual QString fileExtension(const Node *node) const;
106 virtual QString refForNode(const Node *node);
107 virtual QString linkForNode(const Node *node, const Node *relative);
108 virtual QString refForAtom(Atom *atom, const Node *node);
109
110 void generateManifestFile(QString manifest, QString element);
111
112 private:
113 enum SubTitleSize { SmallSubTitle, LargeSubTitle };
114 enum ExtractionMarkType {
115 BriefMark,
116 DetailedDescriptionMark,
117 MemberMark,
118 EndMark
119 };
120
121 const QPair<QString,QString> anchorForNode(const Node *node);
122 const Node *findNodeForTarget(const QString &target,
123 const Node *relative,
124 CodeMarker *marker,
125 const Atom *atom = 0);
126 void generateBreadCrumbs(const QString& title,
127 const Node *node,
128 CodeMarker *marker);
129 void generateHeader(const QString& title,
130 const Node *node = 0,
131 CodeMarker *marker = 0);
132 void generateTitle(const QString& title,
133 const Text &subTitle,
134 SubTitleSize subTitleSize,
135 const Node *relative,
136 CodeMarker *marker);
137 void generateFooter(const Node *node = 0);
138 void generateBrief(const Node *node,
139 CodeMarker *marker,
140 const Node *relative = 0);
141 void generateIncludes(const InnerNode *inner, CodeMarker *marker);
142 void generateTableOfContents(const Node *node,
143 CodeMarker *marker,
144 QList<Section>* sections = 0);
145 QString generateListOfAllMemberFile(const InnerNode *inner,
146 CodeMarker *marker);
147 QString generateAllQmlMembersFile(const QmlClassNode* qml_cn,
148 CodeMarker* marker);
149 QString generateLowStatusMemberFile(const InnerNode *inner,
150 CodeMarker *marker,
151 CodeMarker::Status status);
152 void generateClassHierarchy(const Node *relative,
153 CodeMarker *marker,
154 const NodeMap &classMap);
155 void generateAnnotatedList(const Node *relative,
156 CodeMarker *marker,
157 const NodeMap &nodeMap);
158 void generateCompactList(const Node *relative,
159 CodeMarker *marker,
160 const NodeMap &classMap,
161 bool includeAlphabet,
162 QString commonPrefix = QString());
163 void generateFunctionIndex(const Node *relative, CodeMarker *marker);
164 void generateLegaleseList(const Node *relative, CodeMarker *marker);
165 void generateOverviewList(const Node *relative, CodeMarker *marker);
166 void generateSectionList(const Section& section,
167 const Node *relative,
168 CodeMarker *marker,
169 CodeMarker::SynopsisStyle style);
170#ifdef QDOC_QML
171 void generateQmlSummary(const Section& section,
172 const Node *relative,
173 CodeMarker *marker);
174 void generateQmlItem(const Node *node,
175 const Node *relative,
176 CodeMarker *marker,
177 bool summary);
178 void generateDetailedQmlMember(const Node *node,
179 const InnerNode *relative,
180 CodeMarker *marker);
181 void generateQmlInherits(const QmlClassNode* cn, CodeMarker* marker);
182 void generateQmlInheritedBy(const QmlClassNode* cn, CodeMarker* marker);
183 void generateQmlInstantiates(const QmlClassNode* qcn, CodeMarker* marker);
184 void generateInstantiatedBy(const ClassNode* cn, CodeMarker* marker);
185#endif
186
187 void generateSection(const NodeList& nl,
188 const Node *relative,
189 CodeMarker *marker,
190 CodeMarker::SynopsisStyle style);
191 void generateSynopsis(const Node *node,
192 const Node *relative,
193 CodeMarker *marker,
194 CodeMarker::SynopsisStyle style,
195 bool alignNames = false);
196 void generateSectionInheritedList(const Section& section,
197 const Node *relative,
198 CodeMarker *marker);
199 QString highlightedCode(const QString& markedCode,
200 CodeMarker* marker,
201 const Node* relative,
202 bool alignNames = false,
203 const Node* self = 0);
204
205 void generateFullName(const Node *apparentNode,
206 const Node *relative,
207 CodeMarker *marker,
208 const Node *actualNode = 0);
209 void generateDetailedMember(const Node *node,
210 const InnerNode *relative,
211 CodeMarker *marker);
212 void generateLink(const Atom *atom,
213 const Node *relative,
214 CodeMarker *marker);
215 void generateStatus(const Node *node, CodeMarker *marker);
216
217 QString registerRef(const QString& ref);
218 virtual QString fileBase(const Node *node) const;
219 QString fileName(const Node *node);
220 void findAllClasses(const InnerNode *node);
221 void findAllFunctions(const InnerNode *node);
222 void findAllLegaleseTexts(const InnerNode *node);
223 void findAllNamespaces(const InnerNode *node);
224 static int hOffset(const Node *node);
225 static bool isThreeColumnEnumValueTable(const Atom *atom);
226 virtual QString getLink(const Atom *atom,
227 const Node *relative,
228 CodeMarker *marker,
229 const Node** node);
230 virtual void generateIndex(const QString &fileBase,
231 const QString &url,
232 const QString &title);
233#ifdef GENERATE_MAC_REFS
234 void generateMacRef(const Node *node, CodeMarker *marker);
235#endif
236 void beginLink(const QString &link,
237 const Node *node,
238 const Node *relative,
239 CodeMarker *marker);
240 void endLink();
241 bool generatePageElement(QXmlStreamWriter& writer,
242 const Node* node,
243 CodeMarker* marker) const;
244 void generatePageElements(QXmlStreamWriter& writer,
245 const Node* node,
246 CodeMarker* marker) const;
247 void generatePageIndex(const QString& fileName) const;
248 void generateExtractionMark(const Node *node, ExtractionMarkType markType);
249
250 QMap<QString, QString> refMap;
251 int codeIndent;
252 HelpProjectWriter *helpProjectWriter;
253 bool inLink;
254 bool inObsoleteLink;
255 bool inContents;
256 bool inSectionHeading;
257 bool inTableHeader;
258 int numTableRows;
259 bool threeColumnEnumValueTable;
260 QString link;
261 QStringList sectionNumber;
262 QRegExp funcLeftParen;
263 QString style;
264 QString headerScripts;
265 QString headerStyles;
266 QString endHeader;
267 QString postHeader;
268 QString postPostHeader;
269 QString footer;
270 QString address;
271 bool pleaseGenerateMacRef;
272 bool noBreadCrumbs;
273 QString project;
274 QString projectDescription;
275 QString projectUrl;
276 QString navigationLinks;
277 QString manifestDir;
278 QStringList stylesheets;
279 QStringList customHeadElements;
280 const Tree *myTree;
281 bool obsoleteLinks;
282 QMap<QString, NodeMap > moduleClassMap;
283 QMap<QString, NodeMap > moduleNamespaceMap;
284 NodeMap nonCompatClasses;
285 NodeMap mainClasses;
286 NodeMap compatClasses;
287 NodeMap obsoleteClasses;
288 NodeMap namespaceIndex;
289 NodeMap serviceClasses;
290 NodeMap qmlClasses;
291 QMap<QString, NodeMap > funcIndex;
292 QMap<Text, const Node *> legaleseTexts;
293 static int id;
294 public:
295 static bool debugging_on;
296 static QString divNavTop;
297};
298
299#define HTMLGENERATOR_ADDRESS "address"
300#define HTMLGENERATOR_FOOTER "footer"
301#define HTMLGENERATOR_GENERATEMACREFS "generatemacrefs" // ### document me
302#define HTMLGENERATOR_POSTHEADER "postheader"
303#define HTMLGENERATOR_POSTPOSTHEADER "postpostheader"
304#define HTMLGENERATOR_NOBREADCRUMBS "nobreadcrumbs"
305
306QT_END_NAMESPACE
307
308#endif
309
310

Warning: That file was not part of the compilation database. It may have many parsing errors.