Qt 4.8
qbuiltintypes.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 
42 #include "qanyitemtype_p.h"
43 #include "qderivedinteger_p.h"
44 
45 #include "qbuiltinatomictypes_p.h"
46 #include "qbuiltinnodetype_p.h"
47 #include "qbuiltintypes_p.h"
48 #include "qxsltnodetest_p.h"
49 
50 /* Included here to avoid the static initialization failure. */
54 
56 
57 using namespace QPatternist;
58 
59 // STATIC DATA
60 /* Special cases. */
61 #define initType(var, cls) const cls::Ptr BuiltinTypes::var(new cls())
62 initType(item, AnyItemType);
63 initType(node, AnyNodeType);
64 #undef initType
65 
66 #define initSType(var, cls) const SchemaType::Ptr BuiltinTypes::var(new cls())
67 initSType(xsAnyType, AnyType);
68 initSType(xsAnySimpleType, AnySimpleType);
69 initSType(xsUntyped, Untyped);
70 #undef initSType
71 
72 /* The primitive atomic types. */
73 #define at(className, varName) const AtomicType::Ptr BuiltinTypes::varName(new className());
75 at(UntypedAtomicType, xsUntypedAtomic)
76 at(DateTimeType, xsDateTime)
79 at(DurationType, xsDuration)
80 at(YearMonthDurationType, xsYearMonthDuration)
82 
83 at(NumericType, numeric)
86 at(GYearType, xsGYear)
89 at(GMonthType, xsGMonth)
90 
92 at(Base64BinaryType, xsBase64Binary)
94 
95 #define it(className, varName) const ItemType::Ptr BuiltinTypes::varName(new className());
97 at(HexBinaryType, xsHexBinary)
100 #undef it
101 
104 
105 #define dsType(varName, parent) \
106  const AtomicType::Ptr BuiltinTypes::xs ## varName \
107  (new DerivedStringType<Type ## varName>(BuiltinTypes::parent, \
108  AtomicCasterLocator::Ptr(new ToDerivedStringCasterLocator<Type ## varName>())))
109 
110 dsType(NormalizedString, xsString);
111 dsType(Token, xsNormalizedString);
112 dsType(Language, xsToken);
113 dsType(NMTOKEN, xsToken);
114 dsType(Name, xsToken);
115 dsType(NCName, xsName);
116 dsType(ID, xsNCName);
117 dsType(IDREF, xsNCName);
118 dsType(ENTITY, xsNCName);
119 #undef sType
120 
123 
124 #define iType(varName, parent) \
125  const AtomicType::Ptr BuiltinTypes::xs ## varName \
126  (new DerivedIntegerType<Type ## varName>(parent, \
127  AtomicCasterLocator::Ptr(new ToDerivedIntegerCasterLocator<Type ## varName>())))
128 
129 /* Initialize derived integers. The order of initialization is significant. */
130 iType(NonPositiveInteger, xsInteger);
131 iType(NegativeInteger, xsNonPositiveInteger);
133 iType(Int, xsLong);
134 iType(Short, xsInt);
135 iType(Byte, xsShort);
136 iType(NonNegativeInteger, xsInteger);
137 iType(UnsignedLong, xsNonNegativeInteger);
138 iType(UnsignedInt, xsUnsignedLong);
139 iType(UnsignedShort, xsUnsignedInt);
140 iType(UnsignedByte, xsUnsignedShort);
141 iType(PositiveInteger, xsNonNegativeInteger);
142 #undef iType
143 
145 #undef at
146 
147 /* QXmlNodeModelIndex types */
148 #define nt(var, enu) const ItemType::Ptr BuiltinTypes::var = \
149  ItemType::Ptr(new BuiltinNodeType<QXmlNodeModelIndex::enu>())
150 
151 nt(comment, Comment);
152 nt(attribute, Attribute);
153 nt(document, Document);
154 nt(element, Element);
155 nt(text, Text);
156 nt(pi, ProcessingInstruction);
157 #undef nt
158 
160 
Implements the type xs:gDay.
Implements the type xs:anyAtomicType.
Implements the type xs:yearMonthDuration.
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
Represents the complex W3C XML Schema type xs:untyped.
Definition: quntyped_p.h:73
Represents the node() item type.
xsAnyAtomicType numeric xsDuration xsAnyAtomicType xsAnyAtomicType xsAnyAtomicType xsAnyAtomicType xsAnyAtomicType xsGYearMonth
#define iType(varName, parent)
xsAnyAtomicType numeric xsDuration xsAnyAtomicType xsTime
Comment
qint64 xsInteger
Implements the type xs:float.
#define at(className, varName)
xsAnyAtomicType numeric xsDuration xsAnyAtomicType xsAnyAtomicType xsAnyAtomicType xsGDay
Implements the type xs:time.
Implements the type xs:untypedAtomic.
Implements the type xs:double.
The QExplicitlySharedDataPointer class represents a pointer to an explicitly shared object...
Definition: qshareddata.h:136
Implements the type xs:dateTime.
Represents the internal and abstract type fs:numeric.
xsDouble xsDecimal
Implements the type xs:dayTimeDuration.
#define initSType(var, cls)
static const AtomicType::Ptr xsString
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
xsAnyAtomicType numeric xsDuration xsDate
static const ItemType::Ptr xsltNodeTest
xsAnyAtomicType numeric xsDuration xsAnyAtomicType xsAnyAtomicType xsAnyAtomicType xsAnyAtomicType xsGMonthDay
Represents the xs:anySimpleType item type.
The namespace for the internal API of QtXmlPatterns.
#define dsType(varName, parent)
#define nt(var, enu)
Implements the type xs:anyURI.
Implements the type xs:gYearMonth.
Implements the type xs:date.
Implements the type xs:decimal.
Implements the type xs:base64Binary.
xsAnyAtomicType numeric xsDuration xsAnyAtomicType xsAnyAtomicType xsBoolean
Implements the type xs:gMonthDay.
xsAnyAtomicType numeric xsDuration xsAnyAtomicType xsAnyAtomicType xsAnyAtomicType xsAnyAtomicType xsAnyAtomicType xsAnyAtomicType xsQName
Implements the type xs:boolean.
static const AtomicType::Ptr xsInteger
Represents the xs:anyType item type.
Definition: qanytype_p.h:71
Implements the type xs:NOTATION.
Implements the type xs:hexBinary.
static const AtomicType::Ptr xsDecimal
xsDouble xsFloat
static const AtomicType::Ptr xsAnyAtomicType
xsAnyAtomicType numeric xsDayTimeDuration
#define initType(var, cls)
Implements the type xs:duration.
Implements the type xs:gYear.
Implements the type xs:QName.
Implements the type xs:gMonth.
Represents the item() item type.
#define text
Definition: qobjectdefs.h:80
AllCompOperators AtomicComparator::OperatorEqual AtomicComparator::OperatorNotEqual AllCompOperators FloatType IntegerType FloatType IntegerType FloatType IntegerType
#define Long
The Text item allows you to add formatted text to a scene.
Represents node() in patterns in XSL-T, which are just like how node() usually is, except that it doesn&#39;t match document nodes.