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 ****************************************************************************/
61 QString singularMember
;
64 NodeList reimpMembers
;
65 QList
<QPair
<ClassNode
*, int> > inherited
;
68 Section(const QString
& name0
,
69 const QString
& singularMember0
,
70 const QString
& pluralMember0
)
72 singularMember(singularMember0
),
73 pluralMember(pluralMember0
) { }
74 void appendMember(Node
* node
) { members
.append(node
); }
75 void appendReimpMember(Node
* node
) { reimpMembers
.append(node
); }
80 const InnerNode
*innerNode
;
82 QString singularMember
;
84 QMap
<QString
, Node
*> memberMap
;
85 QMap
<QString
, Node
*> reimpMemberMap
;
86 QList
<QPair
<ClassNode
*, int> > inherited
;
88 FastSection(const InnerNode
*innerNode0
,
89 const QString
& name0
= "",
90 const QString
& singularMember0
= "member",
91 const QString
& pluralMember0
= "members")
92 : innerNode(innerNode0
),
94 singularMember(singularMember0
),
95 pluralMember(pluralMember0
) { }
96 bool isEmpty() const {
97 return (memberMap
.isEmpty() && inherited
.isEmpty() &&
98 reimpMemberMap
.isEmpty());
106 enum SynopsisStyle
{ Summary
, Detailed
, SeparateList
, Accessors
};
107 enum Status
{ Compat
, Obsolete
, Okay
};
110 virtual ~CodeMarker();
112 virtual void initializeMarker(const Config
& config
);
113 virtual void terminateMarker();
114 virtual bool recognizeCode(const QString
& code
) = 0;
115 virtual bool recognizeExtension(const QString
& ext
) = 0;
116 virtual bool recognizeLanguage(const QString
& lang
) = 0;
117 virtual QString
plainName(const Node
*node
) = 0;
118 virtual QString
plainFullName(const Node
*node
,
119 const Node
*relative
= 0) = 0;
120 virtual QString
markedUpCode(const QString
& code
,
121 const Node
*relative
,
122 const QString
& dirPath
) = 0;
123 virtual QString
markedUpSynopsis(const Node
*node
,
124 const Node
*relative
,
125 SynopsisStyle style
) = 0;
127 virtual QString
markedUpQmlItem(const Node
* , bool) { return QString(); }
129 virtual QString
markedUpName(const Node
*node
) = 0;
130 virtual QString
markedUpFullName(const Node
*node
,
131 const Node
*relative
= 0) = 0;
132 virtual QString
markedUpEnumValue(const QString
&enumValue
,
133 const Node
*relative
) = 0;
134 virtual QString
markedUpIncludes(const QStringList
& includes
) = 0;
135 virtual QString
functionBeginRegExp(const QString
& funcName
) = 0;
136 virtual QString
functionEndRegExp(const QString
& funcName
) = 0;
137 virtual QList
<Section
> sections(const InnerNode
*inner
,
141 virtual QList
<Section
> qmlSections(const QmlClassNode
* qmlClassNode
,
142 SynopsisStyle style
);
144 virtual const Node
*resolveTarget(const QString
& target
,
146 const Node
*relative
) = 0;
147 virtual QStringList
macRefsForNode(const Node
*node
);
149 static void initialize(const Config
& config
);
150 static void terminate();
151 static CodeMarker
*markerForCode(const QString
& code
);
152 static CodeMarker
*markerForFileName(const QString
& fileName
);
153 static CodeMarker
*markerForLanguage(const QString
& lang
);
154 static const Node
*nodeForString(const QString
& string
);
155 static QString
stringForNode(const Node
*node
);
158 bool hurryUp() const { return !slow
; }
160 virtual QString
sortName(const Node
*node
);
161 QString
protect(const QString
&string
);
162 QString
typified(const QString
&string
);
163 QString
taggedNode(const Node
* node
);
165 QString
taggedQmlNode(const Node
* node
);
167 QString
linkTag(const Node
*node
, const QString
& body
);
168 void insert(FastSection
&fastSection
,
172 bool insertReimpFunc(FastSection
& fs
, Node
* node
, Status status
);
173 void append(QList
<Section
>& sectionList
, const FastSection
& fastSection
);
176 QString
macName(const Node
*parent
, const QString
&name
= QString());
180 static QString defaultLang
;
181 static QList
<CodeMarker
*> markers
;