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