Qt 4.8
qatomiccasterlocators.cpp
Go to the documentation of this file.
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 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 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 
43 
45 
47 
48 using namespace QPatternist;
49 
50 #define impl(owner, mather, type) \
51 AtomicTypeVisitorResult::Ptr owner::visit(const type *, \
52  const SourceLocationReflection *const) const \
53 { \
54  return AtomicTypeVisitorResult::Ptr(new mather()); \
55 }
56 
57 #define implSelf(owner) impl(To##owner##CasterLocator, SelfToSelfCaster, owner##Type)
58 
59 /* xs:string */
62 impl(ToStringCasterLocator, ToStringCaster<TypeString>, Base64BinaryType)
63 impl(ToStringCasterLocator, ToStringCaster<TypeString>, BooleanType)
64 impl(ToStringCasterLocator, ToStringCaster<TypeString>, DateTimeType)
65 impl(ToStringCasterLocator, ToStringCaster<TypeString>, DateType)
66 impl(ToStringCasterLocator, ToStringCaster<TypeString>, DayTimeDurationType)
67 impl(ToStringCasterLocator, ToStringCaster<TypeString>, DecimalType)
68 impl(ToStringCasterLocator, ToStringCaster<TypeString>, DoubleType)
69 impl(ToStringCasterLocator, ToStringCaster<TypeString>, DurationType)
70 impl(ToStringCasterLocator, ToStringCaster<TypeString>, FloatType)
71 impl(ToStringCasterLocator, ToStringCaster<TypeString>, GDayType)
72 impl(ToStringCasterLocator, ToStringCaster<TypeString>, GMonthDayType)
73 impl(ToStringCasterLocator, ToStringCaster<TypeString>, GMonthType)
74 impl(ToStringCasterLocator, ToStringCaster<TypeString>, GYearMonthType)
75 impl(ToStringCasterLocator, ToStringCaster<TypeString>, GYearType)
76 impl(ToStringCasterLocator, ToStringCaster<TypeString>, HexBinaryType)
77 impl(ToStringCasterLocator, ToStringCaster<TypeString>, IntegerType)
78 impl(ToStringCasterLocator, ToStringCaster<TypeString>, NOTATIONType)
79 impl(ToStringCasterLocator, ToStringCaster<TypeString>, QNameType)
80 impl(ToStringCasterLocator, ToStringCaster<TypeString>, SchemaTimeType)
81 impl(ToStringCasterLocator, ToStringCaster<TypeString>, UntypedAtomicType)
82 impl(ToStringCasterLocator, ToStringCaster<TypeString>, YearMonthDurationType)
83 
84 /* xs:untypedAtomic */
87 impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, Base64BinaryType)
88 impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, BooleanType)
89 impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, DateTimeType)
90 impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, DateType)
91 impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, DayTimeDurationType)
92 impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, DecimalType)
93 impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, DoubleType)
94 impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, DurationType)
95 impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, FloatType)
96 impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, GDayType)
97 impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, GMonthDayType)
98 impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, GMonthType)
99 impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, GYearMonthType)
100 impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, GYearType)
101 impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, HexBinaryType)
102 impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, IntegerType)
103 impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, NOTATIONType)
104 impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, QNameType)
105 impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, StringType)
106 impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, SchemaTimeType)
107 impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, YearMonthDurationType)
108 
109 /* xs:anyURI */
112 impl(ToAnyURICasterLocator, ToAnyURICaster, UntypedAtomicType)
113 
114 /* xs:boolean */
117 impl(ToBooleanCasterLocator, NumericToBooleanCaster, FloatType)
118 impl(ToBooleanCasterLocator, NumericToBooleanCaster, DecimalType)
119 impl(ToBooleanCasterLocator, NumericToBooleanCaster, IntegerType)
120 impl(ToBooleanCasterLocator, StringToBooleanCaster, StringType)
121 impl(ToBooleanCasterLocator, StringToBooleanCaster, UntypedAtomicType)
122 
123 /* xs:double */
126 impl(ToDoubleCasterLocator, NumericToDoubleCaster, FloatType)
127 impl(ToDoubleCasterLocator, NumericToDoubleCaster, DecimalType)
128 impl(ToDoubleCasterLocator, NumericToDoubleCaster, IntegerType)
129 impl(ToDoubleCasterLocator, StringToDoubleCaster, StringType)
130 impl(ToDoubleCasterLocator, StringToDoubleCaster, UntypedAtomicType)
131 
132 /* xs:float */
135 impl(ToFloatCasterLocator, NumericToFloatCaster, DoubleType)
136 impl(ToFloatCasterLocator, NumericToFloatCaster, DecimalType)
137 impl(ToFloatCasterLocator, NumericToFloatCaster, IntegerType)
138 impl(ToFloatCasterLocator, StringToFloatCaster, StringType)
139 impl(ToFloatCasterLocator, StringToFloatCaster, UntypedAtomicType)
140 
141 /* xs:decimal */
144 impl(ToDecimalCasterLocator, NumericToDecimalCaster<false>, DoubleType)
145 impl(ToDecimalCasterLocator, NumericToDecimalCaster<false>, FloatType)
146 impl(ToDecimalCasterLocator, NumericToDecimalCaster<false>, IntegerType)
147 impl(ToDecimalCasterLocator, StringToDecimalCaster, StringType)
148 impl(ToDecimalCasterLocator, StringToDecimalCaster, UntypedAtomicType)
149 
150 /* xs:integer */
153 impl(ToIntegerCasterLocator, NumericToDecimalCaster<true>, DoubleType)
154 impl(ToIntegerCasterLocator, NumericToDecimalCaster<true>, FloatType)
155 impl(ToIntegerCasterLocator, NumericToDecimalCaster<true>, DecimalType)
156 impl(ToIntegerCasterLocator, StringToIntegerCaster, StringType)
157 impl(ToIntegerCasterLocator, StringToIntegerCaster, UntypedAtomicType)
158 
159 /* xs:base64binary */
162 impl(ToBase64BinaryCasterLocator, StringToBase64BinaryCaster, StringType)
163 impl(ToBase64BinaryCasterLocator, StringToBase64BinaryCaster, UntypedAtomicType)
164 
165 /* xs:hexBinary */
168 impl(ToHexBinaryCasterLocator, StringToHexBinaryCaster, StringType)
169 impl(ToHexBinaryCasterLocator, StringToHexBinaryCaster, UntypedAtomicType)
170 
171 /* xs:QName */
172 implSelf(QName)
174 
175 /* xs:gYear */
178 impl(ToGYearCasterLocator, StringToGYearCaster, UntypedAtomicType)
180 impl(ToGYearCasterLocator, AbstractDateTimeToGYearCaster, DateTimeType)
181 
182 /* xs:gDay */
183 implSelf(GDay)
185 impl(ToGDayCasterLocator, StringToGDayCaster, UntypedAtomicType)
187 impl(ToGDayCasterLocator, AbstractDateTimeToGDayCaster, DateTimeType)
188 
189 /* xs:gMonth */
192 impl(ToGMonthCasterLocator, StringToGMonthCaster, UntypedAtomicType)
194 impl(ToGMonthCasterLocator, AbstractDateTimeToGMonthCaster, DateTimeType)
195 
196 /* xs:gYearMonth */
199 impl(ToGYearMonthCasterLocator, StringToGYearMonthCaster, UntypedAtomicType)
201 impl(ToGYearMonthCasterLocator, AbstractDateTimeToGYearMonthCaster, DateTimeType)
202 
203 /* xs:gMonthDay */
206 impl(ToGMonthDayCasterLocator, StringToGMonthDayCaster, UntypedAtomicType)
208 impl(ToGMonthDayCasterLocator, AbstractDateTimeToGMonthDayCaster, DateTimeType)
209 
210 /* xs:dateTime */
213 impl(ToDateTimeCasterLocator, AbstractDateTimeToDateTimeCaster, DateType)
214 impl(ToDateTimeCasterLocator, StringToDateTimeCaster, UntypedAtomicType)
215 
216 /* xs:time */
219 impl(ToSchemaTimeCasterLocator, AbstractDateTimeToTimeCaster, DateTimeType)
220 impl(ToSchemaTimeCasterLocator, StringToTimeCaster, UntypedAtomicType)
221 
222 /* xs:date */
223 implSelf(Date)
225 impl(ToDateCasterLocator, AbstractDateTimeToDateCaster, DateTimeType)
226 impl(ToDateCasterLocator, StringToDateCaster, UntypedAtomicType)
227 
228 /* xs:duration */
231 impl(ToDurationCasterLocator, AbstractDurationToDurationCaster, YearMonthDurationType)
232 impl(ToDurationCasterLocator, StringToDurationCaster, StringType)
233 impl(ToDurationCasterLocator, StringToDurationCaster, UntypedAtomicType)
234 
235 /* xs:dayTimeDuration */
238 impl(ToDayTimeDurationCasterLocator, AbstractDurationToDayTimeDurationCaster, YearMonthDurationType)
239 impl(ToDayTimeDurationCasterLocator, StringToDayTimeDurationCaster, StringType)
240 impl(ToDayTimeDurationCasterLocator, StringToDayTimeDurationCaster, UntypedAtomicType)
241 
242 /* xs:yearMonthDuration */
245 impl(ToYearMonthDurationCasterLocator, AbstractDurationToYearMonthDurationCaster, DurationType)
246 impl(ToYearMonthDurationCasterLocator, StringToYearMonthDurationCaster, StringType)
247 impl(ToYearMonthDurationCasterLocator, StringToYearMonthDurationCaster, UntypedAtomicType)
248 
249 #undef implSelf
250 #undef impl
251 
Base template class for Float and Double classes.
Implements the type xs:gDay.
Casts an AbstractDuration instance to Duration.
Casts a value of type xs:boolean to xs:decimal.
Implements the type xs:yearMonthDuration.
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
Implements the value instance of the xs:gYearMonth type.
Definition: qgmonthday_p.h:69
Casts a numeric value, such as xs:double or xs:decimal, to xs:integer or xs:decimal, depending on IsInteger.
Casts a xs:date or xs:dateTime atomic value to xs:gDay.
Implements the type xs:float.
Implements the value instance of the xs:gYearMonth type.
Definition: qgyearmonth_p.h:69
Contains AtomicCasterLocator sub-classes that finds classes which can perform casting from one atomic...
Implements the type xs:time.
Implements the type xs:integer.
Implements the type xs:untypedAtomic.
Implements the type xs:double.
Implements the value instance of the xs:time type.
Definition: qschematime_p.h:72
Casts a string value, xs:string or xs:untypedAtomic, to xs:double or xs:float.
Implements the value instance of the xs:hexBinary type.
Definition: qhexbinary_p.h:74
Implements the type xs:dateTime.
Casts an AbstractDateTime instance to SchemaTime.
Casts a xs:string or xs:untypedAtomic atomic value to xs:base64Binary.
Casts a value of type xs:boolean to xs:double or xs:float.
Casts an AbstractDateTime instance to DateTime.
Casts a xs:date or xs:dateTime atomic value to xs:gMonth.
A value of type xs:anyURI.
Definition: qanyuri_p.h:82
Casts a xs:date or xs:dateTime atomic value to xs:gYear.
Implements the type xs:dayTimeDuration.
Casts any atomic value to xs:untypedAtomic.
Casts an AbstractDateTime instance to SchemaTime.
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
Casts a value of type xs:boolean to xs:integer.
The namespace for the internal API of QtXmlPatterns.
Implements the value instance of the xs:gMonth type.
Definition: qgmonth_p.h:69
Casts any atomic value to xs:string.
Casts a xs:string or xs:untypedAtomic atomic value to xs:dateTime.
Implements the type xs:anyURI.
Casts a xs:string or xs:untypedAtomic atomic value to xs:hexBinary.
Implements the type xs:gYearMonth.
Implements the type xs:date.
Implements the value instance of the xs:gYear type.
Definition: qgyear_p.h:69
Implements the value instance of the xs:boolean type.
Definition: qboolean_p.h:69
Implements the value instance of the xs:dayTimeDuration type.
Implements the type xs:decimal.
Implements the type xs:base64Binary.
Casts a numeric value, such as xs:integer or xs:float, to xs:double or xs:float.
Casts a xs:date or xs:dateTime atomic value to xs:gYearMonth.
Casts a xs:string or xs:untypedAtomic atomic value to xs:gYear.
Casts a xs:string or xs:untypedAtomic atomic value to xs:dayTimeDuration.
Implements the value instance of the xs:date type.
Definition: qdate_p.h:69
Implements the type xs:gMonthDay.
Casts a xs:string or xs:untypedAtomic atomic value to xs:duration.
Casts any numeric value to xs:boolean.
Casts a xs:string or xs:untypedAtomic atomic value to xs:gYearMonth.
Casts any string value, xs:string or xs:untypedAtomic, to xs:boolean.
Casts a xs:string or xs:untypedAtomic atomic value to xs:gDay.
Casts an AbstractDuration instance to DayTimeDuration.
Implements the type xs:boolean.
Casts an AbstractDuration instance to YearMonthDuration.
Casts a xs:string or xs:untypedAtomic atomic value to xs:date.
Contains classes sub-classing AtomicCaster and which are responsible of casting an atomic value to Ab...
Casts a xs:date or xs:dateTime atomic value to xs:gMonthDay.
Casts a string value, xs:string or xs:untypedAtomic, to xs:integer.
Implements the value instance of the xs:duration type.
Definition: qduration_p.h:69
Casts a xs:string or xs:untypedAtomic atomic value to xs:gYearMonth.
Casts a xs:string or xs:untypedAtomic atomic value to xs:gMonth.
Implements the value instance of the xs:yearMonthDuration type.
Implements the value instance of the xs:decimal type.
Definition: qdecimal_p.h:76
Implements the type xs:NOTATION.
#define implSelf(owner)
Casts a xs:string or xs:untypedAtomic atomic value to xs:time.
Implements the value instance of the xs:integer type.
Definition: qinteger_p.h:70
Casts a xs:string or xs:untypedAtomic atomic value to xs:yearMonthDuration.
Implements the type xs:hexBinary.
Implements the value instance of the xs:dateTime type.
Casts a xs:hexBinary atomic value to xs:base64Binary.
Casts a xs:base64Binary atomic value to xs:hexBinary.
Implements the value instance of the xs:untypedAtomic type.
Casts a string value, xs:string or xs:untypedAtomic, to xs:decimal.
Implements the value instance of the xs:base64Binary type.
Implements the type xs:duration.
Implements the value instance of the xs:gDay type.
Definition: qgday_p.h:69
Implements the type xs:gYear.
Implements the type xs:QName.
Implements the type xs:gMonth.
#define impl(owner, mather, type)
Casts a string value to xs:anyURI.