1 /****************************************************************************
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 ** This file is part of the tools applications of the Qt Toolkit.
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** No Commercial Usage
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
16 ** GNU Lesser General Public License Usage
17 ** Alternatively, this file may be used under the terms of the GNU Lesser
18 ** General Public License version 2.1 as published by the Free Software
19 ** Foundation and appearing in the file LICENSE.LGPL included in the
20 ** packaging of this file. Please review the following information to
21 ** ensure the GNU Lesser General Public License version 2.1 requirements
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 ** In addition, as a special exception, Nokia gives you certain additional
25 ** rights. These rights are described in the Nokia Qt LGPL Exception
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
40 ****************************************************************************/
46 #ifndef HTMLGENERATOR_H
47 #define HTMLGENERATOR_H
49 #define QDOC_NAME_ALIGNMENT
54 #include "codemarker.h"
56 #include "dcfsection.h"
57 #include "pagegenerator.h"
65 SectionIterator current
;
70 typedef QMultiMap
<QString
, Node
*> NodeMultiMap
;
71 typedef QMap
<QString
, NodeMultiMap
> NewSinceMaps
;
72 typedef QMap
<Node
*, NodeMultiMap
> ParentMaps
;
73 typedef QMap
<QString
, const Node
*> NodeMap
;
74 typedef QMap
<QString
, NodeMap
> NewClassMaps
;
76 class HelpProjectWriter
;
78 class HtmlGenerator
: public PageGenerator
102 virtual void initializeGenerator(const Config
& config
);
103 virtual void terminateGenerator();
104 virtual QString
format();
105 virtual void generateTree(const Tree
*tree
, CodeMarker
*marker
);
107 static QString
protect(const QString
& string
);
108 static QString
cleanRef(const QString
& ref
);
109 static QString
sinceTitle(int i
) { return sinceTitles
[i
]; }
112 virtual void startText(const Node
*relative
, CodeMarker
*marker
);
113 virtual int generateAtom(const Atom
*atom
,
114 const Node
*relative
,
116 virtual void generateClassLikeNode(const InnerNode
*inner
, CodeMarker
*marker
);
117 virtual void generateFakeNode(const FakeNode
*fake
, CodeMarker
*marker
);
118 virtual QString
fileExtension(const Node
*node
);
119 virtual QString
refForNode(const Node
*node
);
120 virtual QString
linkForNode(const Node
*node
, const Node
*relative
);
121 virtual QString
refForAtom(Atom
*atom
, const Node
*node
);
124 enum SubTitleSize
{ SmallSubTitle
, LargeSubTitle
};
126 const QPair
<QString
,QString
> anchorForNode(const Node
*node
);
127 const Node
*findNodeForTarget(const QString
&target
,
128 const Node
*relative
,
130 const Atom
*atom
= 0);
131 void generateHeader(const QString
& title
, const Node
*node
= 0,
132 CodeMarker
*marker
= 0, bool mainPage
= true);
133 void generateTitle(const QString
& title
,
134 const Text
&subTitle
,
135 SubTitleSize subTitleSize
,
136 const Node
*relative
,
138 void generateFooter(const Node
*node
= 0);
139 void generateBrief(const Node
*node
,
141 const Node
*relative
= 0);
142 void generateIncludes(const InnerNode
*inner
, CodeMarker
*marker
);
144 void generateNavigationBar(const NavigationBar
& bar
,
148 void generateTableOfContents(const Node
*node
,
150 Doc::SectioningUnit sectioningUnit
,
152 const Node
*relative
= 0);
153 QString
generateListOfAllMemberFile(const InnerNode
*inner
, CodeMarker
*marker
);
154 QString
generateLowStatusMemberFile(const InnerNode
*inner
,
156 CodeMarker::Status status
);
157 void generateClassHierarchy(const Node
*relative
,
159 const NodeMap
&classMap
);
160 void generateAnnotatedList(const Node
*relative
,
162 const NodeMap
&nodeMap
);
163 void generateCompactList(const Node
*relative
,
165 const NodeMap
&classMap
,
166 QString commonPrefix
= QString());
167 void generateFunctionIndex(const Node
*relative
, CodeMarker
*marker
);
168 void generateLegaleseList(const Node
*relative
, CodeMarker
*marker
);
169 void generateOverviewList(const Node
*relative
, CodeMarker
*marker
);
170 void generateSectionList(const Section
& section
,
171 const Node
*relative
,
173 CodeMarker::SynopsisStyle style
);
175 void generateQmlSummary(const Section
& section
,
176 const Node
*relative
,
178 void generateQmlItem(const Node
*node
,
179 const Node
*relative
,
182 void generateDetailedQmlMember(const Node
*node
,
183 const InnerNode
*relative
,
185 void generateQmlInherits(const QmlClassNode
* cn
, CodeMarker
* marker
);
186 void generateQmlInstantiates(const QmlClassNode
* qcn
, CodeMarker
* marker
);
187 void generateInstantiatedBy(const ClassNode
* cn
, CodeMarker
* marker
);
189 #ifdef QDOC_NAME_ALIGNMENT
190 void generateSection(const NodeList
& nl
,
191 const Node
*relative
,
193 CodeMarker::SynopsisStyle style
);
194 void generateSynopsis(const Node
*node
,
195 const Node
*relative
,
197 CodeMarker::SynopsisStyle style
,
198 bool nameAlignment
= false);
199 void generateSectionInheritedList(const Section
& section
,
200 const Node
*relative
,
202 bool nameAlignment
= false);
203 QString
highlightedCode(const QString
& markedCode
,
205 const Node
*relative
,
206 CodeMarker::SynopsisStyle style
= CodeMarker::Accessors
,
207 bool nameAlignment
= false);
209 void generateSynopsis(const Node
*node
,
210 const Node
*relative
,
212 CodeMarker::SynopsisStyle style
);
213 void generateSectionInheritedList(const Section
& section
,
214 const Node
*relative
,
216 QString
highlightedCode(const QString
& markedCode
,
218 const Node
*relative
);
220 void generateFullName(const Node
*apparentNode
,
221 const Node
*relative
,
223 const Node
*actualNode
= 0);
224 void generateDetailedMember(const Node
*node
,
225 const InnerNode
*relative
,
227 void generateLink(const Atom
*atom
,
228 const Node
*relative
,
230 void generateStatus(const Node
*node
, CodeMarker
*marker
);
232 QString
registerRef(const QString
& ref
);
233 QString
fileBase(const Node
*node
);
235 QString
fileBase(const Node
*node
, const SectionIterator
& section
);
237 QString
fileName(const Node
*node
);
238 void findAllClasses(const InnerNode
*node
);
239 void findAllFunctions(const InnerNode
*node
);
240 void findAllLegaleseTexts(const InnerNode
*node
);
241 void findAllNamespaces(const InnerNode
*node
);
243 void findAllQmlClasses(const InnerNode
*node
);
245 void findAllSince(const InnerNode
*node
);
246 static int hOffset(const Node
*node
);
247 static bool isThreeColumnEnumValueTable(const Atom
*atom
);
248 virtual QString
getLink(const Atom
*atom
,
249 const Node
*relative
,
252 virtual void generateDcf(const QString
&fileBase
,
253 const QString
&startPage
,
254 const QString
&title
, DcfSection
&dcfRoot
);
255 virtual void generateIndex(const QString
&fileBase
,
257 const QString
&title
);
258 void generateMacRef(const Node
*node
, CodeMarker
*marker
);
259 void beginLink(const QString
&link
,
261 const Node
*relative
,
266 NavigationBar currentNavigationBar
;
268 QMap
<QString
, QString
> refMap
;
270 DcfSection dcfClassesRoot
;
271 DcfSection dcfOverviewsRoot
;
272 DcfSection dcfExamplesRoot
;
273 DcfSection dcfDesignerRoot
;
274 DcfSection dcfLinguistRoot
;
275 DcfSection dcfAssistantRoot
;
276 DcfSection dcfQmakeRoot
;
277 HelpProjectWriter
*helpProjectWriter
;
281 bool inSectionHeading
;
284 bool threeColumnEnumValueTable
;
286 QStringList sectionNumber
;
287 QRegExp funcLeftParen
;
292 bool pleaseGenerateMacRef
;
294 QString projectDescription
;
296 QString navigationLinks
;
297 QStringList stylesheets
;
298 QStringList customHeadElements
;
302 QMap
<QString
, NodeMap
> moduleClassMap
;
303 QMap
<QString
, NodeMap
> moduleNamespaceMap
;
304 NodeMap nonCompatClasses
;
306 NodeMap compatClasses
;
307 NodeMap obsoleteClasses
;
308 NodeMap namespaceIndex
;
309 NodeMap serviceClasses
;
313 QMap
<QString
, NodeMap
> funcIndex
;
314 QMap
<Text
, const Node
*> legaleseTexts
;
315 NewSinceMaps newSinceMaps
;
316 static QString sinceTitles
[];
317 NewClassMaps newClassMaps
;
320 #define HTMLGENERATOR_ADDRESS "address"
321 #define HTMLGENERATOR_FOOTER "footer"
322 #define HTMLGENERATOR_GENERATEMACREFS "generatemacrefs" // ### document me
323 #define HTMLGENERATOR_POSTHEADER "postheader"
324 #define HTMLGENERATOR_STYLE "style"
325 #define HTMLGENERATOR_STYLESHEETS "stylesheets"
326 #define HTMLGENERATOR_CUSTOMHEADELEMENTS "customheadelements"