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#include "qabstractfloatcasters_p.h"
41
42#include "qatomiccasterlocators_p.h"
43
44QT_BEGIN_NAMESPACE
45
46using namespace QPatternist;
47
48#define impl(owner, mather, type) \
49AtomicTypeVisitorResult::Ptr owner::visit(const type *, \
50 const SourceLocationReflection *const) const \
51{ \
52 return AtomicTypeVisitorResult::Ptr(new mather()); \
53}
54
55#define implSelf(owner) impl(To##owner##CasterLocator, SelfToSelfCaster, owner##Type)
56
57/* xs:string */
58implSelf(String)
59impl(ToStringCasterLocator, ToStringCaster<TypeString>, AnyURIType)
60impl(ToStringCasterLocator, ToStringCaster<TypeString>, Base64BinaryType)
61impl(ToStringCasterLocator, ToStringCaster<TypeString>, BooleanType)
62impl(ToStringCasterLocator, ToStringCaster<TypeString>, DateTimeType)
63impl(ToStringCasterLocator, ToStringCaster<TypeString>, DateType)
64impl(ToStringCasterLocator, ToStringCaster<TypeString>, DayTimeDurationType)
65impl(ToStringCasterLocator, ToStringCaster<TypeString>, DecimalType)
66impl(ToStringCasterLocator, ToStringCaster<TypeString>, DoubleType)
67impl(ToStringCasterLocator, ToStringCaster<TypeString>, DurationType)
68impl(ToStringCasterLocator, ToStringCaster<TypeString>, FloatType)
69impl(ToStringCasterLocator, ToStringCaster<TypeString>, GDayType)
70impl(ToStringCasterLocator, ToStringCaster<TypeString>, GMonthDayType)
71impl(ToStringCasterLocator, ToStringCaster<TypeString>, GMonthType)
72impl(ToStringCasterLocator, ToStringCaster<TypeString>, GYearMonthType)
73impl(ToStringCasterLocator, ToStringCaster<TypeString>, GYearType)
74impl(ToStringCasterLocator, ToStringCaster<TypeString>, HexBinaryType)
75impl(ToStringCasterLocator, ToStringCaster<TypeString>, IntegerType)
76impl(ToStringCasterLocator, ToStringCaster<TypeString>, NOTATIONType)
77impl(ToStringCasterLocator, ToStringCaster<TypeString>, QNameType)
78impl(ToStringCasterLocator, ToStringCaster<TypeString>, SchemaTimeType)
79impl(ToStringCasterLocator, ToStringCaster<TypeString>, UntypedAtomicType)
80impl(ToStringCasterLocator, ToStringCaster<TypeString>, YearMonthDurationType)
81
82/* xs:untypedAtomic */
83implSelf(UntypedAtomic)
84impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, AnyURIType)
85impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, Base64BinaryType)
86impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, BooleanType)
87impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, DateTimeType)
88impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, DateType)
89impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, DayTimeDurationType)
90impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, DecimalType)
91impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, DoubleType)
92impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, DurationType)
93impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, FloatType)
94impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, GDayType)
95impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, GMonthDayType)
96impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, GMonthType)
97impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, GYearMonthType)
98impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, GYearType)
99impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, HexBinaryType)
100impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, IntegerType)
101impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, NOTATIONType)
102impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, QNameType)
103impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, StringType)
104impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, SchemaTimeType)
105impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, YearMonthDurationType)
106
107/* xs:anyURI */
108implSelf(AnyURI)
109impl(ToAnyURICasterLocator, ToAnyURICaster, StringType)
110impl(ToAnyURICasterLocator, ToAnyURICaster, UntypedAtomicType)
111
112/* xs:boolean */
113implSelf(Boolean)
114impl(ToBooleanCasterLocator, NumericToBooleanCaster, DoubleType)
115impl(ToBooleanCasterLocator, NumericToBooleanCaster, FloatType)
116impl(ToBooleanCasterLocator, NumericToBooleanCaster, DecimalType)
117impl(ToBooleanCasterLocator, NumericToBooleanCaster, IntegerType)
118impl(ToBooleanCasterLocator, StringToBooleanCaster, StringType)
119impl(ToBooleanCasterLocator, StringToBooleanCaster, UntypedAtomicType)
120
121/* xs:double */
122implSelf(Double)
123impl(ToDoubleCasterLocator, BooleanToDoubleCaster, BooleanType)
124impl(ToDoubleCasterLocator, NumericToDoubleCaster, FloatType)
125impl(ToDoubleCasterLocator, NumericToDoubleCaster, DecimalType)
126impl(ToDoubleCasterLocator, NumericToDoubleCaster, IntegerType)
127impl(ToDoubleCasterLocator, StringToDoubleCaster, StringType)
128impl(ToDoubleCasterLocator, StringToDoubleCaster, UntypedAtomicType)
129
130/* xs:float */
131implSelf(Float)
132impl(ToFloatCasterLocator, BooleanToFloatCaster, BooleanType)
133impl(ToFloatCasterLocator, NumericToFloatCaster, DoubleType)
134impl(ToFloatCasterLocator, NumericToFloatCaster, DecimalType)
135impl(ToFloatCasterLocator, NumericToFloatCaster, IntegerType)
136impl(ToFloatCasterLocator, StringToFloatCaster, StringType)
137impl(ToFloatCasterLocator, StringToFloatCaster, UntypedAtomicType)
138
139/* xs:decimal */
140implSelf(Decimal)
141impl(ToDecimalCasterLocator, BooleanToDecimalCaster, BooleanType)
142impl(ToDecimalCasterLocator, NumericToDecimalCaster<false>, DoubleType)
143impl(ToDecimalCasterLocator, NumericToDecimalCaster<false>, FloatType)
144impl(ToDecimalCasterLocator, NumericToDecimalCaster<false>, IntegerType)
145impl(ToDecimalCasterLocator, StringToDecimalCaster, StringType)
146impl(ToDecimalCasterLocator, StringToDecimalCaster, UntypedAtomicType)
147
148/* xs:integer */
149implSelf(Integer)
150impl(ToIntegerCasterLocator, BooleanToIntegerCaster, BooleanType)
151impl(ToIntegerCasterLocator, NumericToDecimalCaster<true>, DoubleType)
152impl(ToIntegerCasterLocator, NumericToDecimalCaster<true>, FloatType)
153impl(ToIntegerCasterLocator, NumericToDecimalCaster<true>, DecimalType)
154impl(ToIntegerCasterLocator, StringToIntegerCaster, StringType)
155impl(ToIntegerCasterLocator, StringToIntegerCaster, UntypedAtomicType)
156
157/* xs:base64binary */
158implSelf(Base64Binary)
159impl(ToBase64BinaryCasterLocator, HexBinaryToBase64BinaryCaster, HexBinaryType)
160impl(ToBase64BinaryCasterLocator, StringToBase64BinaryCaster, StringType)
161impl(ToBase64BinaryCasterLocator, StringToBase64BinaryCaster, UntypedAtomicType)
162
163/* xs:hexBinary */
164implSelf(HexBinary)
165impl(ToHexBinaryCasterLocator, Base64BinaryToHexBinaryCaster, Base64BinaryType)
166impl(ToHexBinaryCasterLocator, StringToHexBinaryCaster, StringType)
167impl(ToHexBinaryCasterLocator, StringToHexBinaryCaster, UntypedAtomicType)
168
169/* xs:QName */
170implSelf(QName)
171impl(ToQNameCasterLocator, ToStringCaster<TypeString>, StringType)
172
173/* xs:gYear */
174implSelf(GYear)
175impl(ToGYearCasterLocator, StringToGYearCaster, StringType)
176impl(ToGYearCasterLocator, StringToGYearCaster, UntypedAtomicType)
177impl(ToGYearCasterLocator, AbstractDateTimeToGYearCaster, DateType)
178impl(ToGYearCasterLocator, AbstractDateTimeToGYearCaster, DateTimeType)
179
180/* xs:gDay */
181implSelf(GDay)
182impl(ToGDayCasterLocator, StringToGDayCaster, StringType)
183impl(ToGDayCasterLocator, StringToGDayCaster, UntypedAtomicType)
184impl(ToGDayCasterLocator, AbstractDateTimeToGDayCaster, DateType)
185impl(ToGDayCasterLocator, AbstractDateTimeToGDayCaster, DateTimeType)
186
187/* xs:gMonth */
188implSelf(GMonth)
189impl(ToGMonthCasterLocator, StringToGMonthCaster, StringType)
190impl(ToGMonthCasterLocator, StringToGMonthCaster, UntypedAtomicType)
191impl(ToGMonthCasterLocator, AbstractDateTimeToGMonthCaster, DateType)
192impl(ToGMonthCasterLocator, AbstractDateTimeToGMonthCaster, DateTimeType)
193
194/* xs:gYearMonth */
195implSelf(GYearMonth)
196impl(ToGYearMonthCasterLocator, StringToGYearMonthCaster, StringType)
197impl(ToGYearMonthCasterLocator, StringToGYearMonthCaster, UntypedAtomicType)
198impl(ToGYearMonthCasterLocator, AbstractDateTimeToGYearMonthCaster, DateType)
199impl(ToGYearMonthCasterLocator, AbstractDateTimeToGYearMonthCaster, DateTimeType)
200
201/* xs:gMonthDay */
202implSelf(GMonthDay)
203impl(ToGMonthDayCasterLocator, StringToGMonthDayCaster, StringType)
204impl(ToGMonthDayCasterLocator, StringToGMonthDayCaster, UntypedAtomicType)
205impl(ToGMonthDayCasterLocator, AbstractDateTimeToGMonthDayCaster, DateType)
206impl(ToGMonthDayCasterLocator, AbstractDateTimeToGMonthDayCaster, DateTimeType)
207
208/* xs:dateTime */
209implSelf(DateTime)
210impl(ToDateTimeCasterLocator, StringToDateTimeCaster, StringType)
211impl(ToDateTimeCasterLocator, AbstractDateTimeToDateTimeCaster, DateType)
212impl(ToDateTimeCasterLocator, StringToDateTimeCaster, UntypedAtomicType)
213
214/* xs:time */
215implSelf(SchemaTime)
216impl(ToSchemaTimeCasterLocator, StringToTimeCaster, StringType)
217impl(ToSchemaTimeCasterLocator, AbstractDateTimeToTimeCaster, DateTimeType)
218impl(ToSchemaTimeCasterLocator, StringToTimeCaster, UntypedAtomicType)
219
220/* xs:date */
221implSelf(Date)
222impl(ToDateCasterLocator, StringToDateCaster, StringType)
223impl(ToDateCasterLocator, AbstractDateTimeToDateCaster, DateTimeType)
224impl(ToDateCasterLocator, StringToDateCaster, UntypedAtomicType)
225
226/* xs:duration */
227implSelf(Duration)
228impl(ToDurationCasterLocator, AbstractDurationToDurationCaster, DayTimeDurationType)
229impl(ToDurationCasterLocator, AbstractDurationToDurationCaster, YearMonthDurationType)
230impl(ToDurationCasterLocator, StringToDurationCaster, StringType)
231impl(ToDurationCasterLocator, StringToDurationCaster, UntypedAtomicType)
232
233/* xs:dayTimeDuration */
234implSelf(DayTimeDuration)
235impl(ToDayTimeDurationCasterLocator, AbstractDurationToDayTimeDurationCaster, DurationType)
236impl(ToDayTimeDurationCasterLocator, AbstractDurationToDayTimeDurationCaster, YearMonthDurationType)
237impl(ToDayTimeDurationCasterLocator, StringToDayTimeDurationCaster, StringType)
238impl(ToDayTimeDurationCasterLocator, StringToDayTimeDurationCaster, UntypedAtomicType)
239
240/* xs:yearMonthDuration */
241implSelf(YearMonthDuration)
242impl(ToYearMonthDurationCasterLocator, AbstractDurationToYearMonthDurationCaster, DayTimeDurationType)
243impl(ToYearMonthDurationCasterLocator, AbstractDurationToYearMonthDurationCaster, DurationType)
244impl(ToYearMonthDurationCasterLocator, StringToYearMonthDurationCaster, StringType)
245impl(ToYearMonthDurationCasterLocator, StringToYearMonthDurationCaster, UntypedAtomicType)
246
247#undef implSelf
248#undef impl
249
250QT_END_NAMESPACE
251

source code of qtxmlpatterns/src/xmlpatterns/type/qatomiccasterlocators.cpp