1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the QtXmlPatterns module 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 The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/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 3 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 3 requirements |
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
24 | ** |
25 | ** GNU General Public License Usage |
26 | ** Alternatively, this file may be used under the terms of the GNU |
27 | ** General Public License version 2.0 or (at your option) the GNU General |
28 | ** Public license version 3 or any later version approved by the KDE Free |
29 | ** Qt Foundation. The licenses are as published by the Free Software |
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
31 | ** included in the packaging of this file. Please review the following |
32 | ** information to ensure the GNU General Public License requirements will |
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
35 | ** |
36 | ** $QT_END_LICENSE$ |
37 | ** |
38 | ****************************************************************************/ |
39 | |
40 | // |
41 | // W A R N I N G |
42 | // ------------- |
43 | // |
44 | // This file is not part of the Qt API. It exists purely as an |
45 | // implementation detail. This header file may change from version to |
46 | // version without notice, or even be removed. |
47 | // |
48 | // We mean it. |
49 | |
50 | #ifndef Patternist_AtomicCasterLocators_H |
51 | #define Patternist_AtomicCasterLocators_H |
52 | |
53 | #include <private/qatomiccasterlocator_p.h> |
54 | #include <private/qatomiccasters_p.h> |
55 | //#include <private/qderivedinteger_p.h> |
56 | |
57 | /** |
58 | * @file |
59 | * @short Contains AtomicCasterLocator sub-classes that finds classes |
60 | * which can perform casting from one atomic value to another. |
61 | */ |
62 | |
63 | QT_BEGIN_NAMESPACE |
64 | |
65 | namespace QPatternist |
66 | { |
67 | /** |
68 | * @author Frans Englich <frans.englich@nokia.com> |
69 | */ |
70 | class ToStringCasterLocator : public AtomicCasterLocator |
71 | { |
72 | public: |
73 | using AtomicCasterLocator::visit; |
74 | AtomicTypeVisitorResult::Ptr visit(const AnyURIType *, |
75 | const SourceLocationReflection *const r) const override; |
76 | AtomicTypeVisitorResult::Ptr visit(const Base64BinaryType *, |
77 | const SourceLocationReflection *const r) const override; |
78 | AtomicTypeVisitorResult::Ptr visit(const BooleanType *, |
79 | const SourceLocationReflection *const r) const override; |
80 | AtomicTypeVisitorResult::Ptr visit(const DateTimeType *, |
81 | const SourceLocationReflection *const r) const override; |
82 | AtomicTypeVisitorResult::Ptr visit(const DateType *, |
83 | const SourceLocationReflection *const r) const override; |
84 | AtomicTypeVisitorResult::Ptr visit(const DayTimeDurationType *, |
85 | const SourceLocationReflection *const r) const override; |
86 | AtomicTypeVisitorResult::Ptr visit(const DecimalType *, |
87 | const SourceLocationReflection *const r) const override; |
88 | AtomicTypeVisitorResult::Ptr visit(const DoubleType *, |
89 | const SourceLocationReflection *const r) const override; |
90 | AtomicTypeVisitorResult::Ptr visit(const DurationType *, |
91 | const SourceLocationReflection *const r) const override; |
92 | AtomicTypeVisitorResult::Ptr visit(const FloatType *, |
93 | const SourceLocationReflection *const r) const override; |
94 | AtomicTypeVisitorResult::Ptr visit(const GDayType *, |
95 | const SourceLocationReflection *const r) const override; |
96 | AtomicTypeVisitorResult::Ptr visit(const GMonthDayType *, |
97 | const SourceLocationReflection *const r) const override; |
98 | AtomicTypeVisitorResult::Ptr visit(const GMonthType *, |
99 | const SourceLocationReflection *const r) const override; |
100 | AtomicTypeVisitorResult::Ptr visit(const GYearMonthType *, |
101 | const SourceLocationReflection *const r) const override; |
102 | AtomicTypeVisitorResult::Ptr visit(const GYearType *, |
103 | const SourceLocationReflection *const r) const override; |
104 | AtomicTypeVisitorResult::Ptr visit(const HexBinaryType *, |
105 | const SourceLocationReflection *const r) const override; |
106 | AtomicTypeVisitorResult::Ptr visit(const IntegerType *, |
107 | const SourceLocationReflection *const r) const override; |
108 | AtomicTypeVisitorResult::Ptr visit(const NOTATIONType *, |
109 | const SourceLocationReflection *const r) const override; |
110 | AtomicTypeVisitorResult::Ptr visit(const QNameType *, |
111 | const SourceLocationReflection *const r) const override; |
112 | AtomicTypeVisitorResult::Ptr visit(const StringType *, |
113 | const SourceLocationReflection *const r) const override; |
114 | AtomicTypeVisitorResult::Ptr visit(const SchemaTimeType *, |
115 | const SourceLocationReflection *const r) const override; |
116 | AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *, |
117 | const SourceLocationReflection *const r) const override; |
118 | AtomicTypeVisitorResult::Ptr visit(const YearMonthDurationType *, |
119 | const SourceLocationReflection *const r) const override; |
120 | }; |
121 | |
122 | /** |
123 | * @author Frans Englich <frans.englich@nokia.com> |
124 | */ |
125 | class ToUntypedAtomicCasterLocator : public AtomicCasterLocator |
126 | { |
127 | public: |
128 | using AtomicCasterLocator::visit; |
129 | AtomicTypeVisitorResult::Ptr visit(const AnyURIType *, |
130 | const SourceLocationReflection *const r) const override; |
131 | AtomicTypeVisitorResult::Ptr visit(const Base64BinaryType *, |
132 | const SourceLocationReflection *const r) const override; |
133 | AtomicTypeVisitorResult::Ptr visit(const BooleanType *, |
134 | const SourceLocationReflection *const r) const override; |
135 | AtomicTypeVisitorResult::Ptr visit(const DateTimeType *, |
136 | const SourceLocationReflection *const r) const override; |
137 | AtomicTypeVisitorResult::Ptr visit(const DateType *, |
138 | const SourceLocationReflection *const r) const override; |
139 | AtomicTypeVisitorResult::Ptr visit(const DayTimeDurationType *, |
140 | const SourceLocationReflection *const r) const override; |
141 | AtomicTypeVisitorResult::Ptr visit(const DecimalType *, |
142 | const SourceLocationReflection *const r) const override; |
143 | AtomicTypeVisitorResult::Ptr visit(const DoubleType *, |
144 | const SourceLocationReflection *const r) const override; |
145 | AtomicTypeVisitorResult::Ptr visit(const DurationType *, |
146 | const SourceLocationReflection *const r) const override; |
147 | AtomicTypeVisitorResult::Ptr visit(const FloatType *, |
148 | const SourceLocationReflection *const r) const override; |
149 | AtomicTypeVisitorResult::Ptr visit(const GDayType *, |
150 | const SourceLocationReflection *const r) const override; |
151 | AtomicTypeVisitorResult::Ptr visit(const GMonthDayType *, |
152 | const SourceLocationReflection *const r) const override; |
153 | AtomicTypeVisitorResult::Ptr visit(const GMonthType *, |
154 | const SourceLocationReflection *const r) const override; |
155 | AtomicTypeVisitorResult::Ptr visit(const GYearMonthType *, |
156 | const SourceLocationReflection *const r) const override; |
157 | AtomicTypeVisitorResult::Ptr visit(const GYearType *, |
158 | const SourceLocationReflection *const r) const override; |
159 | AtomicTypeVisitorResult::Ptr visit(const HexBinaryType *, |
160 | const SourceLocationReflection *const r) const override; |
161 | AtomicTypeVisitorResult::Ptr visit(const IntegerType *, |
162 | const SourceLocationReflection *const r) const override; |
163 | AtomicTypeVisitorResult::Ptr visit(const NOTATIONType *, |
164 | const SourceLocationReflection *const r) const override; |
165 | AtomicTypeVisitorResult::Ptr visit(const QNameType *, |
166 | const SourceLocationReflection *const r) const override; |
167 | AtomicTypeVisitorResult::Ptr visit(const StringType *, |
168 | const SourceLocationReflection *const r) const override; |
169 | AtomicTypeVisitorResult::Ptr visit(const SchemaTimeType *, |
170 | const SourceLocationReflection *const r) const override; |
171 | AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *, |
172 | const SourceLocationReflection *const r) const override; |
173 | AtomicTypeVisitorResult::Ptr visit(const YearMonthDurationType *, |
174 | const SourceLocationReflection *const r) const override; |
175 | }; |
176 | |
177 | /** |
178 | * @author Frans Englich <frans.englich@nokia.com> |
179 | */ |
180 | class ToAnyURICasterLocator : public AtomicCasterLocator |
181 | { |
182 | public: |
183 | using AtomicCasterLocator::visit; |
184 | AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *, |
185 | const SourceLocationReflection *const r) const override; |
186 | AtomicTypeVisitorResult::Ptr visit(const StringType *, |
187 | const SourceLocationReflection *const r) const override; |
188 | AtomicTypeVisitorResult::Ptr visit(const AnyURIType *, |
189 | const SourceLocationReflection *const r) const override; |
190 | }; |
191 | |
192 | /** |
193 | * @author Frans Englich <frans.englich@nokia.com> |
194 | */ |
195 | class ToBooleanCasterLocator : public AtomicCasterLocator |
196 | { |
197 | public: |
198 | using AtomicCasterLocator::visit; |
199 | AtomicTypeVisitorResult::Ptr visit(const BooleanType *, |
200 | const SourceLocationReflection *const r) const override; |
201 | AtomicTypeVisitorResult::Ptr visit(const DecimalType *, |
202 | const SourceLocationReflection *const r) const override; |
203 | AtomicTypeVisitorResult::Ptr visit(const DoubleType *, |
204 | const SourceLocationReflection *const r) const override; |
205 | AtomicTypeVisitorResult::Ptr visit(const FloatType *, |
206 | const SourceLocationReflection *const r) const override; |
207 | AtomicTypeVisitorResult::Ptr visit(const IntegerType *, |
208 | const SourceLocationReflection *const r) const override; |
209 | AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *, |
210 | const SourceLocationReflection *const r) const override; |
211 | AtomicTypeVisitorResult::Ptr visit(const StringType *, |
212 | const SourceLocationReflection *const r) const override; |
213 | }; |
214 | |
215 | /** |
216 | * @author Frans Englich <frans.englich@nokia.com> |
217 | */ |
218 | class ToDoubleCasterLocator : public AtomicCasterLocator |
219 | { |
220 | public: |
221 | using AtomicCasterLocator::visit; |
222 | AtomicTypeVisitorResult::Ptr visit(const BooleanType *, |
223 | const SourceLocationReflection *const r) const override; |
224 | AtomicTypeVisitorResult::Ptr visit(const DoubleType *, |
225 | const SourceLocationReflection *const r) const override; |
226 | AtomicTypeVisitorResult::Ptr visit(const DecimalType *, |
227 | const SourceLocationReflection *const r) const override; |
228 | AtomicTypeVisitorResult::Ptr visit(const FloatType *, |
229 | const SourceLocationReflection *const r) const override; |
230 | AtomicTypeVisitorResult::Ptr visit(const IntegerType *, |
231 | const SourceLocationReflection *const r) const override; |
232 | AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *, |
233 | const SourceLocationReflection *const r) const override; |
234 | AtomicTypeVisitorResult::Ptr visit(const StringType *, |
235 | const SourceLocationReflection *const r) const override; |
236 | }; |
237 | |
238 | /** |
239 | * @author Frans Englich <frans.englich@nokia.com> |
240 | */ |
241 | class ToFloatCasterLocator : public AtomicCasterLocator |
242 | { |
243 | public: |
244 | using AtomicCasterLocator::visit; |
245 | AtomicTypeVisitorResult::Ptr visit(const BooleanType *, |
246 | const SourceLocationReflection *const r) const override; |
247 | AtomicTypeVisitorResult::Ptr visit(const DecimalType *, |
248 | const SourceLocationReflection *const r) const override; |
249 | AtomicTypeVisitorResult::Ptr visit(const DoubleType *, |
250 | const SourceLocationReflection *const r) const override; |
251 | AtomicTypeVisitorResult::Ptr visit(const FloatType *, |
252 | const SourceLocationReflection *const r) const override; |
253 | AtomicTypeVisitorResult::Ptr visit(const IntegerType *, |
254 | const SourceLocationReflection *const r) const override; |
255 | AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *, |
256 | const SourceLocationReflection *const r) const override; |
257 | AtomicTypeVisitorResult::Ptr visit(const StringType *, |
258 | const SourceLocationReflection *const r) const override; |
259 | }; |
260 | |
261 | /** |
262 | * @author Frans Englich <frans.englich@nokia.com> |
263 | */ |
264 | class ToDecimalCasterLocator : public AtomicCasterLocator |
265 | { |
266 | public: |
267 | using AtomicCasterLocator::visit; |
268 | AtomicTypeVisitorResult::Ptr visit(const BooleanType *, |
269 | const SourceLocationReflection *const r) const override; |
270 | AtomicTypeVisitorResult::Ptr visit(const DecimalType *, |
271 | const SourceLocationReflection *const r) const override; |
272 | AtomicTypeVisitorResult::Ptr visit(const DoubleType *, |
273 | const SourceLocationReflection *const r) const override; |
274 | AtomicTypeVisitorResult::Ptr visit(const FloatType *, |
275 | const SourceLocationReflection *const r) const override; |
276 | AtomicTypeVisitorResult::Ptr visit(const IntegerType *, |
277 | const SourceLocationReflection *const r) const override; |
278 | AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *, |
279 | const SourceLocationReflection *const r) const override; |
280 | AtomicTypeVisitorResult::Ptr visit(const StringType *, |
281 | const SourceLocationReflection *const r) const override; |
282 | }; |
283 | |
284 | /** |
285 | * @author Frans Englich <frans.englich@nokia.com> |
286 | */ |
287 | class ToIntegerCasterLocator : public AtomicCasterLocator |
288 | { |
289 | public: |
290 | using AtomicCasterLocator::visit; |
291 | AtomicTypeVisitorResult::Ptr visit(const BooleanType *, |
292 | const SourceLocationReflection *const r) const override; |
293 | AtomicTypeVisitorResult::Ptr visit(const DecimalType *, |
294 | const SourceLocationReflection *const r) const override; |
295 | AtomicTypeVisitorResult::Ptr visit(const DoubleType *, |
296 | const SourceLocationReflection *const r) const override; |
297 | AtomicTypeVisitorResult::Ptr visit(const FloatType *, |
298 | const SourceLocationReflection *const r) const override; |
299 | AtomicTypeVisitorResult::Ptr visit(const IntegerType *, |
300 | const SourceLocationReflection *const r) const override; |
301 | AtomicTypeVisitorResult::Ptr visit(const StringType *, |
302 | const SourceLocationReflection *const r) const override; |
303 | AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *, |
304 | const SourceLocationReflection *const r) const override; |
305 | }; |
306 | |
307 | /** |
308 | * @author Frans Englich <frans.englich@nokia.com> |
309 | */ |
310 | class ToBase64BinaryCasterLocator : public AtomicCasterLocator |
311 | { |
312 | public: |
313 | using AtomicCasterLocator::visit; |
314 | AtomicTypeVisitorResult::Ptr visit(const Base64BinaryType *, |
315 | const SourceLocationReflection *const r) const override; |
316 | AtomicTypeVisitorResult::Ptr visit(const HexBinaryType *, |
317 | const SourceLocationReflection *const r) const override; |
318 | AtomicTypeVisitorResult::Ptr visit(const StringType *, |
319 | const SourceLocationReflection *const r) const override; |
320 | AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *, |
321 | const SourceLocationReflection *const r) const override; |
322 | }; |
323 | |
324 | /** |
325 | * @author Frans Englich <frans.englich@nokia.com> |
326 | */ |
327 | class ToHexBinaryCasterLocator : public AtomicCasterLocator |
328 | { |
329 | public: |
330 | using AtomicCasterLocator::visit; |
331 | AtomicTypeVisitorResult::Ptr visit(const Base64BinaryType *, |
332 | const SourceLocationReflection *const r) const override; |
333 | AtomicTypeVisitorResult::Ptr visit(const HexBinaryType *, |
334 | const SourceLocationReflection *const r) const override; |
335 | AtomicTypeVisitorResult::Ptr visit(const StringType *, |
336 | const SourceLocationReflection *const r) const override; |
337 | AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *, |
338 | const SourceLocationReflection *const r) const override; |
339 | }; |
340 | |
341 | /** |
342 | * @author Frans Englich <frans.englich@nokia.com> |
343 | */ |
344 | class ToQNameCasterLocator : public AtomicCasterLocator |
345 | { |
346 | public: |
347 | using AtomicCasterLocator::visit; |
348 | AtomicTypeVisitorResult::Ptr visit(const QNameType *, |
349 | const SourceLocationReflection *const r) const override; |
350 | AtomicTypeVisitorResult::Ptr visit(const StringType *, |
351 | const SourceLocationReflection *const r) const override; |
352 | }; |
353 | |
354 | /** |
355 | * @author Frans Englich <frans.englich@nokia.com> |
356 | */ |
357 | class ToGYearCasterLocator : public AtomicCasterLocator |
358 | { |
359 | public: |
360 | using AtomicCasterLocator::visit; |
361 | AtomicTypeVisitorResult::Ptr visit(const DateTimeType *, |
362 | const SourceLocationReflection *const r) const override; |
363 | AtomicTypeVisitorResult::Ptr visit(const DateType *, |
364 | const SourceLocationReflection *const r) const override; |
365 | AtomicTypeVisitorResult::Ptr visit(const GYearType *, |
366 | const SourceLocationReflection *const r) const override; |
367 | AtomicTypeVisitorResult::Ptr visit(const StringType *, |
368 | const SourceLocationReflection *const r) const override; |
369 | AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *, |
370 | const SourceLocationReflection *const r) const override; |
371 | }; |
372 | |
373 | /** |
374 | * @author Frans Englich <frans.englich@nokia.com> |
375 | */ |
376 | class ToGDayCasterLocator : public AtomicCasterLocator |
377 | { |
378 | public: |
379 | using AtomicCasterLocator::visit; |
380 | AtomicTypeVisitorResult::Ptr visit(const DateTimeType *, |
381 | const SourceLocationReflection *const r) const override; |
382 | AtomicTypeVisitorResult::Ptr visit(const DateType *, |
383 | const SourceLocationReflection *const r) const override; |
384 | AtomicTypeVisitorResult::Ptr visit(const GDayType *, |
385 | const SourceLocationReflection *const r) const override; |
386 | AtomicTypeVisitorResult::Ptr visit(const StringType *, |
387 | const SourceLocationReflection *const r) const override; |
388 | AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *, |
389 | const SourceLocationReflection *const r) const override; |
390 | }; |
391 | |
392 | /** |
393 | * @author Frans Englich <frans.englich@nokia.com> |
394 | */ |
395 | class ToGMonthCasterLocator : public AtomicCasterLocator |
396 | { |
397 | public: |
398 | using AtomicCasterLocator::visit; |
399 | AtomicTypeVisitorResult::Ptr visit(const DateTimeType *, |
400 | const SourceLocationReflection *const r) const override; |
401 | AtomicTypeVisitorResult::Ptr visit(const DateType *, |
402 | const SourceLocationReflection *const r) const override; |
403 | AtomicTypeVisitorResult::Ptr visit(const GMonthType *, |
404 | const SourceLocationReflection *const r) const override; |
405 | AtomicTypeVisitorResult::Ptr visit(const StringType *, |
406 | const SourceLocationReflection *const r) const override; |
407 | AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *, |
408 | const SourceLocationReflection *const r) const override; |
409 | }; |
410 | |
411 | /** |
412 | * @author Frans Englich <frans.englich@nokia.com> |
413 | */ |
414 | class ToGYearMonthCasterLocator : public AtomicCasterLocator |
415 | { |
416 | public: |
417 | using AtomicCasterLocator::visit; |
418 | AtomicTypeVisitorResult::Ptr visit(const DateTimeType *, |
419 | const SourceLocationReflection *const r) const override; |
420 | AtomicTypeVisitorResult::Ptr visit(const DateType *, |
421 | const SourceLocationReflection *const r) const override; |
422 | AtomicTypeVisitorResult::Ptr visit(const GYearMonthType *, |
423 | const SourceLocationReflection *const r) const override; |
424 | AtomicTypeVisitorResult::Ptr visit(const StringType *, |
425 | const SourceLocationReflection *const r) const override; |
426 | AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *, |
427 | const SourceLocationReflection *const r) const override; |
428 | }; |
429 | |
430 | /** |
431 | * @author Frans Englich <frans.englich@nokia.com> |
432 | */ |
433 | class ToGMonthDayCasterLocator : public AtomicCasterLocator |
434 | { |
435 | public: |
436 | using AtomicCasterLocator::visit; |
437 | AtomicTypeVisitorResult::Ptr visit(const DateTimeType *, |
438 | const SourceLocationReflection *const r) const override; |
439 | AtomicTypeVisitorResult::Ptr visit(const DateType *, |
440 | const SourceLocationReflection *const r) const override; |
441 | AtomicTypeVisitorResult::Ptr visit(const GMonthDayType *, |
442 | const SourceLocationReflection *const r) const override; |
443 | AtomicTypeVisitorResult::Ptr visit(const StringType *, |
444 | const SourceLocationReflection *const r) const override; |
445 | AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *, |
446 | const SourceLocationReflection *const r) const override; |
447 | }; |
448 | |
449 | /** |
450 | * @author Frans Englich <frans.englich@nokia.com> |
451 | */ |
452 | class ToDateTimeCasterLocator : public AtomicCasterLocator |
453 | { |
454 | public: |
455 | using AtomicCasterLocator::visit; |
456 | AtomicTypeVisitorResult::Ptr visit(const DateTimeType *, |
457 | const SourceLocationReflection *const r) const override; |
458 | AtomicTypeVisitorResult::Ptr visit(const DateType *, |
459 | const SourceLocationReflection *const r) const override; |
460 | AtomicTypeVisitorResult::Ptr visit(const StringType *, |
461 | const SourceLocationReflection *const r) const override; |
462 | AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *, |
463 | const SourceLocationReflection *const r) const override; |
464 | }; |
465 | |
466 | /** |
467 | * @author Frans Englich <frans.englich@nokia.com> |
468 | */ |
469 | class ToDateCasterLocator : public AtomicCasterLocator |
470 | { |
471 | public: |
472 | using AtomicCasterLocator::visit; |
473 | AtomicTypeVisitorResult::Ptr visit(const DateTimeType *, |
474 | const SourceLocationReflection *const r) const override; |
475 | AtomicTypeVisitorResult::Ptr visit(const DateType *, |
476 | const SourceLocationReflection *const r) const override; |
477 | AtomicTypeVisitorResult::Ptr visit(const StringType *, |
478 | const SourceLocationReflection *const r) const override; |
479 | AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *, |
480 | const SourceLocationReflection *const r) const override; |
481 | }; |
482 | |
483 | /** |
484 | * @author Frans Englich <frans.englich@nokia.com> |
485 | */ |
486 | class ToSchemaTimeCasterLocator : public AtomicCasterLocator |
487 | { |
488 | public: |
489 | using AtomicCasterLocator::visit; |
490 | AtomicTypeVisitorResult::Ptr visit(const DateTimeType *, |
491 | const SourceLocationReflection *const r) const override; |
492 | AtomicTypeVisitorResult::Ptr visit(const SchemaTimeType *, |
493 | const SourceLocationReflection *const r) const override; |
494 | AtomicTypeVisitorResult::Ptr visit(const StringType *, |
495 | const SourceLocationReflection *const r) const override; |
496 | AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *, |
497 | const SourceLocationReflection *const r) const override; |
498 | }; |
499 | |
500 | /** |
501 | * @author Frans Englich <frans.englich@nokia.com> |
502 | */ |
503 | class ToDurationCasterLocator : public AtomicCasterLocator |
504 | { |
505 | public: |
506 | using AtomicCasterLocator::visit; |
507 | AtomicTypeVisitorResult::Ptr visit(const DayTimeDurationType *, |
508 | const SourceLocationReflection *const r) const override; |
509 | AtomicTypeVisitorResult::Ptr visit(const DurationType *, |
510 | const SourceLocationReflection *const r) const override; |
511 | AtomicTypeVisitorResult::Ptr visit(const StringType *, |
512 | const SourceLocationReflection *const r) const override; |
513 | AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *, |
514 | const SourceLocationReflection *const r) const override; |
515 | AtomicTypeVisitorResult::Ptr visit(const YearMonthDurationType *, |
516 | const SourceLocationReflection *const r) const override; |
517 | }; |
518 | |
519 | /** |
520 | * @author Frans Englich <frans.englich@nokia.com> |
521 | */ |
522 | class ToDayTimeDurationCasterLocator : public AtomicCasterLocator |
523 | { |
524 | public: |
525 | using AtomicCasterLocator::visit; |
526 | AtomicTypeVisitorResult::Ptr visit(const DayTimeDurationType *, |
527 | const SourceLocationReflection *const r) const override; |
528 | AtomicTypeVisitorResult::Ptr visit(const DurationType *, |
529 | const SourceLocationReflection *const r) const override; |
530 | AtomicTypeVisitorResult::Ptr visit(const StringType *, |
531 | const SourceLocationReflection *const r) const override; |
532 | AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *, |
533 | const SourceLocationReflection *const r) const override; |
534 | AtomicTypeVisitorResult::Ptr visit(const YearMonthDurationType *, |
535 | const SourceLocationReflection *const r) const override; |
536 | }; |
537 | |
538 | /** |
539 | * @author Frans Englich <frans.englich@nokia.com> |
540 | */ |
541 | class ToYearMonthDurationCasterLocator : public AtomicCasterLocator |
542 | { |
543 | public: |
544 | using AtomicCasterLocator::visit; |
545 | AtomicTypeVisitorResult::Ptr visit(const DayTimeDurationType *, |
546 | const SourceLocationReflection *const r) const override; |
547 | AtomicTypeVisitorResult::Ptr visit(const DurationType *, |
548 | const SourceLocationReflection *const r) const override; |
549 | AtomicTypeVisitorResult::Ptr visit(const StringType *, |
550 | const SourceLocationReflection *const r) const override; |
551 | AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *, |
552 | const SourceLocationReflection *const r) const override; |
553 | AtomicTypeVisitorResult::Ptr visit(const YearMonthDurationType *, |
554 | const SourceLocationReflection *const r) const override; |
555 | }; |
556 | |
557 | /** |
558 | * @author Frans Englich <frans.englich@nokia.com> |
559 | */ |
560 | template<TypeOfDerivedInteger type> |
561 | class ToDerivedIntegerCasterLocator : public ToIntegerCasterLocator |
562 | { |
563 | public: |
564 | using ToIntegerCasterLocator::visit; |
565 | |
566 | AtomicTypeVisitorResult::Ptr visit(const BooleanType *, |
567 | const SourceLocationReflection *const r) const override |
568 | { |
569 | Q_UNUSED(r); |
570 | return AtomicTypeVisitorResult::Ptr(new BooleanToDerivedIntegerCaster<type>()); |
571 | } |
572 | |
573 | AtomicTypeVisitorResult::Ptr visit(const StringType *, |
574 | const SourceLocationReflection *const r) const override |
575 | { |
576 | Q_UNUSED(r); |
577 | return AtomicTypeVisitorResult::Ptr(new StringToDerivedIntegerCaster<type>()); |
578 | } |
579 | |
580 | AtomicTypeVisitorResult::Ptr visit(const AnyURIType *, |
581 | const SourceLocationReflection *const r) const override |
582 | { |
583 | Q_UNUSED(r); |
584 | return AtomicTypeVisitorResult::Ptr(new StringToDerivedIntegerCaster<type>()); |
585 | } |
586 | |
587 | AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *, |
588 | const SourceLocationReflection *const r) const override |
589 | { |
590 | Q_UNUSED(r); |
591 | return AtomicTypeVisitorResult::Ptr(new StringToDerivedIntegerCaster<type>()); |
592 | } |
593 | |
594 | AtomicTypeVisitorResult::Ptr visit(const IntegerType *, |
595 | const SourceLocationReflection *const r) const override |
596 | { |
597 | Q_UNUSED(r); |
598 | return AtomicTypeVisitorResult::Ptr(new NumericToDerivedIntegerCaster<type>()); |
599 | } |
600 | |
601 | virtual AtomicTypeVisitorResult::Ptr visit(const DerivedIntegerType<TypeByte> *, |
602 | const SourceLocationReflection *const r) const |
603 | { |
604 | Q_UNUSED(r); |
605 | return AtomicTypeVisitorResult::Ptr(new NumericToDerivedIntegerCaster<type>()); |
606 | } |
607 | |
608 | virtual AtomicTypeVisitorResult::Ptr visit(const DerivedIntegerType<TypeInt> *, |
609 | const SourceLocationReflection *const r) const |
610 | { |
611 | Q_UNUSED(r); |
612 | return AtomicTypeVisitorResult::Ptr(new NumericToDerivedIntegerCaster<type>()); |
613 | } |
614 | |
615 | virtual AtomicTypeVisitorResult::Ptr visit(const DerivedIntegerType<TypeLong> *, |
616 | const SourceLocationReflection *const r) const |
617 | { |
618 | Q_UNUSED(r); |
619 | return AtomicTypeVisitorResult::Ptr(new NumericToDerivedIntegerCaster<type>()); |
620 | } |
621 | |
622 | virtual AtomicTypeVisitorResult::Ptr visit(const DerivedIntegerType<TypeNegativeInteger> *, |
623 | const SourceLocationReflection *const r) const |
624 | { |
625 | Q_UNUSED(r); |
626 | return AtomicTypeVisitorResult::Ptr(new NumericToDerivedIntegerCaster<type>()); |
627 | } |
628 | |
629 | virtual AtomicTypeVisitorResult::Ptr visit(const DerivedIntegerType<TypeNonNegativeInteger> *, |
630 | const SourceLocationReflection *const r) const |
631 | { |
632 | Q_UNUSED(r); |
633 | return AtomicTypeVisitorResult::Ptr(new NumericToDerivedIntegerCaster<type>()); |
634 | } |
635 | |
636 | virtual AtomicTypeVisitorResult::Ptr visit(const DerivedIntegerType<TypeNonPositiveInteger> *, |
637 | const SourceLocationReflection *const r) const |
638 | { |
639 | Q_UNUSED(r); |
640 | return AtomicTypeVisitorResult::Ptr(new NumericToDerivedIntegerCaster<type>()); |
641 | } |
642 | |
643 | virtual AtomicTypeVisitorResult::Ptr visit(const DerivedIntegerType<TypePositiveInteger> *, |
644 | const SourceLocationReflection *const r) const |
645 | { |
646 | Q_UNUSED(r); |
647 | return AtomicTypeVisitorResult::Ptr(new NumericToDerivedIntegerCaster<type>()); |
648 | } |
649 | |
650 | virtual AtomicTypeVisitorResult::Ptr visit(const DerivedIntegerType<TypeShort> *, |
651 | const SourceLocationReflection *const r) const |
652 | { |
653 | Q_UNUSED(r); |
654 | return AtomicTypeVisitorResult::Ptr(new NumericToDerivedIntegerCaster<type>()); |
655 | } |
656 | |
657 | virtual AtomicTypeVisitorResult::Ptr visit(const DerivedIntegerType<TypeUnsignedByte> *, |
658 | const SourceLocationReflection *const r) const |
659 | { |
660 | Q_UNUSED(r); |
661 | return AtomicTypeVisitorResult::Ptr(new NumericToDerivedIntegerCaster<type>()); |
662 | } |
663 | |
664 | virtual AtomicTypeVisitorResult::Ptr visit(const DerivedIntegerType<TypeUnsignedInt> *, |
665 | const SourceLocationReflection *const r) const |
666 | { |
667 | Q_UNUSED(r); |
668 | return AtomicTypeVisitorResult::Ptr(new NumericToDerivedIntegerCaster<type>()); |
669 | } |
670 | |
671 | virtual AtomicTypeVisitorResult::Ptr visit(const DerivedIntegerType<TypeUnsignedLong> *, |
672 | const SourceLocationReflection *const r) const |
673 | { |
674 | Q_UNUSED(r); |
675 | return AtomicTypeVisitorResult::Ptr(new NumericToDerivedIntegerCaster<type>()); |
676 | } |
677 | |
678 | virtual AtomicTypeVisitorResult::Ptr visit(const DerivedIntegerType<TypeUnsignedShort> *, |
679 | const SourceLocationReflection *const r) const |
680 | { |
681 | Q_UNUSED(r); |
682 | return AtomicTypeVisitorResult::Ptr(new NumericToDerivedIntegerCaster<type>()); |
683 | } |
684 | |
685 | AtomicTypeVisitorResult::Ptr visit(const DoubleType *, |
686 | const SourceLocationReflection *const r) const override |
687 | { |
688 | Q_UNUSED(r); |
689 | return AtomicTypeVisitorResult::Ptr(new NumericToDerivedIntegerCaster<type>()); |
690 | } |
691 | |
692 | AtomicTypeVisitorResult::Ptr visit(const FloatType *, |
693 | const SourceLocationReflection *const r) const override |
694 | { |
695 | Q_UNUSED(r); |
696 | return AtomicTypeVisitorResult::Ptr(new NumericToDerivedIntegerCaster<type>()); |
697 | } |
698 | }; |
699 | |
700 | /** |
701 | * @author Frans Englich <frans.englich@nokia.com> |
702 | */ |
703 | template<TypeOfDerivedString type> |
704 | class ToDerivedStringCasterLocator : public ToStringCasterLocator |
705 | { |
706 | public: |
707 | using ToStringCasterLocator::visit; |
708 | |
709 | AtomicTypeVisitorResult::Ptr visit(const BooleanType *, |
710 | const SourceLocationReflection *const r) const override |
711 | { |
712 | Q_UNUSED(r); |
713 | return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>()); |
714 | } |
715 | |
716 | AtomicTypeVisitorResult::Ptr visit(const StringType *, |
717 | const SourceLocationReflection *const r) const override |
718 | { |
719 | Q_UNUSED(r); |
720 | return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>()); |
721 | } |
722 | |
723 | AtomicTypeVisitorResult::Ptr visit(const AnyURIType *, |
724 | const SourceLocationReflection *const r) const override |
725 | { |
726 | Q_UNUSED(r); |
727 | return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>()); |
728 | } |
729 | |
730 | AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *, |
731 | const SourceLocationReflection *const r) const override |
732 | { |
733 | Q_UNUSED(r); |
734 | return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>()); |
735 | } |
736 | |
737 | // TODO TypeString not handled |
738 | virtual AtomicTypeVisitorResult::Ptr visit(const DerivedStringType<TypeNormalizedString> *, |
739 | const SourceLocationReflection *const r) const |
740 | { |
741 | Q_UNUSED(r); |
742 | return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>()); |
743 | } |
744 | |
745 | virtual AtomicTypeVisitorResult::Ptr visit(const DerivedStringType<TypeToken> *, |
746 | const SourceLocationReflection *const r) const |
747 | { |
748 | Q_UNUSED(r); |
749 | return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>()); |
750 | } |
751 | |
752 | virtual AtomicTypeVisitorResult::Ptr visit(const DerivedStringType<TypeLanguage> *, |
753 | const SourceLocationReflection *const r) const |
754 | { |
755 | Q_UNUSED(r); |
756 | return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>()); |
757 | } |
758 | |
759 | virtual AtomicTypeVisitorResult::Ptr visit(const DerivedStringType<TypeNMTOKEN> *, |
760 | const SourceLocationReflection *const r) const |
761 | { |
762 | Q_UNUSED(r); |
763 | return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>()); |
764 | } |
765 | |
766 | virtual AtomicTypeVisitorResult::Ptr visit(const DerivedStringType<TypeName> *, |
767 | const SourceLocationReflection *const r) const |
768 | { |
769 | Q_UNUSED(r); |
770 | return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>()); |
771 | } |
772 | |
773 | virtual AtomicTypeVisitorResult::Ptr visit(const DerivedStringType<TypeNCName> *, |
774 | const SourceLocationReflection *const r) const |
775 | { |
776 | Q_UNUSED(r); |
777 | return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>()); |
778 | } |
779 | |
780 | virtual AtomicTypeVisitorResult::Ptr visit(const DerivedStringType<TypeID> *, |
781 | const SourceLocationReflection *const r) const |
782 | { |
783 | Q_UNUSED(r); |
784 | return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>()); |
785 | } |
786 | |
787 | virtual AtomicTypeVisitorResult::Ptr visit(const DerivedStringType<TypeIDREF> *, |
788 | const SourceLocationReflection *const r) const |
789 | { |
790 | Q_UNUSED(r); |
791 | return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>()); |
792 | } |
793 | |
794 | virtual AtomicTypeVisitorResult::Ptr visit(const DerivedStringType<TypeENTITY> *, |
795 | const SourceLocationReflection *const r) const |
796 | { |
797 | Q_UNUSED(r); |
798 | return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>()); |
799 | } |
800 | |
801 | AtomicTypeVisitorResult::Ptr visit(const DateTimeType *, |
802 | const SourceLocationReflection *const r) const override |
803 | { |
804 | Q_UNUSED(r); |
805 | return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>()); |
806 | } |
807 | |
808 | AtomicTypeVisitorResult::Ptr visit(const DateType *, |
809 | const SourceLocationReflection *const r) const override |
810 | { |
811 | Q_UNUSED(r); |
812 | return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>()); |
813 | } |
814 | |
815 | AtomicTypeVisitorResult::Ptr visit(const SchemaTimeType *, |
816 | const SourceLocationReflection *const r) const override |
817 | { |
818 | Q_UNUSED(r); |
819 | return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>()); |
820 | } |
821 | |
822 | AtomicTypeVisitorResult::Ptr visit(const FloatType *, |
823 | const SourceLocationReflection *const r) const override |
824 | { |
825 | Q_UNUSED(r); |
826 | return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>()); |
827 | } |
828 | |
829 | AtomicTypeVisitorResult::Ptr visit(const DoubleType *, |
830 | const SourceLocationReflection *const r) const override |
831 | { |
832 | Q_UNUSED(r); |
833 | return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>()); |
834 | } |
835 | |
836 | AtomicTypeVisitorResult::Ptr visit(const DecimalType *, |
837 | const SourceLocationReflection *const r) const override |
838 | { |
839 | Q_UNUSED(r); |
840 | return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>()); |
841 | } |
842 | |
843 | AtomicTypeVisitorResult::Ptr visit(const IntegerType *, |
844 | const SourceLocationReflection *const r) const override |
845 | { |
846 | Q_UNUSED(r); |
847 | return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>()); |
848 | } |
849 | |
850 | AtomicTypeVisitorResult::Ptr visit(const DurationType *, |
851 | const SourceLocationReflection *const r) const override |
852 | { |
853 | Q_UNUSED(r); |
854 | return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>()); |
855 | } |
856 | |
857 | AtomicTypeVisitorResult::Ptr visit(const GYearMonthType *, |
858 | const SourceLocationReflection *const r) const override |
859 | { |
860 | Q_UNUSED(r); |
861 | return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>()); |
862 | } |
863 | |
864 | AtomicTypeVisitorResult::Ptr visit(const GYearType *, |
865 | const SourceLocationReflection *const r) const override |
866 | { |
867 | Q_UNUSED(r); |
868 | return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>()); |
869 | } |
870 | |
871 | AtomicTypeVisitorResult::Ptr visit(const GMonthDayType *, |
872 | const SourceLocationReflection *const r) const override |
873 | { |
874 | Q_UNUSED(r); |
875 | return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>()); |
876 | } |
877 | |
878 | AtomicTypeVisitorResult::Ptr visit(const GDayType *, |
879 | const SourceLocationReflection *const r) const override |
880 | { |
881 | Q_UNUSED(r); |
882 | return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>()); |
883 | } |
884 | |
885 | AtomicTypeVisitorResult::Ptr visit(const GMonthType *, |
886 | const SourceLocationReflection *const r) const override |
887 | { |
888 | Q_UNUSED(r); |
889 | return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>()); |
890 | } |
891 | |
892 | AtomicTypeVisitorResult::Ptr visit(const QNameType *, |
893 | const SourceLocationReflection *const r) const override |
894 | { |
895 | Q_UNUSED(r); |
896 | return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>()); |
897 | } |
898 | }; |
899 | } |
900 | |
901 | QT_END_NAMESPACE |
902 | |
903 | #endif |
904 | |