Qt 4.8
qbuiltinatomictypes.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 #include "qbuiltintypes_p.h"
44 
45 #include "qbuiltinatomictypes_p.h"
46 
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,
105 
106 deployBase(NOTATION, xsNOTATION, xsAnyAtomicType)
107 
108 deployMathComp(Float, xsFloat, numeric)
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)
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()),
135  casterLoc)
136 {
137 }
139 /* --------------------------------------------------------------- */
140 
141 /* --------------------------------------------------------------- */
143  const AtomicCasterLocator::Ptr &casterLoc)
144 : BuiltinAtomicType(pType,
147  casterLoc)
148 {
149 }
151 /* --------------------------------------------------------------- */
152 
153 /* ---------------------- Special Overrides ---------------------- */
154 AnyAtomicType::AnyAtomicType() : BuiltinAtomicType(AtomicType::Ptr(),
157  AtomicCasterLocator::Ptr())
158 {
159 }
160 implAccept(AnyAtomic)
161 
162 ItemType::Ptr AnyAtomicType::xdtSuperType() const
163 {
164  return BuiltinTypes::item;
165 }
166 
168 {
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"))
195 implementName(Base64Binary, QLatin1String("base64Binary"))
199 implementName(DayTimeDuration, QLatin1String("dayTimeDuration"))
207 implementName(GYearMonth, QLatin1String("gYearMonth"))
211 implementName(NOTATION, QLatin1String("NOTATION"))
212 implementName(QName, QLatin1String("QName"))
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 
Base template class for Float and Double classes.
#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
xsAnyAtomicType numeric xsDuration xsAnyAtomicType xsAnyAtomicType xsAnyAtomicType xsAnyAtomicType xsAnyAtomicType xsGYearMonth
xsAnyAtomicType numeric xsDuration xsAnyAtomicType xsTime
xsAnyAtomicType numeric xsDuration xsAnyAtomicType xsAnyAtomicType xsAnyAtomicType xsGDay
Implements the value instance of the xs:gYearMonth type.
Definition: qgyearmonth_p.h:69
The QExplicitlySharedDataPointer class represents a pointer to an explicitly shared object...
Definition: qshareddata.h:136
Implements the value instance of the xs:time type.
Definition: qschematime_p.h:72
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
Implements the value instance of the xs:hexBinary type.
Definition: qhexbinary_p.h:74
xsDouble xsDecimal
A value of type xs:anyURI.
Definition: qanyuri_p.h:82
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
xsAnyAtomicType numeric xsDuration xsDate
#define implementName(className, typeName)
static const ItemType::Ptr item
Base class for all classes that implements atomic types.
Definition: qatomictype_p.h:80
xsAnyAtomicType numeric xsDuration xsAnyAtomicType xsAnyAtomicType xsAnyAtomicType xsAnyAtomicType xsGMonthDay
The namespace for the internal API of QtXmlPatterns.
Implements the value instance of the xs:gMonth type.
Definition: qgmonth_p.h:69
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.
xsAnyAtomicType numeric xsDuration xsAnyAtomicType xsAnyAtomicType xsBoolean
#define deployBase(className, qname, parent)
Implements the value instance of the xs:date type.
Definition: qdate_p.h:69
xsAnyAtomicType numeric xsDuration xsAnyAtomicType xsAnyAtomicType xsAnyAtomicType xsAnyAtomicType xsAnyAtomicType xsAnyAtomicType xsQName
static const SchemaType::Ptr xsAnySimpleType
#define implAccept(className)
Implements the value instance of the xs:duration type.
Definition: qduration_p.h:69
#define deployFull(className, qname, parent)
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 value instance of the xs:integer type.
Definition: qinteger_p.h:70
virtual SchemaType::Ptr wxsSuperType() const
Implements the value instance of the xs:dateTime type.
IntegerType(const AtomicType::Ptr &parentType, const AtomicCasterLocator::Ptr &casterLocator)
xsDouble xsFloat
#define deployComp(className, qname, parent, comp, mather, caster)
virtual bool isAbstract() const
xsAnyAtomicType numeric xsDayTimeDuration
Implements the value instance of the xs:untypedAtomic type.
Implements the value instance of the xs:base64Binary type.
Implements the value instance of the xs:gDay type.
Definition: qgday_p.h:69
#define deployMathComp(className, qname, parent)
virtual bool isAbstract() const
Instances of this class represents types that are sub-classes of xs:anyAtomicType.
Contains AtomicMathematicianLocator sub-classes that finds classes which can perform arithmetics betw...