author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Fri, 12 Mar 2010 15:46:37 +0200 | |
branch | RCL_3 |
changeset 5 | d3bac044e0f0 |
parent 4 | 3b1da2848fc7 |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the test suite of the Qt Toolkit. |
|
8 |
** |
|
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 |
|
14 |
** this package. |
|
15 |
** |
|
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. |
|
23 |
** |
|
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. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#include <QtDebug> |
|
43 |
||
44 |
#include "qabstractfloat_p.h" |
|
45 |
#include "qandexpression_p.h" |
|
46 |
#include "qanyuri_p.h" |
|
47 |
#include "qapplytemplate_p.h" |
|
48 |
#include "qargumentreference_p.h" |
|
49 |
#include "qarithmeticexpression_p.h" |
|
50 |
#include "qatomicstring_p.h" |
|
51 |
#include "qatomizer_p.h" |
|
52 |
#include "qattributeconstructor_p.h" |
|
53 |
#include "qattributenamevalidator_p.h" |
|
54 |
#include "qaxisstep_p.h" |
|
55 |
#include "qbase64binary_p.h" |
|
56 |
#include "qboolean_p.h" |
|
57 |
#include "qcardinalityverifier_p.h" |
|
58 |
#include "qcastableas_p.h" |
|
59 |
#include "qcastas_p.h" |
|
60 |
#include "qcombinenodes_p.h" |
|
61 |
#include "qcontextitem_p.h" |
|
62 |
#include "qdate_p.h" |
|
63 |
#include "qdecimal_p.h" |
|
64 |
#include "qdynamiccontextstore_p.h" |
|
65 |
#include "qelementconstructor_p.h" |
|
66 |
#include "qemptysequence_p.h" |
|
67 |
#include "qevaluationcache_p.h" |
|
68 |
#include "qexpressionsequence_p.h" |
|
69 |
#include "qexpressionvariablereference_p.h" |
|
70 |
#include "qfirstitempredicate_p.h" |
|
71 |
#include "qforclause_p.h" |
|
72 |
#include "qfunctioncall_p.h" |
|
73 |
#include "qgday_p.h" |
|
74 |
#include "qgeneralcomparison_p.h" |
|
75 |
#include "qgenericpredicate_p.h" |
|
76 |
#include "qgmonthday_p.h" |
|
77 |
#include "qgmonth_p.h" |
|
78 |
#include "qgyearmonth_p.h" |
|
79 |
#include "qgyear_p.h" |
|
80 |
#include "qhexbinary_p.h" |
|
81 |
#include "qifthenclause_p.h" |
|
82 |
#include "qinstanceof_p.h" |
|
83 |
#include "qinteger_p.h" |
|
84 |
#include "qitem_p.h" |
|
85 |
#include "qitemverifier_p.h" |
|
86 |
#include "qliteral_p.h" |
|
87 |
#include "qnamespaceconstructor_p.h" |
|
88 |
#include "qncnameconstructor_p.h" |
|
89 |
#include "qnodecomparison_p.h" |
|
90 |
#include "qorexpression_p.h" |
|
91 |
#include "qpath_p.h" |
|
92 |
#include "qpositionalvariablereference_p.h" |
|
93 |
#include "qqnameconstructor_p.h" |
|
94 |
#include "qqnamevalue_p.h" |
|
95 |
#include "qquantifiedexpression_p.h" |
|
96 |
#include "qrangeexpression_p.h" |
|
97 |
#include "qrangevariablereference_p.h" |
|
98 |
#include "qschemadatetime_p.h" |
|
99 |
#include "qschematime_p.h" |
|
100 |
#include "qsimplecontentconstructor_p.h" |
|
101 |
#include "qtreatas_p.h" |
|
102 |
#include "qtruthpredicate_p.h" |
|
103 |
#include "quntypedatomicconverter_p.h" |
|
104 |
#include "quntypedatomic_p.h" |
|
105 |
#include "quserfunctioncallsite_p.h" |
|
106 |
#include "qvalidationerror_p.h" |
|
107 |
#include "qvaluecomparison_p.h" |
|
108 |
||
109 |
#include "ExpressionInfo.h" |
|
110 |
#include "Global.h" |
|
111 |
||
112 |
#include "ExpressionNamer.h" |
|
113 |
||
114 |
using namespace QPatternistSDK; |
|
115 |
||
116 |
/* Simple ones, they have no additional data. */ |
|
117 |
#define implClass(cls) \ |
|
118 |
QPatternist::ExpressionVisitorResult::Ptr ExpressionNamer::visit(const QPatternist::cls *) const \ |
|
119 |
{ \ |
|
120 |
return QPatternist::ExpressionVisitorResult::Ptr \ |
|
121 |
(new ExpressionInfo(QLatin1String(#cls), QString())); \ |
|
122 |
} |
|
123 |
||
124 |
implClass(AndExpression) |
|
125 |
implClass(ArgumentConverter) |
|
126 |
implClass(Atomizer) |
|
127 |
implClass(AttributeConstructor) |
|
128 |
implClass(AttributeNameValidator) |
|
129 |
implClass(CallTemplate) |
|
130 |
implClass(CardinalityVerifier) |
|
131 |
implClass(CollationChecker) |
|
132 |
implClass(CommentConstructor) |
|
133 |
implClass(ComputedNamespaceConstructor) |
|
134 |
implClass(ContextItem) |
|
135 |
implClass(CopyOf) |
|
136 |
implClass(CurrentItemStore) |
|
137 |
implClass(DocumentConstructor) |
|
138 |
implClass(DynamicContextStore) |
|
139 |
implClass(EBVExtractor) |
|
140 |
implClass(ElementConstructor) |
|
141 |
implClass(EmptySequence) |
|
142 |
implClass(ExpressionSequence) |
|
143 |
implClass(ExternalVariableReference) |
|
144 |
implClass(FirstItemPredicate) |
|
145 |
implClass(ForClause) |
|
146 |
implClass(GenericPredicate) |
|
147 |
implClass(IfThenClause) |
|
148 |
implClass(ItemVerifier) |
|
149 |
implClass(LetClause) |
|
150 |
implClass(LiteralSequence) |
|
151 |
implClass(NCNameConstructor) |
|
152 |
implClass(NodeSortExpression) |
|
153 |
implClass(OrderBy) |
|
154 |
implClass(OrExpression) |
|
155 |
implClass(ParentNodeAxis) |
|
156 |
implClass(ProcessingInstructionConstructor) |
|
157 |
implClass(QNameConstructor) |
|
158 |
implClass(RangeExpression) |
|
159 |
implClass(ReturnOrderBy) |
|
160 |
implClass(SimpleContentConstructor) |
|
161 |
implClass(StaticBaseURIStore) |
|
162 |
implClass(StaticCompatibilityStore) |
|
163 |
implClass(TemplateParameterReference) |
|
164 |
implClass(TextNodeConstructor) |
|
165 |
implClass(TreatAs) |
|
166 |
implClass(TruthPredicate) |
|
167 |
implClass(UnresolvedVariableReference) |
|
168 |
implClass(UntypedAtomicConverter) |
|
169 |
implClass(UserFunctionCallsite) |
|
170 |
implClass(ValidationError) |
|
171 |
#undef implClass |
|
172 |
||
173 |
/** Variable references. */ |
|
174 |
#define implVarRef(name) \ |
|
175 |
QPatternist::ExpressionVisitorResult::Ptr ExpressionNamer::visit(const QPatternist::name *i) const \ |
|
176 |
{ \ |
|
177 |
return QPatternist::ExpressionVisitorResult::Ptr \ |
|
178 |
(new ExpressionInfo(QLatin1String(#name), \ |
|
179 |
QString(QLatin1String("Slot: %1")).arg(i->slot()))); \ |
|
180 |
} |
|
181 |
implVarRef(RangeVariableReference) |
|
182 |
implVarRef(ArgumentReference) |
|
183 |
implVarRef(ExpressionVariableReference) |
|
184 |
implVarRef(PositionalVariableReference) |
|
185 |
#undef implVarRef |
|
186 |
||
187 |
/* Type related classes which have a targetType() function. */ |
|
188 |
#define implTypeClass(cls) \ |
|
189 |
QPatternist::ExpressionVisitorResult::Ptr ExpressionNamer::visit(const QPatternist::cls *i) const \ |
|
190 |
{ \ |
|
191 |
return QPatternist::ExpressionVisitorResult::Ptr(new ExpressionInfo(QLatin1String(#cls), \ |
|
192 |
i->targetType()->displayName(Global::namePool()))); \ |
|
193 |
} |
|
194 |
||
195 |
implTypeClass(InstanceOf) |
|
196 |
implTypeClass(CastableAs) |
|
197 |
#undef implTypeClass |
|
198 |
||
199 |
/* Type related classes which have a targetType() function. */ |
|
200 |
QPatternist::ExpressionVisitorResult::Ptr ExpressionNamer::visit(const QPatternist::CastAs *i) const |
|
201 |
{ |
|
202 |
return QPatternist::ExpressionVisitorResult::Ptr(new ExpressionInfo(QLatin1String("CastAs"), |
|
203 |
i->targetSequenceType()->displayName(Global::namePool()))); |
|
204 |
} |
|
205 |
||
206 |
/* Classes which represent operators. */ |
|
207 |
#define implOPClass(cls, compClass) \ |
|
208 |
QPatternist::ExpressionVisitorResult::Ptr ExpressionNamer::visit(const QPatternist::cls *i) const \ |
|
209 |
{ \ |
|
210 |
return QPatternist::ExpressionVisitorResult::Ptr(new ExpressionInfo(QLatin1String(#cls), \ |
|
211 |
QPatternist::compClass::displayName(i->operatorID()))); \ |
|
212 |
} |
|
213 |
||
214 |
implOPClass(ArithmeticExpression, AtomicMathematician) |
|
215 |
implOPClass(NodeComparison, NodeComparison) |
|
216 |
implOPClass(QuantifiedExpression, QuantifiedExpression) |
|
217 |
implOPClass(CombineNodes, CombineNodes) |
|
218 |
#undef implOPClass |
|
219 |
||
220 |
/* Classes which represent operators. */ |
|
221 |
#define implCompClass(cls, type) \ |
|
222 |
QPatternist::ExpressionVisitorResult::Ptr ExpressionNamer::visit(const QPatternist::cls *i) const \ |
|
223 |
{ \ |
|
224 |
return QPatternist::ExpressionVisitorResult::Ptr(new ExpressionInfo(QLatin1String(#cls), \ |
|
225 |
QPatternist::AtomicComparator::displayName(i->operatorID(), \ |
|
226 |
QPatternist::AtomicComparator::type))); \ |
|
227 |
} |
|
228 |
||
229 |
implCompClass(GeneralComparison, AsGeneralComparison) |
|
230 |
implCompClass(ValueComparison, AsValueComparison) |
|
231 |
#undef implCompClass |
|
232 |
||
233 |
QPatternist::ExpressionVisitorResult::Ptr ExpressionNamer::visit(const QPatternist::FunctionCall *i) const |
|
234 |
{ |
|
235 |
return QPatternist::ExpressionVisitorResult::Ptr |
|
236 |
(new ExpressionInfo(QLatin1String("FunctionCall"), |
|
237 |
Global::namePool()->displayName(i->signature()->name()))); |
|
238 |
} |
|
239 |
||
240 |
QPatternist::ExpressionVisitorResult::Ptr ExpressionNamer::visit(const QPatternist::Literal *i) const |
|
241 |
{ |
|
242 |
return QPatternist::ExpressionVisitorResult::Ptr(new ExpressionInfo( |
|
243 |
i->item().type()->displayName(Global::namePool()), |
|
244 |
i->item().stringValue())); |
|
245 |
} |
|
246 |
||
247 |
QPatternist::ExpressionVisitorResult::Ptr ExpressionNamer::visit(const QPatternist::AxisStep *i) const |
|
248 |
{ |
|
249 |
return QPatternist::ExpressionVisitorResult::Ptr(new ExpressionInfo(QLatin1String("AxisStep"), |
|
250 |
QPatternist::AxisStep::axisName(i->axis()) + |
|
251 |
QLatin1String("::") + |
|
252 |
i->nodeTest()->displayName(Global::namePool()))); |
|
253 |
||
254 |
} |
|
255 |
||
256 |
||
257 |
QPatternist::ExpressionVisitorResult::Ptr ExpressionNamer::visit(const QPatternist::EvaluationCache<true> *i) const |
|
258 |
{ |
|
259 |
return QPatternist::ExpressionVisitorResult::Ptr(new ExpressionInfo(QLatin1String("EvaluationCache<IsForGlobal=true>"), |
|
260 |
QLatin1String("Slot: ") + QString::number(i->slot()))); |
|
261 |
||
262 |
} |
|
263 |
||
264 |
QPatternist::ExpressionVisitorResult::Ptr ExpressionNamer::visit(const QPatternist::EvaluationCache<false> *i) const |
|
265 |
{ |
|
266 |
return QPatternist::ExpressionVisitorResult::Ptr(new ExpressionInfo(QLatin1String("EvaluationCache<IsForGlobal=false>"), |
|
267 |
QLatin1String("Slot: ") + QString::number(i->slot()))); |
|
268 |
||
269 |
} |
|
270 |
||
271 |
QPatternist::ExpressionVisitorResult::Ptr ExpressionNamer::visit(const QPatternist::NamespaceConstructor *i) const |
|
272 |
{ |
|
273 |
return QPatternist::ExpressionVisitorResult::Ptr(new ExpressionInfo(QLatin1String("NamespaceConstructor"), |
|
274 |
Global::namePool()->stringForPrefix(i->namespaceBinding().prefix()) + |
|
275 |
QLatin1Char('=') + |
|
276 |
Global::namePool()->stringForNamespace(i->namespaceBinding().namespaceURI()))); |
|
277 |
||
278 |
} |
|
279 |
||
280 |
QPatternist::ExpressionVisitorResult::Ptr ExpressionNamer::visit(const QPatternist::Path *path) const |
|
281 |
{ |
|
282 |
||
283 |
QPatternist::Path::Kind k = path->kind(); |
|
284 |
QString type; |
|
285 |
||
286 |
switch(k) |
|
287 |
{ |
|
288 |
case QPatternist::Path::XSLTForEach: |
|
289 |
{ |
|
290 |
type = QLatin1String("XSLTForEach"); |
|
291 |
break; |
|
292 |
} |
|
293 |
case QPatternist::Path::RegularPath: |
|
294 |
{ |
|
295 |
type = QLatin1String("RegularPath"); |
|
296 |
break; |
|
297 |
} |
|
298 |
case QPatternist::Path::ForApplyTemplate: |
|
299 |
{ |
|
300 |
type = QLatin1String("ForApplyTemplate"); |
|
301 |
break; |
|
302 |
} |
|
303 |
} |
|
304 |
||
305 |
return QPatternist::ExpressionVisitorResult::Ptr(new ExpressionInfo(QLatin1String("Path"), type)); |
|
306 |
} |
|
307 |
||
308 |
QPatternist::ExpressionVisitorResult::Ptr ExpressionNamer::visit(const QPatternist::ApplyTemplate *path) const |
|
309 |
{ |
|
310 |
const QPatternist::TemplateMode::Ptr mode(path->mode()); |
|
311 |
return QPatternist::ExpressionVisitorResult::Ptr |
|
312 |
(new ExpressionInfo(QLatin1String("ApplyTemplate"), mode ? Global::namePool()->displayName(mode->name()) : QString::fromLatin1("#current"))); |
|
313 |
} |
|
314 |
||
315 |
// vim: et:ts=4:sw=4:sts=4 |
|
316 |