author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Fri, 19 Feb 2010 23:40:16 +0200 | |
branch | RCL_3 |
changeset 4 | 3b1da2848fc7 |
parent 0 | 1918ee327afb |
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 QtXmlPatterns module 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 "qatomicmathematicianlocators_p.h" |
|
43 |
#include "qbuiltintypes_p.h" |
|
44 |
||
45 |
#include "qbuiltinatomictypes_p.h" |
|
46 |
||
47 |
QT_BEGIN_NAMESPACE |
|
48 |
||
49 |
using namespace QPatternist; |
|
50 |
||
51 |
/* -------------------------------------------------------------- */ |
|
52 |
#define implAccept(className) \ |
|
53 |
AtomicTypeVisitorResult::Ptr className##Type::accept(const AtomicTypeVisitor::Ptr &v, \ |
|
54 |
const SourceLocationReflection *const r) const \ |
|
55 |
{ \ |
|
56 |
return v->visit(this, r); \ |
|
57 |
} \ |
|
58 |
\ |
|
59 |
AtomicTypeVisitorResult::Ptr \ |
|
60 |
className##Type::accept(const ParameterizedAtomicTypeVisitor::Ptr &v, \ |
|
61 |
const qint16 op, \ |
|
62 |
const SourceLocationReflection *const r) const \ |
|
63 |
{ \ |
|
64 |
return v->visit(this, op, r); \ |
|
65 |
} |
|
66 |
||
67 |
#define deployComp(className, qname, parent, comp, mather, caster) \ |
|
68 |
className##Type::className##Type() : BuiltinAtomicType(BuiltinTypes::parent, \ |
|
69 |
comp, \ |
|
70 |
mather, \ |
|
71 |
caster) \ |
|
72 |
{ \ |
|
73 |
} \ |
|
74 |
implAccept(className) |
|
75 |
||
76 |
#define deployBase(className, qname, parent) deployComp(className, qname, parent, \ |
|
77 |
AtomicComparatorLocator::Ptr(), \ |
|
78 |
AtomicMathematicianLocator::Ptr(), \ |
|
79 |
AtomicCasterLocator::Ptr()) |
|
80 |
||
81 |
#define deployFull(className, qname, parent) \ |
|
82 |
deployComp(className, qname, parent, \ |
|
83 |
AtomicComparatorLocator::Ptr(new className##ComparatorLocator()), \ |
|
84 |
AtomicMathematicianLocator::Ptr(), \ |
|
85 |
AtomicCasterLocator::Ptr(new To##className##CasterLocator())) |
|
86 |
||
87 |
#define deployMathComp(className, qname, parent) \ |
|
88 |
deployComp(className, qname, parent, \ |
|
89 |
AtomicComparatorLocator::Ptr(new className##ComparatorLocator()), \ |
|
90 |
AtomicMathematicianLocator::Ptr(new className##MathematicianLocator()), \ |
|
91 |
AtomicCasterLocator::Ptr(new To##className##CasterLocator())) |
|
92 |
/* -------------------------------------------------------------- */ |
|
93 |
||
94 |
/* -------------------------------------------------------------- */ |
|
95 |
/* xs:anyURI & xs:untypedAtomic are much treated like strings. This ensures |
|
96 |
* they get the correct operators and automatically takes care of type promotion. */ |
|
97 |
deployComp(UntypedAtomic, xsUntypedAtomic, xsAnyAtomicType, |
|
98 |
AtomicComparatorLocator::Ptr(new StringComparatorLocator()), |
|
99 |
AtomicMathematicianLocator::Ptr(), |
|
100 |
AtomicCasterLocator::Ptr(new ToUntypedAtomicCasterLocator())) |
|
101 |
deployComp(AnyURI, xsAnyURI, xsAnyAtomicType, |
|
102 |
AtomicComparatorLocator::Ptr(new StringComparatorLocator()), |
|
103 |
AtomicMathematicianLocator::Ptr(), |
|
104 |
AtomicCasterLocator::Ptr(new ToAnyURICasterLocator())) |
|
105 |
||
106 |
deployBase(NOTATION, xsNOTATION, xsAnyAtomicType) |
|
107 |
||
108 |
deployMathComp(Float, xsFloat, numeric) |
|
109 |
deployMathComp(Double, xsDouble, numeric) |
|
110 |
deployMathComp(Decimal, xsDecimal, numeric) |
|
111 |
deployMathComp(DayTimeDuration, xsDayTimeDuration, xsDuration) |
|
112 |
deployMathComp(YearMonthDuration, xsYearMonthDuration, xsDuration) |
|
113 |
deployMathComp(Date, xsDate, xsAnyAtomicType) |
|
114 |
deployMathComp(DateTime, xsDateTime, xsAnyAtomicType) |
|
115 |
deployMathComp(SchemaTime, xsTime, xsAnyAtomicType) |
|
116 |
||
117 |
deployFull(Base64Binary, xsBase64Binary, xsAnyAtomicType) |
|
118 |
deployFull(Boolean, xsBoolean, xsAnyAtomicType) |
|
119 |
deployFull(Duration, xsDuration, xsAnyAtomicType) |
|
120 |
deployFull(GDay, xsGDay, xsAnyAtomicType) |
|
121 |
deployFull(GMonth, xsGMonth, xsAnyAtomicType) |
|
122 |
deployFull(GMonthDay, xsGMonthDay, xsAnyAtomicType) |
|
123 |
deployFull(GYear, xsGYear, xsAnyAtomicType) |
|
124 |
deployFull(GYearMonth, xsGYearMonth, xsAnyAtomicType) |
|
125 |
deployFull(HexBinary, xsHexBinary, xsAnyAtomicType) |
|
126 |
deployFull(QName, xsQName, xsAnyAtomicType) |
|
127 |
/* --------------------------------------------------------------- */ |
|
128 |
||
129 |
/* --------------------------------------------------------------- */ |
|
130 |
StringType::StringType(const AtomicType::Ptr &pType, |
|
131 |
const AtomicCasterLocator::Ptr &casterLoc) |
|
132 |
: BuiltinAtomicType(pType, |
|
133 |
AtomicComparatorLocator::Ptr(new StringComparatorLocator()), |
|
134 |
AtomicMathematicianLocator::Ptr(), |
|
135 |
casterLoc) |
|
136 |
{ |
|
137 |
} |
|
138 |
implAccept(String) |
|
139 |
/* --------------------------------------------------------------- */ |
|
140 |
||
141 |
/* --------------------------------------------------------------- */ |
|
142 |
IntegerType::IntegerType(const AtomicType::Ptr &pType, |
|
143 |
const AtomicCasterLocator::Ptr &casterLoc) |
|
144 |
: BuiltinAtomicType(pType, |
|
145 |
AtomicComparatorLocator::Ptr(new IntegerComparatorLocator()), |
|
146 |
AtomicMathematicianLocator::Ptr(new IntegerMathematicianLocator()), |
|
147 |
casterLoc) |
|
148 |
{ |
|
149 |
} |
|
150 |
implAccept(Integer) |
|
151 |
/* --------------------------------------------------------------- */ |
|
152 |
||
153 |
/* ---------------------- Special Overrides ---------------------- */ |
|
154 |
AnyAtomicType::AnyAtomicType() : BuiltinAtomicType(AtomicType::Ptr(), |
|
155 |
AtomicComparatorLocator::Ptr(), |
|
156 |
AtomicMathematicianLocator::Ptr(), |
|
157 |
AtomicCasterLocator::Ptr()) |
|
158 |
{ |
|
159 |
} |
|
160 |
implAccept(AnyAtomic) |
|
161 |
||
162 |
ItemType::Ptr AnyAtomicType::xdtSuperType() const |
|
163 |
{ |
|
164 |
return BuiltinTypes::item; |
|
165 |
} |
|
166 |
||
167 |
SchemaType::Ptr AnyAtomicType::wxsSuperType() const |
|
168 |
{ |
|
169 |
return BuiltinTypes::xsAnySimpleType; |
|
170 |
} |
|
171 |
||
172 |
bool AnyAtomicType::isAbstract() const |
|
173 |
{ |
|
174 |
return true; |
|
175 |
} |
|
176 |
||
177 |
bool NOTATIONType::isAbstract() const |
|
178 |
{ |
|
179 |
return true; |
|
180 |
} |
|
181 |
||
182 |
#define implementName(className, typeName) \ |
|
183 |
QXmlName className##Type::name(const NamePool::Ptr &np) const \ |
|
184 |
{ \ |
|
185 |
return np->allocateQName(StandardNamespaces::xs, typeName); \ |
|
186 |
} \ |
|
187 |
\ |
|
188 |
QString className##Type::displayName(const NamePool::Ptr &np) const \ |
|
189 |
{ \ |
|
190 |
return np->displayName(name(np)); \ |
|
191 |
} |
|
192 |
||
193 |
implementName(AnyAtomic, QLatin1String("anyAtomicType")) |
|
194 |
implementName(AnyURI, QLatin1String("anyURI")) |
|
195 |
implementName(Base64Binary, QLatin1String("base64Binary")) |
|
196 |
implementName(Boolean, QLatin1String("boolean")) |
|
197 |
implementName(Date, QLatin1String("date")) |
|
198 |
implementName(DateTime, QLatin1String("dateTime")) |
|
199 |
implementName(DayTimeDuration, QLatin1String("dayTimeDuration")) |
|
200 |
implementName(Decimal, QLatin1String("decimal")) |
|
201 |
implementName(Double, QLatin1String("double")) |
|
202 |
implementName(Duration, QLatin1String("duration")) |
|
203 |
implementName(Float, QLatin1String("float")) |
|
204 |
implementName(GDay, QLatin1String("gDay")) |
|
205 |
implementName(GMonthDay, QLatin1String("gMonthDay")) |
|
206 |
implementName(GMonth, QLatin1String("gMonth")) |
|
207 |
implementName(GYearMonth, QLatin1String("gYearMonth")) |
|
208 |
implementName(GYear, QLatin1String("gYear")) |
|
209 |
implementName(HexBinary, QLatin1String("hexBinary")) |
|
210 |
implementName(Integer, QLatin1String("integer")) |
|
211 |
implementName(NOTATION, QLatin1String("NOTATION")) |
|
212 |
implementName(QName, QLatin1String("QName")) |
|
213 |
implementName(String, QLatin1String("string")) |
|
214 |
implementName(SchemaTime, QLatin1String("time")) |
|
215 |
implementName(UntypedAtomic, QLatin1String("untypedAtomic")) |
|
216 |
implementName(YearMonthDuration, QLatin1String("yearMonthDuration")) |
|
217 |
/* --------------------------------------------------------------- */ |
|
218 |
||
219 |
#undef implAccept |
|
220 |
#undef implementName |
|
221 |
#undef deployComp |
|
222 |
#undef deployBase |
|
223 |
#undef deployFull |
|
224 |
#undef deployMathComp |
|
225 |
||
226 |
QT_END_NAMESPACE |