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 codemarker.h
44*/
45
46#ifndef CODEMARKER_H
47#define CODEMARKER_H
48
49#include <qpair.h>
50
51#include "atom.h"
52#include "node.h"
53
54QT_BEGIN_NAMESPACE
55
56class Config;
57class Tree;
58
59struct Section
60{
61 QString name;
62 QString divClass;
63 QString singularMember;
64 QString pluralMember;
65 NodeList members;
66 NodeList reimpMembers;
67 QList<QPair<ClassNode *, int> > inherited;
68
69 Section() { }
70 Section(const QString& name0,
71 const QString& divClass0,
72 const QString& singularMember0,
73 const QString& pluralMember0)
74 : name(name0),
75 divClass(divClass0),
76 singularMember(singularMember0),
77 pluralMember(pluralMember0) { }
78 void appendMember(Node* node) { members.append(node); }
79 void appendReimpMember(Node* node) { reimpMembers.append(node); }
80};
81
82struct FastSection
83{
84 const InnerNode *innerNode;
85 QString name;
86 QString divClass;
87 QString singularMember;
88 QString pluralMember;
89 QMap<QString, Node *> memberMap;
90 QMap<QString, Node *> reimpMemberMap;
91 QList<QPair<ClassNode *, int> > inherited;
92
93 FastSection(const InnerNode *innerNode0,
94 const QString& name0,
95 const QString& divClass0,
96 const QString& singularMember0,
97 const QString& pluralMember0)
98 : innerNode(innerNode0),
99 name(name0),
100 divClass(divClass0),
101 singularMember(singularMember0),
102 pluralMember(pluralMember0) { }
103 bool isEmpty() const {
104 return (memberMap.isEmpty() &&
105 inherited.isEmpty() &&
106 reimpMemberMap.isEmpty());
107 }
108
109};
110
111class CodeMarker
112{
113 public:
114 enum SynopsisStyle { Summary, Detailed, SeparateList, Accessors };
115 enum Status { Compat, Obsolete, Okay };
116
117 CodeMarker();
118 virtual ~CodeMarker();
119
120 virtual void initializeMarker(const Config& config);
121 virtual void terminateMarker();
122 virtual bool recognizeCode(const QString& code) = 0;
123 virtual bool recognizeExtension(const QString& ext) = 0;
124 virtual bool recognizeLanguage(const QString& lang) = 0;
125 virtual Atom::Type atomType() const = 0;
126 virtual QString plainName(const Node *node) = 0;
127 virtual QString plainFullName(const Node *node,
128 const Node *relative = 0) = 0;
129 virtual QString markedUpCode(const QString& code,
130 const Node *relative,
131 const Location &location) = 0;
132 virtual QString markedUpSynopsis(const Node *node,
133 const Node *relative,
134 SynopsisStyle style) = 0;
135#ifdef QDOC_QML
136 virtual QString markedUpQmlItem(const Node* , bool) { return QString(); }
137#endif
138 virtual QString markedUpName(const Node *node) = 0;
139 virtual QString markedUpFullName(const Node *node,
140 const Node *relative = 0) = 0;
141 virtual QString markedUpEnumValue(const QString &enumValue,
142 const Node *relative) = 0;
143 virtual QString markedUpIncludes(const QStringList& includes) = 0;
144 virtual QString functionBeginRegExp(const QString& funcName) = 0;
145 virtual QString functionEndRegExp(const QString& funcName) = 0;
146 virtual QList<Section> sections(const InnerNode *inner,
147 SynopsisStyle style,
148 Status status) = 0;
149#ifdef QDOC_QML
150 virtual QList<Section> qmlSections(const QmlClassNode* qmlClassNode,
151 SynopsisStyle style,
152 const Tree* tree);
153#endif
154 virtual const Node* resolveTarget(const QString& target,
155 const Tree* tree,
156 const Node* relative,
157 const Node* self = 0);
158 virtual QStringList macRefsForNode(Node* node);
159
160 static void initialize(const Config& config);
161 static void terminate();
162 static CodeMarker *markerForCode(const QString& code);
163 static CodeMarker *markerForFileName(const QString& fileName);
164 static CodeMarker *markerForLanguage(const QString& lang);
165 static const Node *nodeForString(const QString& string);
166 static QString stringForNode(const Node *node);
167
168 QString typified(const QString &string);
169
170 protected:
171 virtual QString sortName(const Node *node);
172 QString protect(const QString &string);
173 QString taggedNode(const Node* node);
174#ifdef QDOC_QML
175 QString taggedQmlNode(const Node* node);
176#endif
177 QString linkTag(const Node *node, const QString& body);
178 void insert(FastSection &fastSection,
179 Node *node,
180 SynopsisStyle style,
181 Status status);
182 bool insertReimpFunc(FastSection& fs, Node* node, Status status);
183 void append(QList<Section>& sectionList, const FastSection& fastSection);
184
185 private:
186 QString macName(const Node *parent, const QString &name = QString());
187
188 static QString defaultLang;
189 static QList<CodeMarker *> markers;
190};
191
192QT_END_NAMESPACE
193
194#endif
195

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