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 ****************************************************************************/
53 #include <qstringlist.h>
77 virtual void initializeGenerator(const Config
&config
);
78 virtual void terminateGenerator();
79 virtual QString
format() = 0;
80 virtual bool canHandleFormat(const QString
&format
) { return format
== this->format(); }
81 virtual void generateTree(const Tree
*tree
, CodeMarker
*marker
) = 0;
83 static void initialize(const Config
& config
);
84 static void terminate();
85 static Generator
*generatorForFormat(const QString
& format
);
88 virtual void startText(const Node
*relative
, CodeMarker
*marker
);
89 virtual void endText(const Node
*relative
, CodeMarker
*marker
);
90 virtual int generateAtom(const Atom
*atom
,
93 virtual void generateClassLikeNode(const InnerNode
*inner
, CodeMarker
*marker
);
94 virtual void generateFakeNode(const FakeNode
*fake
, CodeMarker
*marker
);
96 virtual bool generateText(const Text
& text
,
100 virtual bool generateQmlText(const Text
& text
,
101 const Node
*relative
,
103 const QString
& qmlName
);
104 virtual void generateQmlInherits(const QmlClassNode
* cn
,
107 virtual void generateBody(const Node
*node
, CodeMarker
*marker
);
108 virtual void generateAlsoList(const Node
*node
, CodeMarker
*marker
);
109 virtual void generateInherits(const ClassNode
*classe
,
111 virtual void generateInheritedBy(const ClassNode
*classe
,
114 void generateThreadSafeness(const Node
*node
, CodeMarker
*marker
);
115 void generateSince(const Node
*node
, CodeMarker
*marker
);
116 void generateStatus(const Node
*node
, CodeMarker
*marker
);
117 const Atom
*generateAtomList(const Atom
*atom
,
118 const Node
*relative
,
121 int& numGeneratedAtoms
);
122 void generateFileList(const FakeNode
* fake
,
124 Node::SubType subtype
,
126 void generateExampleFiles(const FakeNode
*fake
, CodeMarker
*marker
);
127 void generateModuleWarning(const ClassNode
*classe
, CodeMarker
*marker
);
129 virtual int skipAtoms(const Atom
*atom
, Atom::Type type
) const;
130 virtual QString
fullName(const Node
*node
,
131 const Node
*relative
,
132 CodeMarker
*marker
) const;
134 const QString
& outputDir() { return outDir
; }
135 QString
indent(int level
, const QString
& markedCode
);
136 QString
plainCode(const QString
& markedCode
);
137 virtual QString
typeString(const Node
*node
);
138 virtual QString
imageFileName(const Node
*relative
, const QString
& fileBase
);
139 void setImageFileExtensions(const QStringList
& extensions
);
140 void unknownAtom(const Atom
*atom
);
141 QMap
<QString
, QString
> &formattingLeftMap();
142 QMap
<QString
, QString
> &formattingRightMap();
144 QMap
<QString
, QStringList
> editionModuleMap
;
145 QMap
<QString
, QStringList
> editionGroupMap
;
147 static QString
trimmedTrailing(const QString
&string
);
148 static bool matchAhead(const Atom
*atom
, Atom::Type expectedAtomType
);
149 static void supplementAlsoList(const Node
*node
, QList
<Text
> &alsoList
);
152 void generateOverload(const Node
*node
, CodeMarker
*marker
);
153 void generateReimplementedFrom(const FunctionNode
*func
,
155 void appendFullName(Text
& text
,
156 const Node
*apparentNode
,
157 const Node
*relative
,
159 const Node
*actualNode
= 0);
160 void appendFullName(Text
& text
,
161 const Node
*apparentNode
,
162 const QString
& fullName
,
163 const Node
*actualNode
);
164 void appendFullNames(Text
& text
,
165 const NodeList
& nodes
,
166 const Node
* relative
,
168 void appendSortedNames(Text
& text
,
169 const ClassNode
*classe
,
170 const QList
<RelatedClass
> &classes
,
179 static QList
<Generator
*> generators
;
180 static QMap
<QString
, QMap
<QString
, QString
> > fmtLeftMaps
;
181 static QMap
<QString
, QMap
<QString
, QString
> > fmtRightMaps
;
182 static QMap
<QString
, QStringList
> imgFileExts
;
183 static QSet
<QString
> outputFormats
;
184 static QStringList imageFiles
;
185 static QStringList imageDirs
;
186 static QStringList exampleDirs
;
187 static QStringList exampleImgExts
;
188 static QString outDir
;
189 static QString project
;