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 generator.h
44*/
45
46#ifndef GENERATOR_H
47#define GENERATOR_H
48
49#include <qlist.h>
50#include <qmap.h>
51#include <qregexp.h>
52#include <qstring.h>
53#include <qstringlist.h>
54
55#include "node.h"
56#include "text.h"
57
58QT_BEGIN_NAMESPACE
59
60typedef QMap<QString, const Node*> NodeMap;
61typedef QMultiMap<QString, Node*> NodeMultiMap;
62typedef QMap<QString, NodeMultiMap> NewSinceMaps;
63typedef QMap<Node*, NodeMultiMap> ParentMaps;
64typedef QMap<QString, NodeMap> NewClassMaps;
65
66class ClassNode;
67class Config;
68class CodeMarker;
69class FakeNode;
70class FunctionNode;
71class InnerNode;
72class Location;
73class NamespaceNode;
74class Node;
75class Tree;
76
77class Generator
78{
79 public:
80 Generator();
81 virtual ~Generator();
82
83 virtual void initializeGenerator(const Config &config);
84 virtual void terminateGenerator();
85 virtual QString format() = 0;
86 virtual bool canHandleFormat(const QString &format) { return format == this->format(); }
87 virtual void generateTree(const Tree *tree) = 0;
88
89 static void initialize(const Config& config);
90 static void terminate();
91 static Generator *generatorForFormat(const QString& format);
92
93 protected:
94 virtual void startText(const Node *relative, CodeMarker *marker);
95 virtual void endText(const Node *relative, CodeMarker *marker);
96 virtual int generateAtom(const Atom *atom,
97 const Node *relative,
98 CodeMarker *marker);
99 virtual void generateClassLikeNode(const InnerNode *inner, CodeMarker *marker);
100 virtual void generateFakeNode(const FakeNode *fake, CodeMarker *marker);
101
102 virtual bool generateText(const Text& text,
103 const Node *relative,
104 CodeMarker *marker);
105#ifdef QDOC_QML
106 virtual bool generateQmlText(const Text& text,
107 const Node *relative,
108 CodeMarker *marker,
109 const QString& qmlName);
110 virtual void generateQmlInherits(const QmlClassNode* cn,
111 CodeMarker* marker);
112#endif
113 virtual void generateBody(const Node *node, CodeMarker *marker);
114 virtual void generateAlsoList(const Node *node, CodeMarker *marker);
115 virtual void generateMaintainerList(const InnerNode* node, CodeMarker* marker);
116 virtual void generateInherits(const ClassNode *classe,
117 CodeMarker *marker);
118 virtual void generateInheritedBy(const ClassNode *classe,
119 CodeMarker *marker);
120
121 void generateThreadSafeness(const Node *node, CodeMarker *marker);
122 void generateSince(const Node *node, CodeMarker *marker);
123 void generateStatus(const Node *node, CodeMarker *marker);
124 const Atom* generateAtomList(const Atom *atom,
125 const Node *relative,
126 CodeMarker *marker,
127 bool generate,
128 int& numGeneratedAtoms);
129 void generateFileList(const FakeNode* fake,
130 CodeMarker* marker,
131 Node::SubType subtype,
132 const QString& tag);
133 void generateExampleFiles(const FakeNode *fake, CodeMarker *marker);
134
135 virtual int skipAtoms(const Atom *atom, Atom::Type type) const;
136 virtual QString fullName(const Node *node,
137 const Node *relative,
138 CodeMarker *marker) const;
139
140 virtual QString outFileName() { return QString(); }
141
142 const QString& outputDir() { return outDir; }
143 QString indent(int level, const QString& markedCode);
144 QString plainCode(const QString& markedCode);
145 virtual QString typeString(const Node *node);
146 virtual QString imageFileName(const Node *relative, const QString& fileBase);
147 void setImageFileExtensions(const QStringList& extensions);
148 void unknownAtom(const Atom *atom);
149 QMap<QString, QString> &formattingLeftMap();
150 QMap<QString, QString> &formattingRightMap();
151 QMap<QString, QStringList> editionModuleMap;
152 QMap<QString, QStringList> editionGroupMap;
153
154 static QString trimmedTrailing(const QString &string);
155 static bool matchAhead(const Atom *atom, Atom::Type expectedAtomType);
156 static void supplementAlsoList(const Node *node, QList<Text> &alsoList);
157 static QString outputPrefix(const QString &nodeType);
158
159 QString getMetadataElement(const InnerNode* inner, const QString& t);
160 QStringList getMetadataElements(const InnerNode* inner, const QString& t);
161 void findAllSince(const InnerNode *node);
162
163 private:
164 void generateReimplementedFrom(const FunctionNode *func,
165 CodeMarker *marker);
166 void appendFullName(Text& text,
167 const Node *apparentNode,
168 const Node *relative,
169 CodeMarker *marker,
170 const Node *actualNode = 0);
171 void appendFullName(Text& text,
172 const Node *apparentNode,
173 const QString& fullName,
174 const Node *actualNode);
175 void appendFullNames(Text& text,
176 const NodeList& nodes,
177 const Node* relative,
178 CodeMarker* marker);
179 void appendSortedNames(Text& text,
180 const ClassNode *classe,
181 const QList<RelatedClass> &classes,
182 CodeMarker *marker);
183
184 protected:
185 void appendSortedQmlNames(Text& text,
186 const Node* base,
187 const NodeList& subs,
188 CodeMarker *marker);
189
190 static QString sinceTitles[];
191 NewSinceMaps newSinceMaps;
192 NewClassMaps newClassMaps;
193 NewClassMaps newQmlClassMaps;
194
195 private:
196 QString amp;
197 QString lt;
198 QString gt;
199 QString quot;
200 QRegExp tag;
201
202 static QList<Generator *> generators;
203 static QMap<QString, QMap<QString, QString> > fmtLeftMaps;
204 static QMap<QString, QMap<QString, QString> > fmtRightMaps;
205 static QMap<QString, QStringList> imgFileExts;
206 static QSet<QString> outputFormats;
207 static QStringList imageFiles;
208 static QStringList imageDirs;
209 static QStringList exampleDirs;
210 static QStringList exampleImgExts;
211 static QStringList scriptFiles;
212 static QStringList scriptDirs;
213 static QStringList styleFiles;
214 static QStringList styleDirs;
215 static QString outDir;
216 static QString project;
217 static QHash<QString, QString> outputPrefixes;
218};
219
220QT_END_NAMESPACE
221
222#endif
223

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