summaryrefslogtreecommitdiff
path: root/src/xmlpatterns/type
diff options
context:
space:
mode:
authorQt by Nokia <qt-info@nokia.com>2011-04-27 12:05:43 +0200
committeraxis <qt-info@nokia.com>2011-04-27 12:05:43 +0200
commite1b2c9deb5943faae2b29be6a5c006f75bb73f06 (patch)
treefc79e45367c0a8fc71185e9afc33f7503a58653c /src/xmlpatterns/type
downloadqtxmlpatterns-e1b2c9deb5943faae2b29be6a5c006f75bb73f06.tar.gz
Initial import from the monolithic Qt.
This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12
Diffstat (limited to 'src/xmlpatterns/type')
-rw-r--r--src/xmlpatterns/type/qabstractnodetest.cpp78
-rw-r--r--src/xmlpatterns/type/qabstractnodetest_p.h87
-rw-r--r--src/xmlpatterns/type/qanyitemtype.cpp90
-rw-r--r--src/xmlpatterns/type/qanyitemtype_p.h119
-rw-r--r--src/xmlpatterns/type/qanynodetype.cpp98
-rw-r--r--src/xmlpatterns/type/qanynodetype_p.h113
-rw-r--r--src/xmlpatterns/type/qanysimpletype.cpp93
-rw-r--r--src/xmlpatterns/type/qanysimpletype_p.h130
-rw-r--r--src/xmlpatterns/type/qanytype.cpp103
-rw-r--r--src/xmlpatterns/type/qanytype_p.h142
-rw-r--r--src/xmlpatterns/type/qatomiccasterlocator.cpp82
-rw-r--r--src/xmlpatterns/type/qatomiccasterlocator_p.h126
-rw-r--r--src/xmlpatterns/type/qatomiccasterlocators.cpp252
-rw-r--r--src/xmlpatterns/type/qatomiccasterlocators_p.h909
-rw-r--r--src/xmlpatterns/type/qatomiccomparatorlocator.cpp91
-rw-r--r--src/xmlpatterns/type/qatomiccomparatorlocator_p.h132
-rw-r--r--src/xmlpatterns/type/qatomiccomparatorlocators.cpp232
-rw-r--r--src/xmlpatterns/type/qatomiccomparatorlocators_p.h356
-rw-r--r--src/xmlpatterns/type/qatomicmathematicianlocator.cpp85
-rw-r--r--src/xmlpatterns/type/qatomicmathematicianlocator_p.h158
-rw-r--r--src/xmlpatterns/type/qatomicmathematicianlocators.cpp168
-rw-r--r--src/xmlpatterns/type/qatomicmathematicianlocators_p.h249
-rw-r--r--src/xmlpatterns/type/qatomictype.cpp118
-rw-r--r--src/xmlpatterns/type/qatomictype_p.h160
-rw-r--r--src/xmlpatterns/type/qatomictypedispatch_p.h277
-rw-r--r--src/xmlpatterns/type/qbasictypesfactory.cpp128
-rw-r--r--src/xmlpatterns/type/qbasictypesfactory_p.h121
-rw-r--r--src/xmlpatterns/type/qbuiltinatomictype.cpp94
-rw-r--r--src/xmlpatterns/type/qbuiltinatomictype_p.h130
-rw-r--r--src/xmlpatterns/type/qbuiltinatomictypes.cpp226
-rw-r--r--src/xmlpatterns/type/qbuiltinatomictypes_p.h789
-rw-r--r--src/xmlpatterns/type/qbuiltinnodetype.cpp165
-rw-r--r--src/xmlpatterns/type/qbuiltinnodetype_p.h110
-rw-r--r--src/xmlpatterns/type/qbuiltintypes.cpp161
-rw-r--r--src/xmlpatterns/type/qbuiltintypes_p.h174
-rw-r--r--src/xmlpatterns/type/qcardinality.cpp102
-rw-r--r--src/xmlpatterns/type/qcardinality_p.h544
-rw-r--r--src/xmlpatterns/type/qcommonsequencetypes.cpp132
-rw-r--r--src/xmlpatterns/type/qcommonsequencetypes_p.h414
-rw-r--r--src/xmlpatterns/type/qebvtype.cpp123
-rw-r--r--src/xmlpatterns/type/qebvtype_p.h135
-rw-r--r--src/xmlpatterns/type/qemptysequencetype.cpp101
-rw-r--r--src/xmlpatterns/type/qemptysequencetype_p.h124
-rw-r--r--src/xmlpatterns/type/qgenericsequencetype.cpp72
-rw-r--r--src/xmlpatterns/type/qgenericsequencetype_p.h115
-rw-r--r--src/xmlpatterns/type/qitemtype.cpp103
-rw-r--r--src/xmlpatterns/type/qitemtype_p.h286
-rw-r--r--src/xmlpatterns/type/qlocalnametest.cpp99
-rw-r--r--src/xmlpatterns/type/qlocalnametest_p.h102
-rw-r--r--src/xmlpatterns/type/qmultiitemtype.cpp140
-rw-r--r--src/xmlpatterns/type/qmultiitemtype_p.h146
-rw-r--r--src/xmlpatterns/type/qnamedschemacomponent.cpp71
-rw-r--r--src/xmlpatterns/type/qnamedschemacomponent_p.h127
-rw-r--r--src/xmlpatterns/type/qnamespacenametest.cpp95
-rw-r--r--src/xmlpatterns/type/qnamespacenametest_p.h101
-rw-r--r--src/xmlpatterns/type/qnonetype.cpp104
-rw-r--r--src/xmlpatterns/type/qnonetype_p.h155
-rw-r--r--src/xmlpatterns/type/qnumerictype.cpp142
-rw-r--r--src/xmlpatterns/type/qnumerictype_p.h174
-rw-r--r--src/xmlpatterns/type/qprimitives_p.h203
-rw-r--r--src/xmlpatterns/type/qqnametest.cpp99
-rw-r--r--src/xmlpatterns/type/qqnametest_p.h103
-rw-r--r--src/xmlpatterns/type/qschemacomponent.cpp56
-rw-r--r--src/xmlpatterns/type/qschemacomponent_p.h85
-rw-r--r--src/xmlpatterns/type/qschematype.cpp80
-rw-r--r--src/xmlpatterns/type/qschematype_p.h248
-rw-r--r--src/xmlpatterns/type/qschematypefactory.cpp56
-rw-r--r--src/xmlpatterns/type/qschematypefactory_p.h102
-rw-r--r--src/xmlpatterns/type/qsequencetype.cpp65
-rw-r--r--src/xmlpatterns/type/qsequencetype_p.h138
-rw-r--r--src/xmlpatterns/type/qtypechecker.cpp296
-rw-r--r--src/xmlpatterns/type/qtypechecker_p.h185
-rw-r--r--src/xmlpatterns/type/quntyped.cpp79
-rw-r--r--src/xmlpatterns/type/quntyped_p.h112
-rw-r--r--src/xmlpatterns/type/qxsltnodetest.cpp72
-rw-r--r--src/xmlpatterns/type/qxsltnodetest_p.h100
-rw-r--r--src/xmlpatterns/type/type.pri72
77 files changed, 12404 insertions, 0 deletions
diff --git a/src/xmlpatterns/type/qabstractnodetest.cpp b/src/xmlpatterns/type/qabstractnodetest.cpp
new file mode 100644
index 0000000..63a4fa0
--- /dev/null
+++ b/src/xmlpatterns/type/qabstractnodetest.cpp
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qabstractnodetest_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+AbstractNodeTest::AbstractNodeTest(const ItemType::Ptr &primaryType) : m_primaryType(primaryType)
+{
+ Q_ASSERT(m_primaryType);
+}
+
+bool AbstractNodeTest::xdtTypeMatches(const ItemType::Ptr &other) const
+{
+ Q_ASSERT(other);
+
+ if(other->isNodeType())
+ {
+ if(*other == *this)
+ return true;
+ else
+ return xdtTypeMatches(other->xdtSuperType());
+ }
+ else
+ return false;
+}
+
+ItemType::Ptr AbstractNodeTest::atomizedType() const
+{
+ return m_primaryType->atomizedType();
+}
+
+ItemType::Ptr AbstractNodeTest::xdtSuperType() const
+{
+ return m_primaryType;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/type/qabstractnodetest_p.h b/src/xmlpatterns/type/qabstractnodetest_p.h
new file mode 100644
index 0000000..f219644
--- /dev/null
+++ b/src/xmlpatterns/type/qabstractnodetest_p.h
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_AbstractNodeTest_H
+#define Patternist_AbstractNodeTest_H
+
+#include "qanynodetype_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short A name test that is of the type <tt>prefix:ncName</tt>.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class AbstractNodeTest : public AnyNodeType
+ {
+ public:
+ AbstractNodeTest(const ItemType::Ptr &primaryType);
+
+ virtual bool xdtTypeMatches(const ItemType::Ptr &other) const;
+ virtual ItemType::Ptr xdtSuperType() const;
+ virtual ItemType::Ptr atomizedType() const;
+
+ protected:
+ const ItemType::Ptr m_primaryType;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/type/qanyitemtype.cpp b/src/xmlpatterns/type/qanyitemtype.cpp
new file mode 100644
index 0000000..47bc6d8
--- /dev/null
+++ b/src/xmlpatterns/type/qanyitemtype.cpp
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qatomictype_p.h"
+#include "qbuiltintypes_p.h"
+
+#include "qanyitemtype_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+AnyItemType::AnyItemType()
+{
+}
+
+bool AnyItemType::itemMatches(const Item &) const
+{
+ return true;
+}
+
+bool AnyItemType::xdtTypeMatches(const ItemType::Ptr &) const
+{
+ return true;
+}
+
+QString AnyItemType::displayName(const NamePool::Ptr &) const
+{
+ return QLatin1String("item()");
+}
+
+ItemType::Ptr AnyItemType::xdtSuperType() const
+{
+ return ItemType::Ptr();
+}
+
+bool AnyItemType::isNodeType() const
+{
+ return false;
+}
+
+bool AnyItemType::isAtomicType() const
+{
+ return false;
+}
+
+ItemType::Ptr AnyItemType::atomizedType() const
+{
+ return BuiltinTypes::xsAnyAtomicType;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/type/qanyitemtype_p.h b/src/xmlpatterns/type/qanyitemtype_p.h
new file mode 100644
index 0000000..c62c168
--- /dev/null
+++ b/src/xmlpatterns/type/qanyitemtype_p.h
@@ -0,0 +1,119 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_AnyItemType_H
+#define Patternist_AnyItemType_H
+
+#include "qatomictype_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+
+ /**
+ * @short Represents the <tt>item()</tt> item type.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class AnyItemType : public ItemType
+ {
+ public:
+ /**
+ * @returns always "item()"
+ */
+ virtual QString displayName(const NamePool::Ptr &np) const;
+
+ /**
+ * @returns always @c true
+ */
+ virtual bool itemMatches(const Item &item) const;
+
+ /**
+ * @returns always 0, item() is the super type in the
+ * XPath Data Model hierarchy
+ */
+ virtual ItemType::Ptr xdtSuperType() const;
+
+ /**
+ * @returns always @c false
+ */
+ virtual bool isNodeType() const;
+
+ /**
+ * @returns always @c false
+ */
+ virtual bool isAtomicType() const;
+
+ /**
+ * @returns always @c true
+ */
+ virtual bool xdtTypeMatches(const ItemType::Ptr &type) const;
+
+ /**
+ * @returns xs:anyAtomicType
+ */
+ virtual ItemType::Ptr atomizedType() const;
+
+ protected:
+ friend class BuiltinTypes;
+ AnyItemType();
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/type/qanynodetype.cpp b/src/xmlpatterns/type/qanynodetype.cpp
new file mode 100644
index 0000000..eac45cf
--- /dev/null
+++ b/src/xmlpatterns/type/qanynodetype.cpp
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qbuiltintypes_p.h"
+#include "qitem_p.h"
+
+#include "qanynodetype_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+bool AnyNodeType::xdtTypeMatches(const ItemType::Ptr &other) const
+{
+ return other->isNodeType();
+}
+
+bool AnyNodeType::itemMatches(const Item &item) const
+{
+ return item.isNode();
+}
+
+ItemType::Ptr AnyNodeType::atomizedType() const
+{
+ return BuiltinTypes::xsAnyAtomicType;
+}
+
+QString AnyNodeType::displayName(const NamePool::Ptr &) const
+{
+ return QLatin1String("node()");
+}
+
+ItemType::Ptr AnyNodeType::xdtSuperType() const
+{
+ return BuiltinTypes::item;
+}
+
+bool AnyNodeType::isNodeType() const
+{
+ return true;
+}
+
+bool AnyNodeType::isAtomicType() const
+{
+ return false;
+}
+
+QXmlNodeModelIndex::NodeKind AnyNodeType::nodeKind() const
+{
+ /* node() is an abstract type, so we don't have a value for it in
+ * QXmlNodeModelIndex::NodeKind. */
+ return QXmlNodeModelIndex::NodeKind(0);
+}
+
+PatternPriority AnyNodeType::patternPriority() const
+{
+ return -0.5;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/type/qanynodetype_p.h b/src/xmlpatterns/type/qanynodetype_p.h
new file mode 100644
index 0000000..d502b51
--- /dev/null
+++ b/src/xmlpatterns/type/qanynodetype_p.h
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_AnyNodeType_H
+#define Patternist_AnyNodeType_H
+
+#include "qatomictype_p.h"
+#include "qitem_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short Represents the <tt>node()</tt> item type.
+ *
+ * @ingroup Patternist_types
+ * @see BuiltinNodeType
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class AnyNodeType : public ItemType
+ {
+ public:
+
+ typedef QExplicitlySharedDataPointer<AnyNodeType> Ptr;
+
+ virtual bool xdtTypeMatches(const ItemType::Ptr &other) const;
+ virtual bool itemMatches(const Item &item) const;
+ virtual QString displayName(const NamePool::Ptr &np) const;
+
+ virtual ItemType::Ptr xdtSuperType() const;
+
+ virtual bool isNodeType() const;
+ virtual bool isAtomicType() const;
+
+ /**
+ * @see <a href="http://www.w3.org/TR/xpath-datamodel/#acc-summ-typed-value">XQuery 1.0
+ * and XPath 2.0 Data Model, G.15 dm:typed-value Accessor</a>
+ */
+ virtual ItemType::Ptr atomizedType() const;
+
+ /**
+ * @returns the node kind this node ItemType tests for. If it matches any node, zero is returned.
+ */
+ virtual QXmlNodeModelIndex::NodeKind nodeKind() const;
+
+ virtual PatternPriority patternPriority() const;
+
+ protected:
+ friend class BuiltinTypes;
+
+ inline AnyNodeType()
+ {
+ }
+
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/type/qanysimpletype.cpp b/src/xmlpatterns/type/qanysimpletype.cpp
new file mode 100644
index 0000000..7ebb2d3
--- /dev/null
+++ b/src/xmlpatterns/type/qanysimpletype.cpp
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qbuiltintypes_p.h"
+
+#include "qanysimpletype_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+AnySimpleType::AnySimpleType()
+{
+}
+
+AnySimpleType::~AnySimpleType()
+{
+}
+
+QXmlName AnySimpleType::name(const NamePool::Ptr &np) const
+{
+ return np->allocateQName(StandardNamespaces::xs, QLatin1String("anySimpleType"));
+}
+
+QString AnySimpleType::displayName(const NamePool::Ptr &np) const
+{
+ return np->displayName(name(np));
+}
+
+SchemaType::Ptr AnySimpleType::wxsSuperType() const
+{
+ return BuiltinTypes::xsAnyType;
+}
+
+SchemaType::TypeCategory AnySimpleType::category() const
+{
+ return None;
+}
+
+SchemaType::DerivationMethod AnySimpleType::derivationMethod() const
+{
+ return DerivationRestriction;
+}
+
+bool AnySimpleType::isSimpleType() const
+{
+ return true;
+}
+
+bool AnySimpleType::isComplexType() const
+{
+ return false;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/type/qanysimpletype_p.h b/src/xmlpatterns/type/qanysimpletype_p.h
new file mode 100644
index 0000000..5391ad0
--- /dev/null
+++ b/src/xmlpatterns/type/qanysimpletype_p.h
@@ -0,0 +1,130 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_AnySimpleType_H
+#define Patternist_AnySimpleType_H
+
+#include "qanytype_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ class AtomicType;
+
+ /**
+ * @short Represents the @c xs:anySimpleType item type.
+ *
+ * @ingroup Patternist_types
+ * @see <a href="http://www.w3.org/TR/xmlschema-2/#dt-anySimpleType">XML Schema Part 2:
+ * Datatypes Second Edition, The simple ur-type definition</a>
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class AnySimpleType : public AnyType
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<AnySimpleType> Ptr;
+ typedef QList<AnySimpleType::Ptr> List;
+ friend class BuiltinTypes;
+
+ virtual ~AnySimpleType();
+
+ virtual QXmlName name(const NamePool::Ptr &np) const;
+
+ /**
+ * @returns always @c xs:anySimpleType
+ */
+ virtual QString displayName(const NamePool::Ptr &np) const;
+
+ /**
+ * @returns always BuiltinTypes::xsAnyType
+ */
+ virtual SchemaType::Ptr wxsSuperType() const;
+
+ /**
+ * xs:anySimpleType is the special "simple ur-type". Therefore this function
+ * returns SchemaType::None
+ *
+ * @returns SchemaType::None
+ */
+ virtual TypeCategory category() const;
+
+ /**
+ * The simple ur-type is a "special restriction of the ur-type definition",
+ * according to XML Schema Part 2: Datatypes Second Edition about xs:anySimpleType
+ *
+ * @returns DERIVATION_RESTRICTION
+ */
+ virtual SchemaType::DerivationMethod derivationMethod() const;
+
+ /**
+ * Always returns @c true.
+ */
+ virtual bool isSimpleType() const;
+
+ /**
+ * Always returns @c false.
+ */
+ virtual bool isComplexType() const;
+
+ protected:
+ AnySimpleType();
+
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/type/qanytype.cpp b/src/xmlpatterns/type/qanytype.cpp
new file mode 100644
index 0000000..626f4b4
--- /dev/null
+++ b/src/xmlpatterns/type/qanytype.cpp
@@ -0,0 +1,103 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qatomictype_p.h"
+
+#include "qanytype_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+AnyType::~AnyType()
+{
+}
+
+bool AnyType::wxsTypeMatches(const SchemaType::Ptr &other) const
+{
+ if(other)
+ return this == other.data() ? true : wxsTypeMatches(other->wxsSuperType());
+ else
+ return false;
+}
+
+bool AnyType::isAbstract() const
+{
+ return false;
+}
+
+QXmlName AnyType::name(const NamePool::Ptr &np) const
+{
+ return np->allocateQName(StandardNamespaces::xs, QLatin1String("anyType"));
+}
+
+QString AnyType::displayName(const NamePool::Ptr &) const
+{
+ /* A bit faster than calling name()->displayName() */
+ return QLatin1String("xs:anyType");
+}
+
+SchemaType::Ptr AnyType::wxsSuperType() const
+{
+ return SchemaType::Ptr();
+}
+
+SchemaType::TypeCategory AnyType::category() const
+{
+ return None;
+}
+
+bool AnyType::isComplexType() const
+{
+ return true;
+}
+
+SchemaType::DerivationMethod AnyType::derivationMethod() const
+{
+ return NoDerivation;
+}
+
+SchemaType::DerivationConstraints AnyType::derivationConstraints() const
+{
+ return SchemaType::DerivationConstraints();
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/type/qanytype_p.h b/src/xmlpatterns/type/qanytype_p.h
new file mode 100644
index 0000000..0e1ff38
--- /dev/null
+++ b/src/xmlpatterns/type/qanytype_p.h
@@ -0,0 +1,142 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_AnyType_H
+#define Patternist_AnyType_H
+
+#include "qschematype_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ class AtomicType;
+
+ /**
+ * @short Represents the @c xs:anyType item type.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class AnyType : public SchemaType
+ {
+ public:
+
+ typedef QExplicitlySharedDataPointer<AnyType> Ptr;
+ friend class BuiltinTypes;
+
+ virtual ~AnyType();
+
+ virtual QXmlName name(const NamePool::Ptr &np) const;
+
+ /**
+ * @returns always "xs:anyType"
+ */
+ virtual QString displayName(const NamePool::Ptr &np) const;
+
+ /**
+ * @returns always @c false
+ */
+ virtual bool isAbstract() const;
+
+ /**
+ * @returns @c null, since <tt>xs:anyType</tt> has no base type, it is the ur-type.
+ *
+ * @returns always @c null
+ */
+ virtual SchemaType::Ptr wxsSuperType() const;
+
+ /**
+ * @returns @c true only if @p other is xsAnyType.
+ */
+ virtual bool wxsTypeMatches(const SchemaType::Ptr &other) const;
+
+ /**
+ * <tt>xs:anyType</tt> is the "ur-type" and special. Therefore, this function
+ * returns SchemaType::None.
+ *
+ * @returns SchemaType::None
+ */
+ virtual TypeCategory category() const;
+
+ /**
+ * @returns always NoDerivation.
+ */
+ virtual DerivationMethod derivationMethod() const;
+
+ /**
+ * @returns an empty set of derivation constraint flags.
+ */
+ virtual DerivationConstraints derivationConstraints() const;
+
+ /**
+ * Always returns @c true.
+ */
+ virtual bool isComplexType() const;
+
+ protected:
+ /**
+ * @short This constructor is protected, because this
+ * class must be sub-classed.
+ */
+ inline AnyType()
+ {
+ }
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/type/qatomiccasterlocator.cpp b/src/xmlpatterns/type/qatomiccasterlocator.cpp
new file mode 100644
index 0000000..f77f200
--- /dev/null
+++ b/src/xmlpatterns/type/qatomiccasterlocator.cpp
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qatomiccasterlocator_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+#define implCasterVisit(type) \
+AtomicTypeVisitorResult::Ptr AtomicCasterLocator::visit(const type *, \
+ const SourceLocationReflection *const) const \
+{ \
+ return AtomicTypeVisitorResult::Ptr(); \
+}
+
+implCasterVisit(AnyAtomicType)
+implCasterVisit(AnyURIType)
+implCasterVisit(Base64BinaryType)
+implCasterVisit(BooleanType)
+implCasterVisit(DateTimeType)
+implCasterVisit(DateType)
+implCasterVisit(DayTimeDurationType)
+implCasterVisit(DecimalType)
+implCasterVisit(DoubleType)
+implCasterVisit(DurationType)
+implCasterVisit(FloatType)
+implCasterVisit(GDayType)
+implCasterVisit(GMonthDayType)
+implCasterVisit(GMonthType)
+implCasterVisit(GYearMonthType)
+implCasterVisit(GYearType)
+implCasterVisit(HexBinaryType)
+implCasterVisit(IntegerType)
+implCasterVisit(NOTATIONType)
+implCasterVisit(QNameType)
+implCasterVisit(StringType)
+implCasterVisit(SchemaTimeType)
+implCasterVisit(UntypedAtomicType)
+implCasterVisit(YearMonthDurationType)
+
+#undef implCasterVisit
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/type/qatomiccasterlocator_p.h b/src/xmlpatterns/type/qatomiccasterlocator_p.h
new file mode 100644
index 0000000..0a12b94
--- /dev/null
+++ b/src/xmlpatterns/type/qatomiccasterlocator_p.h
@@ -0,0 +1,126 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_AtomicCasterLocator_H
+#define Patternist_AtomicCasterLocator_H
+
+#include "qatomictypedispatch_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class AtomicCasterLocator : public AtomicTypeVisitor
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<AtomicCasterLocator> Ptr;
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const AnyAtomicType *,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const AnyURIType *,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const Base64BinaryType *,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const BooleanType *,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DateTimeType *,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DateType *,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DayTimeDurationType *,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DecimalType *,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DoubleType *,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DurationType *,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const FloatType *,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GDayType *,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GMonthDayType *,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GMonthType *,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GYearMonthType *,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GYearType *,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const HexBinaryType *,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const IntegerType *,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const NOTATIONType *,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const QNameType *,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const StringType *,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const SchemaTimeType *,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const YearMonthDurationType *,
+ const SourceLocationReflection *const reflection) const;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/type/qatomiccasterlocators.cpp b/src/xmlpatterns/type/qatomiccasterlocators.cpp
new file mode 100644
index 0000000..2004421
--- /dev/null
+++ b/src/xmlpatterns/type/qatomiccasterlocators.cpp
@@ -0,0 +1,252 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qabstractfloatcasters_p.h"
+
+#include "qatomiccasterlocators_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+#define impl(owner, mather, type) \
+AtomicTypeVisitorResult::Ptr owner::visit(const type *, \
+ const SourceLocationReflection *const) const \
+{ \
+ return AtomicTypeVisitorResult::Ptr(new mather()); \
+}
+
+#define implSelf(owner) impl(To##owner##CasterLocator, SelfToSelfCaster, owner##Type)
+
+/* xs:string */
+implSelf(String)
+impl(ToStringCasterLocator, ToStringCaster<TypeString>, AnyURIType)
+impl(ToStringCasterLocator, ToStringCaster<TypeString>, Base64BinaryType)
+impl(ToStringCasterLocator, ToStringCaster<TypeString>, BooleanType)
+impl(ToStringCasterLocator, ToStringCaster<TypeString>, DateTimeType)
+impl(ToStringCasterLocator, ToStringCaster<TypeString>, DateType)
+impl(ToStringCasterLocator, ToStringCaster<TypeString>, DayTimeDurationType)
+impl(ToStringCasterLocator, ToStringCaster<TypeString>, DecimalType)
+impl(ToStringCasterLocator, ToStringCaster<TypeString>, DoubleType)
+impl(ToStringCasterLocator, ToStringCaster<TypeString>, DurationType)
+impl(ToStringCasterLocator, ToStringCaster<TypeString>, FloatType)
+impl(ToStringCasterLocator, ToStringCaster<TypeString>, GDayType)
+impl(ToStringCasterLocator, ToStringCaster<TypeString>, GMonthDayType)
+impl(ToStringCasterLocator, ToStringCaster<TypeString>, GMonthType)
+impl(ToStringCasterLocator, ToStringCaster<TypeString>, GYearMonthType)
+impl(ToStringCasterLocator, ToStringCaster<TypeString>, GYearType)
+impl(ToStringCasterLocator, ToStringCaster<TypeString>, HexBinaryType)
+impl(ToStringCasterLocator, ToStringCaster<TypeString>, IntegerType)
+impl(ToStringCasterLocator, ToStringCaster<TypeString>, NOTATIONType)
+impl(ToStringCasterLocator, ToStringCaster<TypeString>, QNameType)
+impl(ToStringCasterLocator, ToStringCaster<TypeString>, SchemaTimeType)
+impl(ToStringCasterLocator, ToStringCaster<TypeString>, UntypedAtomicType)
+impl(ToStringCasterLocator, ToStringCaster<TypeString>, YearMonthDurationType)
+
+/* xs:untypedAtomic */
+implSelf(UntypedAtomic)
+impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, AnyURIType)
+impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, Base64BinaryType)
+impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, BooleanType)
+impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, DateTimeType)
+impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, DateType)
+impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, DayTimeDurationType)
+impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, DecimalType)
+impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, DoubleType)
+impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, DurationType)
+impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, FloatType)
+impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, GDayType)
+impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, GMonthDayType)
+impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, GMonthType)
+impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, GYearMonthType)
+impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, GYearType)
+impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, HexBinaryType)
+impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, IntegerType)
+impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, NOTATIONType)
+impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, QNameType)
+impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, StringType)
+impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, SchemaTimeType)
+impl(ToUntypedAtomicCasterLocator, ToUntypedAtomicCaster, YearMonthDurationType)
+
+/* xs:anyURI */
+implSelf(AnyURI)
+impl(ToAnyURICasterLocator, ToAnyURICaster, StringType)
+impl(ToAnyURICasterLocator, ToAnyURICaster, UntypedAtomicType)
+
+/* xs:boolean */
+implSelf(Boolean)
+impl(ToBooleanCasterLocator, NumericToBooleanCaster, DoubleType)
+impl(ToBooleanCasterLocator, NumericToBooleanCaster, FloatType)
+impl(ToBooleanCasterLocator, NumericToBooleanCaster, DecimalType)
+impl(ToBooleanCasterLocator, NumericToBooleanCaster, IntegerType)
+impl(ToBooleanCasterLocator, StringToBooleanCaster, StringType)
+impl(ToBooleanCasterLocator, StringToBooleanCaster, UntypedAtomicType)
+
+/* xs:double */
+implSelf(Double)
+impl(ToDoubleCasterLocator, BooleanToDoubleCaster, BooleanType)
+impl(ToDoubleCasterLocator, NumericToDoubleCaster, FloatType)
+impl(ToDoubleCasterLocator, NumericToDoubleCaster, DecimalType)
+impl(ToDoubleCasterLocator, NumericToDoubleCaster, IntegerType)
+impl(ToDoubleCasterLocator, StringToDoubleCaster, StringType)
+impl(ToDoubleCasterLocator, StringToDoubleCaster, UntypedAtomicType)
+
+/* xs:float */
+implSelf(Float)
+impl(ToFloatCasterLocator, BooleanToFloatCaster, BooleanType)
+impl(ToFloatCasterLocator, NumericToFloatCaster, DoubleType)
+impl(ToFloatCasterLocator, NumericToFloatCaster, DecimalType)
+impl(ToFloatCasterLocator, NumericToFloatCaster, IntegerType)
+impl(ToFloatCasterLocator, StringToFloatCaster, StringType)
+impl(ToFloatCasterLocator, StringToFloatCaster, UntypedAtomicType)
+
+/* xs:decimal */
+implSelf(Decimal)
+impl(ToDecimalCasterLocator, BooleanToDecimalCaster, BooleanType)
+impl(ToDecimalCasterLocator, NumericToDecimalCaster<false>, DoubleType)
+impl(ToDecimalCasterLocator, NumericToDecimalCaster<false>, FloatType)
+impl(ToDecimalCasterLocator, NumericToDecimalCaster<false>, IntegerType)
+impl(ToDecimalCasterLocator, StringToDecimalCaster, StringType)
+impl(ToDecimalCasterLocator, StringToDecimalCaster, UntypedAtomicType)
+
+/* xs:integer */
+implSelf(Integer)
+impl(ToIntegerCasterLocator, BooleanToIntegerCaster, BooleanType)
+impl(ToIntegerCasterLocator, NumericToDecimalCaster<true>, DoubleType)
+impl(ToIntegerCasterLocator, NumericToDecimalCaster<true>, FloatType)
+impl(ToIntegerCasterLocator, NumericToDecimalCaster<true>, DecimalType)
+impl(ToIntegerCasterLocator, StringToIntegerCaster, StringType)
+impl(ToIntegerCasterLocator, StringToIntegerCaster, UntypedAtomicType)
+
+/* xs:base64binary */
+implSelf(Base64Binary)
+impl(ToBase64BinaryCasterLocator, HexBinaryToBase64BinaryCaster, HexBinaryType)
+impl(ToBase64BinaryCasterLocator, StringToBase64BinaryCaster, StringType)
+impl(ToBase64BinaryCasterLocator, StringToBase64BinaryCaster, UntypedAtomicType)
+
+/* xs:hexBinary */
+implSelf(HexBinary)
+impl(ToHexBinaryCasterLocator, Base64BinaryToHexBinaryCaster, Base64BinaryType)
+impl(ToHexBinaryCasterLocator, StringToHexBinaryCaster, StringType)
+impl(ToHexBinaryCasterLocator, StringToHexBinaryCaster, UntypedAtomicType)
+
+/* xs:QName */
+implSelf(QName)
+impl(ToQNameCasterLocator, ToStringCaster<TypeString>, StringType)
+
+/* xs:gYear */
+implSelf(GYear)
+impl(ToGYearCasterLocator, StringToGYearCaster, StringType)
+impl(ToGYearCasterLocator, StringToGYearCaster, UntypedAtomicType)
+impl(ToGYearCasterLocator, AbstractDateTimeToGYearCaster, DateType)
+impl(ToGYearCasterLocator, AbstractDateTimeToGYearCaster, DateTimeType)
+
+/* xs:gDay */
+implSelf(GDay)
+impl(ToGDayCasterLocator, StringToGDayCaster, StringType)
+impl(ToGDayCasterLocator, StringToGDayCaster, UntypedAtomicType)
+impl(ToGDayCasterLocator, AbstractDateTimeToGDayCaster, DateType)
+impl(ToGDayCasterLocator, AbstractDateTimeToGDayCaster, DateTimeType)
+
+/* xs:gMonth */
+implSelf(GMonth)
+impl(ToGMonthCasterLocator, StringToGMonthCaster, StringType)
+impl(ToGMonthCasterLocator, StringToGMonthCaster, UntypedAtomicType)
+impl(ToGMonthCasterLocator, AbstractDateTimeToGMonthCaster, DateType)
+impl(ToGMonthCasterLocator, AbstractDateTimeToGMonthCaster, DateTimeType)
+
+/* xs:gYearMonth */
+implSelf(GYearMonth)
+impl(ToGYearMonthCasterLocator, StringToGYearMonthCaster, StringType)
+impl(ToGYearMonthCasterLocator, StringToGYearMonthCaster, UntypedAtomicType)
+impl(ToGYearMonthCasterLocator, AbstractDateTimeToGYearMonthCaster, DateType)
+impl(ToGYearMonthCasterLocator, AbstractDateTimeToGYearMonthCaster, DateTimeType)
+
+/* xs:gMonthDay */
+implSelf(GMonthDay)
+impl(ToGMonthDayCasterLocator, StringToGMonthDayCaster, StringType)
+impl(ToGMonthDayCasterLocator, StringToGMonthDayCaster, UntypedAtomicType)
+impl(ToGMonthDayCasterLocator, AbstractDateTimeToGMonthDayCaster, DateType)
+impl(ToGMonthDayCasterLocator, AbstractDateTimeToGMonthDayCaster, DateTimeType)
+
+/* xs:dateTime */
+implSelf(DateTime)
+impl(ToDateTimeCasterLocator, StringToDateTimeCaster, StringType)
+impl(ToDateTimeCasterLocator, AbstractDateTimeToDateTimeCaster, DateType)
+impl(ToDateTimeCasterLocator, StringToDateTimeCaster, UntypedAtomicType)
+
+/* xs:time */
+implSelf(SchemaTime)
+impl(ToSchemaTimeCasterLocator, StringToTimeCaster, StringType)
+impl(ToSchemaTimeCasterLocator, AbstractDateTimeToTimeCaster, DateTimeType)
+impl(ToSchemaTimeCasterLocator, StringToTimeCaster, UntypedAtomicType)
+
+/* xs:date */
+implSelf(Date)
+impl(ToDateCasterLocator, StringToDateCaster, StringType)
+impl(ToDateCasterLocator, AbstractDateTimeToDateCaster, DateTimeType)
+impl(ToDateCasterLocator, StringToDateCaster, UntypedAtomicType)
+
+/* xs:duration */
+implSelf(Duration)
+impl(ToDurationCasterLocator, AbstractDurationToDurationCaster, DayTimeDurationType)
+impl(ToDurationCasterLocator, AbstractDurationToDurationCaster, YearMonthDurationType)
+impl(ToDurationCasterLocator, StringToDurationCaster, StringType)
+impl(ToDurationCasterLocator, StringToDurationCaster, UntypedAtomicType)
+
+/* xs:dayTimeDuration */
+implSelf(DayTimeDuration)
+impl(ToDayTimeDurationCasterLocator, AbstractDurationToDayTimeDurationCaster, DurationType)
+impl(ToDayTimeDurationCasterLocator, AbstractDurationToDayTimeDurationCaster, YearMonthDurationType)
+impl(ToDayTimeDurationCasterLocator, StringToDayTimeDurationCaster, StringType)
+impl(ToDayTimeDurationCasterLocator, StringToDayTimeDurationCaster, UntypedAtomicType)
+
+/* xs:yearMonthDuration */
+implSelf(YearMonthDuration)
+impl(ToYearMonthDurationCasterLocator, AbstractDurationToYearMonthDurationCaster, DayTimeDurationType)
+impl(ToYearMonthDurationCasterLocator, AbstractDurationToYearMonthDurationCaster, DurationType)
+impl(ToYearMonthDurationCasterLocator, StringToYearMonthDurationCaster, StringType)
+impl(ToYearMonthDurationCasterLocator, StringToYearMonthDurationCaster, UntypedAtomicType)
+
+#undef implSelf
+#undef impl
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/type/qatomiccasterlocators_p.h b/src/xmlpatterns/type/qatomiccasterlocators_p.h
new file mode 100644
index 0000000..c5ac0a4
--- /dev/null
+++ b/src/xmlpatterns/type/qatomiccasterlocators_p.h
@@ -0,0 +1,909 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_AtomicCasterLocators_H
+#define Patternist_AtomicCasterLocators_H
+
+#include "qatomiccasterlocator_p.h"
+#include "qatomiccasters_p.h"
+//#include "qderivedinteger_p.h"
+
+/**
+ * @file
+ * @short Contains AtomicCasterLocator sub-classes that finds classes
+ * which can perform casting from one atomic value to another.
+ */
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class ToStringCasterLocator : public AtomicCasterLocator
+ {
+ public:
+ using AtomicCasterLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const AnyURIType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const Base64BinaryType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const BooleanType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DateTimeType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DateType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DayTimeDurationType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DecimalType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DoubleType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DurationType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const FloatType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GDayType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GMonthDayType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GMonthType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GYearMonthType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GYearType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const HexBinaryType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const IntegerType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const NOTATIONType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const QNameType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const StringType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const SchemaTimeType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const YearMonthDurationType *,
+ const SourceLocationReflection *const r) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class ToUntypedAtomicCasterLocator : public AtomicCasterLocator
+ {
+ public:
+ using AtomicCasterLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const AnyURIType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const Base64BinaryType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const BooleanType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DateTimeType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DateType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DayTimeDurationType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DecimalType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DoubleType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DurationType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const FloatType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GDayType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GMonthDayType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GMonthType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GYearMonthType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GYearType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const HexBinaryType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const IntegerType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const NOTATIONType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const QNameType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const StringType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const SchemaTimeType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const YearMonthDurationType *,
+ const SourceLocationReflection *const r) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class ToAnyURICasterLocator : public AtomicCasterLocator
+ {
+ public:
+ using AtomicCasterLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const StringType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const AnyURIType *,
+ const SourceLocationReflection *const r) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class ToBooleanCasterLocator : public AtomicCasterLocator
+ {
+ public:
+ using AtomicCasterLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const BooleanType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DecimalType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DoubleType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const FloatType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const IntegerType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const StringType *,
+ const SourceLocationReflection *const r) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class ToDoubleCasterLocator : public AtomicCasterLocator
+ {
+ public:
+ using AtomicCasterLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const BooleanType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DoubleType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DecimalType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const FloatType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const IntegerType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const StringType *,
+ const SourceLocationReflection *const r) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class ToFloatCasterLocator : public AtomicCasterLocator
+ {
+ public:
+ using AtomicCasterLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const BooleanType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DecimalType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DoubleType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const FloatType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const IntegerType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const StringType *,
+ const SourceLocationReflection *const r) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class ToDecimalCasterLocator : public AtomicCasterLocator
+ {
+ public:
+ using AtomicCasterLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const BooleanType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DecimalType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DoubleType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const FloatType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const IntegerType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const StringType *,
+ const SourceLocationReflection *const r) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class ToIntegerCasterLocator : public AtomicCasterLocator
+ {
+ public:
+ using AtomicCasterLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const BooleanType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DecimalType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DoubleType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const FloatType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const IntegerType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const StringType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *,
+ const SourceLocationReflection *const r) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class ToBase64BinaryCasterLocator : public AtomicCasterLocator
+ {
+ public:
+ using AtomicCasterLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const Base64BinaryType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const HexBinaryType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const StringType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *,
+ const SourceLocationReflection *const r) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class ToHexBinaryCasterLocator : public AtomicCasterLocator
+ {
+ public:
+ using AtomicCasterLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const Base64BinaryType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const HexBinaryType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const StringType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *,
+ const SourceLocationReflection *const r) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class ToQNameCasterLocator : public AtomicCasterLocator
+ {
+ public:
+ using AtomicCasterLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const QNameType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const StringType *,
+ const SourceLocationReflection *const r) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class ToGYearCasterLocator : public AtomicCasterLocator
+ {
+ public:
+ using AtomicCasterLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DateTimeType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DateType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GYearType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const StringType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *,
+ const SourceLocationReflection *const r) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class ToGDayCasterLocator : public AtomicCasterLocator
+ {
+ public:
+ using AtomicCasterLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DateTimeType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DateType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GDayType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const StringType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *,
+ const SourceLocationReflection *const r) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class ToGMonthCasterLocator : public AtomicCasterLocator
+ {
+ public:
+ using AtomicCasterLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DateTimeType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DateType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GMonthType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const StringType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *,
+ const SourceLocationReflection *const r) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class ToGYearMonthCasterLocator : public AtomicCasterLocator
+ {
+ public:
+ using AtomicCasterLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DateTimeType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DateType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GYearMonthType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const StringType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *,
+ const SourceLocationReflection *const r) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class ToGMonthDayCasterLocator : public AtomicCasterLocator
+ {
+ public:
+ using AtomicCasterLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DateTimeType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DateType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GMonthDayType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const StringType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *,
+ const SourceLocationReflection *const r) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class ToDateTimeCasterLocator : public AtomicCasterLocator
+ {
+ public:
+ using AtomicCasterLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DateTimeType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DateType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const StringType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *,
+ const SourceLocationReflection *const r) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class ToDateCasterLocator : public AtomicCasterLocator
+ {
+ public:
+ using AtomicCasterLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DateTimeType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DateType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const StringType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *,
+ const SourceLocationReflection *const r) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class ToSchemaTimeCasterLocator : public AtomicCasterLocator
+ {
+ public:
+ using AtomicCasterLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DateTimeType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const SchemaTimeType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const StringType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *,
+ const SourceLocationReflection *const r) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class ToDurationCasterLocator : public AtomicCasterLocator
+ {
+ public:
+ using AtomicCasterLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DayTimeDurationType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DurationType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const StringType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const YearMonthDurationType *,
+ const SourceLocationReflection *const r) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class ToDayTimeDurationCasterLocator : public AtomicCasterLocator
+ {
+ public:
+ using AtomicCasterLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DayTimeDurationType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DurationType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const StringType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const YearMonthDurationType *,
+ const SourceLocationReflection *const r) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class ToYearMonthDurationCasterLocator : public AtomicCasterLocator
+ {
+ public:
+ using AtomicCasterLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DayTimeDurationType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DurationType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const StringType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const YearMonthDurationType *,
+ const SourceLocationReflection *const r) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ template<TypeOfDerivedInteger type>
+ class ToDerivedIntegerCasterLocator : public ToIntegerCasterLocator
+ {
+ public:
+ using ToIntegerCasterLocator::visit;
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const BooleanType *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new BooleanToDerivedIntegerCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const StringType *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new StringToDerivedIntegerCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const AnyURIType *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new StringToDerivedIntegerCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new StringToDerivedIntegerCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const IntegerType *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new NumericToDerivedIntegerCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const DerivedIntegerType<TypeByte> *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new NumericToDerivedIntegerCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const DerivedIntegerType<TypeInt> *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new NumericToDerivedIntegerCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const DerivedIntegerType<TypeLong> *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new NumericToDerivedIntegerCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const DerivedIntegerType<TypeNegativeInteger> *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new NumericToDerivedIntegerCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const DerivedIntegerType<TypeNonNegativeInteger> *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new NumericToDerivedIntegerCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const DerivedIntegerType<TypeNonPositiveInteger> *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new NumericToDerivedIntegerCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const DerivedIntegerType<TypePositiveInteger> *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new NumericToDerivedIntegerCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const DerivedIntegerType<TypeShort> *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new NumericToDerivedIntegerCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const DerivedIntegerType<TypeUnsignedByte> *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new NumericToDerivedIntegerCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const DerivedIntegerType<TypeUnsignedInt> *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new NumericToDerivedIntegerCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const DerivedIntegerType<TypeUnsignedLong> *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new NumericToDerivedIntegerCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const DerivedIntegerType<TypeUnsignedShort> *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new NumericToDerivedIntegerCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const DoubleType *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new NumericToDerivedIntegerCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const FloatType *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new NumericToDerivedIntegerCaster<type>());
+ }
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ template<TypeOfDerivedString type>
+ class ToDerivedStringCasterLocator : public ToStringCasterLocator
+ {
+ public:
+ using ToStringCasterLocator::visit;
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const BooleanType *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const StringType *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const AnyURIType *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>());
+ }
+
+ // TODO TypeString not handled
+ virtual AtomicTypeVisitorResult::Ptr visit(const DerivedStringType<TypeNormalizedString> *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const DerivedStringType<TypeToken> *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const DerivedStringType<TypeLanguage> *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const DerivedStringType<TypeNMTOKEN> *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const DerivedStringType<TypeName> *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const DerivedStringType<TypeNCName> *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const DerivedStringType<TypeID> *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const DerivedStringType<TypeIDREF> *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const DerivedStringType<TypeENTITY> *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const DateTimeType *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const DateType *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const SchemaTimeType *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const FloatType *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const DoubleType *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const DecimalType *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const IntegerType *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const DurationType *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const GYearMonthType *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const GYearType *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const GMonthDayType *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const GDayType *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const GMonthType *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>());
+ }
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const QNameType *,
+ const SourceLocationReflection *const r) const
+ {
+ Q_UNUSED(r);
+ return AtomicTypeVisitorResult::Ptr(new AnyToDerivedStringCaster<type>());
+ }
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/type/qatomiccomparatorlocator.cpp b/src/xmlpatterns/type/qatomiccomparatorlocator.cpp
new file mode 100644
index 0000000..61f9722
--- /dev/null
+++ b/src/xmlpatterns/type/qatomiccomparatorlocator.cpp
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qatomiccomparatorlocator_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+AtomicComparatorLocator::AtomicComparatorLocator()
+{
+}
+
+AtomicComparatorLocator::~AtomicComparatorLocator()
+{
+}
+
+#define implCompVisit(type) \
+AtomicTypeVisitorResult::Ptr \
+AtomicComparatorLocator::visit(const type *, \
+ const qint16, \
+ const SourceLocationReflection *const) const \
+{ \
+ return AtomicTypeVisitorResult::Ptr(); \
+}
+
+implCompVisit(AnyAtomicType)
+implCompVisit(AnyURIType)
+implCompVisit(Base64BinaryType)
+implCompVisit(BooleanType)
+implCompVisit(DateTimeType)
+implCompVisit(DateType)
+implCompVisit(DayTimeDurationType)
+implCompVisit(DecimalType)
+implCompVisit(DoubleType)
+implCompVisit(DurationType)
+implCompVisit(FloatType)
+implCompVisit(GDayType)
+implCompVisit(GMonthDayType)
+implCompVisit(GMonthType)
+implCompVisit(GYearMonthType)
+implCompVisit(GYearType)
+implCompVisit(HexBinaryType)
+implCompVisit(IntegerType)
+implCompVisit(NOTATIONType)
+implCompVisit(QNameType)
+implCompVisit(StringType)
+implCompVisit(SchemaTimeType)
+implCompVisit(UntypedAtomicType)
+implCompVisit(YearMonthDurationType)
+#undef implCompVisit
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/type/qatomiccomparatorlocator_p.h b/src/xmlpatterns/type/qatomiccomparatorlocator_p.h
new file mode 100644
index 0000000..54aa45b
--- /dev/null
+++ b/src/xmlpatterns/type/qatomiccomparatorlocator_p.h
@@ -0,0 +1,132 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_AtomicComparatorLocator_H
+#define Patternist_AtomicComparatorLocator_H
+
+#include "qatomictypedispatch_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+
+ /**
+ * @todo Docs missing
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class AtomicComparatorLocator : public ParameterizedAtomicTypeVisitor
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<AtomicComparatorLocator> Ptr;
+ AtomicComparatorLocator();
+ virtual ~AtomicComparatorLocator();
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const AnyAtomicType *, const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const AnyURIType *, const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const Base64BinaryType *, const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const BooleanType *, const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DateTimeType *, const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DateType *, const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DayTimeDurationType *, const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DecimalType *, const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DoubleType *, const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DurationType *, const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const FloatType *, const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GDayType *, const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GMonthDayType *, const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GMonthType *, const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GYearMonthType *, const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GYearType *, const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const HexBinaryType *, const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const IntegerType *, const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const NOTATIONType *, const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const QNameType *, const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const StringType *, const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const SchemaTimeType *, const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *, const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const YearMonthDurationType *, const qint16 op,
+ const SourceLocationReflection *const) const;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/type/qatomiccomparatorlocators.cpp b/src/xmlpatterns/type/qatomiccomparatorlocators.cpp
new file mode 100644
index 0000000..0fd31d0
--- /dev/null
+++ b/src/xmlpatterns/type/qatomiccomparatorlocators.cpp
@@ -0,0 +1,232 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qatomiccomparators_p.h"
+
+#include "qatomiccomparatorlocators_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+static const AtomicComparator::Operators AllCompOperators(AtomicComparator::OperatorNotEqual |
+ AtomicComparator::OperatorGreaterOrEqual |
+ AtomicComparator::OperatorLessOrEqual |
+ AtomicComparator::OperatorLessThanNaNLeast |
+ AtomicComparator::OperatorLessThanNaNGreatest);
+/* --------------------------------------------------------------- */
+#define addVisitor(owner, type, comp, validOps) \
+AtomicTypeVisitorResult::Ptr \
+owner##ComparatorLocator::visit(const type *, \
+ const qint16 op, \
+ const SourceLocationReflection *const) const \
+{ \
+ /* Note the extra paranteses around validOps. */ \
+ if(((validOps) & AtomicComparator::Operator(op)) == op) \
+ return AtomicTypeVisitorResult::Ptr(new comp()); \
+ else \
+ return AtomicTypeVisitorResult::Ptr(); \
+}
+/* --------------------------------------------------------------- */
+#define visitorForDouble(owner, type) \
+AtomicTypeVisitorResult::Ptr \
+owner##ComparatorLocator::visit(const type *, \
+ const qint16 op, \
+ const SourceLocationReflection *const) const \
+{ \
+ if(((AtomicComparator::OperatorNotEqual | \
+ AtomicComparator::OperatorGreaterOrEqual | \
+ AtomicComparator::OperatorLessOrEqual) & AtomicComparator::Operator(op)) == op) \
+ return AtomicTypeVisitorResult::Ptr(new AbstractFloatComparator()); \
+ else if(op == AtomicComparator::OperatorLessThanNaNLeast) \
+ return AtomicTypeVisitorResult::Ptr(new AbstractFloatSortComparator<AtomicComparator::OperatorLessThanNaNLeast>()); \
+ else if(op == AtomicComparator::OperatorLessThanNaNGreatest) \
+ return AtomicTypeVisitorResult::Ptr(new AbstractFloatSortComparator<AtomicComparator::OperatorLessThanNaNGreatest>()); \
+ else \
+ return AtomicTypeVisitorResult::Ptr(); \
+}
+/* --------------------------------------------------------------- */
+
+/* ----------- xs:string, xs:anyURI, xs:untypedAtomic ----------- */
+addVisitor(String, StringType, StringComparator,
+ AllCompOperators)
+addVisitor(String, UntypedAtomicType, StringComparator,
+ AllCompOperators)
+addVisitor(String, AnyURIType, StringComparator,
+ AllCompOperators)
+/* --------------------------------------------------------------- */
+
+/* ------------------------- xs:hexBinary ------------------------ */
+addVisitor(HexBinary, HexBinaryType, BinaryDataComparator,
+ AtomicComparator::OperatorEqual |
+ AtomicComparator::OperatorNotEqual)
+/* --------------------------------------------------------------- */
+
+/* ----------------------- xs:base64Binary ----------------------- */
+addVisitor(Base64Binary, Base64BinaryType, BinaryDataComparator,
+ AtomicComparator::OperatorEqual |
+ AtomicComparator::OperatorNotEqual)
+/* --------------------------------------------------------------- */
+
+/* -------------------------- xs:boolean ------------------------- */
+addVisitor(Boolean, BooleanType, BooleanComparator,
+ AllCompOperators)
+/* --------------------------------------------------------------- */
+
+/* -------------------------- xs:double -------------------------- */
+visitorForDouble(Double, DoubleType)
+visitorForDouble(Double, FloatType)
+visitorForDouble(Double, DecimalType)
+visitorForDouble(Double, IntegerType)
+/* --------------------------------------------------------------- */
+
+/* --------------------------- xs:float -------------------------- */
+visitorForDouble(Float, DoubleType)
+visitorForDouble(Float, FloatType)
+visitorForDouble(Float, DecimalType)
+visitorForDouble(Float, IntegerType)
+/* --------------------------------------------------------------- */
+
+/* -------------------------- xs:decimal ------------------------- */
+visitorForDouble(Decimal, DoubleType)
+visitorForDouble(Decimal, FloatType)
+addVisitor(Decimal, DecimalType, DecimalComparator,
+ AllCompOperators)
+addVisitor(Decimal, IntegerType, DecimalComparator,
+ AllCompOperators)
+/* --------------------------------------------------------------- */
+
+/* ------------------------- xs:integer -------------------------- */
+visitorForDouble(Integer, DoubleType)
+visitorForDouble(Integer, FloatType)
+addVisitor(Integer, DecimalType, DecimalComparator,
+ AllCompOperators)
+addVisitor(Integer, IntegerType, IntegerComparator,
+ AllCompOperators)
+/* --------------------------------------------------------------- */
+
+/* -------------------------- xs:QName --------------------------- */
+addVisitor(QName, QNameType, QNameComparator,
+ AtomicComparator::OperatorEqual |
+ AtomicComparator::OperatorNotEqual)
+/* --------------------------------------------------------------- */
+
+/* -------------------------- xs:gYear --------------------------- */
+addVisitor(GYear, GYearType, AbstractDateTimeComparator,
+ AtomicComparator::OperatorEqual |
+ AtomicComparator::OperatorNotEqual)
+/* --------------------------------------------------------------- */
+
+/* -------------------------- xs:gDay ---------------------------- */
+addVisitor(GDay, GDayType, AbstractDateTimeComparator,
+ AtomicComparator::OperatorEqual |
+ AtomicComparator::OperatorNotEqual)
+/* --------------------------------------------------------------- */
+
+/* -------------------------- xs:gMonth -------------------------- */
+addVisitor(GMonth, GMonthType, AbstractDateTimeComparator,
+ AtomicComparator::OperatorEqual |
+ AtomicComparator::OperatorNotEqual)
+/* --------------------------------------------------------------- */
+
+/* ------------------------ xs:gYearMonth ------------------------ */
+addVisitor(GYearMonth, GYearMonthType, AbstractDateTimeComparator,
+ AtomicComparator::OperatorEqual |
+ AtomicComparator::OperatorNotEqual)
+/* --------------------------------------------------------------- */
+
+/* ------------------------ xs:gMonthDay ------------------------- */
+addVisitor(GMonthDay, GMonthDayType, AbstractDateTimeComparator,
+ AtomicComparator::OperatorEqual |
+ AtomicComparator::OperatorNotEqual)
+/* --------------------------------------------------------------- */
+
+/* ------------------------ xs:dateTime -------------------------- */
+addVisitor(DateTime, DateTimeType, AbstractDateTimeComparator,
+ AllCompOperators)
+/* --------------------------------------------------------------- */
+
+/* -------------------------- xs:time ---------------------------- */
+addVisitor(SchemaTime, SchemaTimeType, AbstractDateTimeComparator,
+ AllCompOperators)
+/* --------------------------------------------------------------- */
+
+/* -------------------------- xs:date ---------------------------- */
+addVisitor(Date, DateType, AbstractDateTimeComparator,
+ AllCompOperators)
+/* --------------------------------------------------------------- */
+
+/* ------------------------ xs:duration -------------------------- */
+addVisitor(Duration, DayTimeDurationType, AbstractDurationComparator,
+ AtomicComparator::OperatorEqual |
+ AtomicComparator::OperatorNotEqual)
+addVisitor(Duration, DurationType, AbstractDurationComparator,
+ AtomicComparator::OperatorEqual |
+ AtomicComparator::OperatorNotEqual)
+addVisitor(Duration, YearMonthDurationType, AbstractDurationComparator,
+ AtomicComparator::OperatorEqual |
+ AtomicComparator::OperatorNotEqual)
+/* --------------------------------------------------------------- */
+
+/* ------------------ xs:dayTimeDuration ------------------------ */
+addVisitor(DayTimeDuration, DayTimeDurationType, AbstractDurationComparator,
+ AllCompOperators)
+addVisitor(DayTimeDuration, DurationType, AbstractDurationComparator,
+ AtomicComparator::OperatorEqual |
+ AtomicComparator::OperatorNotEqual)
+addVisitor(DayTimeDuration, YearMonthDurationType, AbstractDurationComparator,
+ AtomicComparator::OperatorEqual |
+ AtomicComparator::OperatorNotEqual)
+/* --------------------------------------------------------------- */
+
+/* ------------------- xs:yearMonthDuration --------------------- */
+addVisitor(YearMonthDuration, DayTimeDurationType, AbstractDurationComparator,
+ AtomicComparator::OperatorEqual |
+ AtomicComparator::OperatorNotEqual)
+addVisitor(YearMonthDuration, DurationType, AbstractDurationComparator,
+ AtomicComparator::OperatorEqual |
+ AtomicComparator::OperatorNotEqual)
+addVisitor(YearMonthDuration, YearMonthDurationType, AbstractDurationComparator,
+ AllCompOperators)
+/* --------------------------------------------------------------- */
+#undef addVisitor
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/type/qatomiccomparatorlocators_p.h b/src/xmlpatterns/type/qatomiccomparatorlocators_p.h
new file mode 100644
index 0000000..77aabec
--- /dev/null
+++ b/src/xmlpatterns/type/qatomiccomparatorlocators_p.h
@@ -0,0 +1,356 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_AtomicComparatorLocators_H
+#define Patternist_AtomicComparatorLocators_H
+
+#include "qatomiccomparatorlocator_p.h"
+
+/**
+ * @file
+ * @short Contains AtomicComparatorLocator sub-classes that finds classes
+ * which can compare atomic values.
+ */
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class DoubleComparatorLocator : public AtomicComparatorLocator
+ {
+ using AtomicComparatorLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DoubleType *,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const FloatType *,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DecimalType *,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const IntegerType *,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class FloatComparatorLocator : public AtomicComparatorLocator
+ {
+ using AtomicComparatorLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DoubleType *,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const FloatType *,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DecimalType *,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const IntegerType *,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class DecimalComparatorLocator : public AtomicComparatorLocator
+ {
+ using AtomicComparatorLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DoubleType *,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const FloatType *,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DecimalType *,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const IntegerType *,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class IntegerComparatorLocator : public AtomicComparatorLocator
+ {
+ using AtomicComparatorLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DoubleType *,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const FloatType *,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DecimalType *,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const IntegerType *,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class BooleanComparatorLocator : public AtomicComparatorLocator
+ {
+ using AtomicComparatorLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const BooleanType *,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class Base64BinaryComparatorLocator : public AtomicComparatorLocator
+ {
+ using AtomicComparatorLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const Base64BinaryType *,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class HexBinaryComparatorLocator : public AtomicComparatorLocator
+ {
+ using AtomicComparatorLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const HexBinaryType *,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class QNameComparatorLocator : public AtomicComparatorLocator
+ {
+ using AtomicComparatorLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const QNameType *,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class StringComparatorLocator : public AtomicComparatorLocator
+ {
+ using AtomicComparatorLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const StringType *,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const AnyURIType *,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+ };
+
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class GYearComparatorLocator : public AtomicComparatorLocator
+ {
+ using AtomicComparatorLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GYearType *,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class GMonthComparatorLocator : public AtomicComparatorLocator
+ {
+ using AtomicComparatorLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GMonthType *,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class GYearMonthComparatorLocator : public AtomicComparatorLocator
+ {
+ using AtomicComparatorLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GYearMonthType *,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class GMonthDayComparatorLocator : public AtomicComparatorLocator
+ {
+ using AtomicComparatorLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GMonthDayType *,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class GDayComparatorLocator : public AtomicComparatorLocator
+ {
+ using AtomicComparatorLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GDayType *,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class DateTimeComparatorLocator : public AtomicComparatorLocator
+ {
+ using AtomicComparatorLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DateTimeType *,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class SchemaTimeComparatorLocator : public AtomicComparatorLocator
+ {
+ using AtomicComparatorLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const SchemaTimeType *,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class DateComparatorLocator : public AtomicComparatorLocator
+ {
+ using AtomicComparatorLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DateType *,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class DurationComparatorLocator : public AtomicComparatorLocator
+ {
+ using AtomicComparatorLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DayTimeDurationType *,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DurationType *,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const YearMonthDurationType *,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class DayTimeDurationComparatorLocator : public AtomicComparatorLocator
+ {
+ using AtomicComparatorLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DayTimeDurationType *,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DurationType *,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const YearMonthDurationType *,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class YearMonthDurationComparatorLocator : public AtomicComparatorLocator
+ {
+ using AtomicComparatorLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DayTimeDurationType *,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DurationType *,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const YearMonthDurationType *,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/type/qatomicmathematicianlocator.cpp b/src/xmlpatterns/type/qatomicmathematicianlocator.cpp
new file mode 100644
index 0000000..3fb1503
--- /dev/null
+++ b/src/xmlpatterns/type/qatomicmathematicianlocator.cpp
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qatomicmathematicianlocator_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+AtomicMathematicianLocator::~AtomicMathematicianLocator()
+{
+}
+
+#define implVisit(type) \
+AtomicTypeVisitorResult::Ptr AtomicMathematicianLocator::visit(const type *, const qint16, \
+ const SourceLocationReflection *const) const \
+{ \
+ return AtomicTypeVisitorResult::Ptr(); \
+}
+
+implVisit(AnyAtomicType)
+implVisit(AnyURIType)
+implVisit(Base64BinaryType)
+implVisit(BooleanType)
+implVisit(DateTimeType)
+implVisit(DateType)
+implVisit(DayTimeDurationType)
+implVisit(DecimalType)
+implVisit(DoubleType)
+implVisit(DurationType)
+implVisit(FloatType)
+implVisit(GDayType)
+implVisit(GMonthDayType)
+implVisit(GMonthType)
+implVisit(GYearMonthType)
+implVisit(GYearType)
+implVisit(HexBinaryType)
+implVisit(IntegerType)
+implVisit(NOTATIONType)
+implVisit(QNameType)
+implVisit(StringType)
+implVisit(SchemaTimeType)
+implVisit(UntypedAtomicType)
+implVisit(YearMonthDurationType)
+#undef implVisit
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/type/qatomicmathematicianlocator_p.h b/src/xmlpatterns/type/qatomicmathematicianlocator_p.h
new file mode 100644
index 0000000..e4e55e4
--- /dev/null
+++ b/src/xmlpatterns/type/qatomicmathematicianlocator_p.h
@@ -0,0 +1,158 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_AtomicTypeVisitorResultLocator_H
+#define Patternist_AtomicTypeVisitorResultLocator_H
+
+#include "qatomictypedispatch_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @todo Docs missing
+ *
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class AtomicMathematicianLocator : public ParameterizedAtomicTypeVisitor
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<AtomicMathematicianLocator> Ptr;
+
+ inline AtomicMathematicianLocator()
+ {
+ }
+
+ virtual ~AtomicMathematicianLocator();
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const AnyAtomicType *,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const AnyURIType *,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const Base64BinaryType *,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const BooleanType *,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DateTimeType *,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DateType *,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DayTimeDurationType *,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DecimalType *,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DoubleType *,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DurationType *,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const FloatType *,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GDayType *,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GMonthDayType *,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GMonthType *,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GYearMonthType *,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GYearType *,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const HexBinaryType *,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const IntegerType *,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const NOTATIONType *,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const QNameType *,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const StringType *,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const SchemaTimeType *,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const YearMonthDurationType *,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/type/qatomicmathematicianlocators.cpp b/src/xmlpatterns/type/qatomicmathematicianlocators.cpp
new file mode 100644
index 0000000..7c5518d
--- /dev/null
+++ b/src/xmlpatterns/type/qatomicmathematicianlocators.cpp
@@ -0,0 +1,168 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qabstractfloatmathematician_p.h"
+#include "qatomicmathematicianlocators_p.h"
+#include "qatomicmathematicians_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+#define implMathVisit(ownerClass, visitor, mather, validOps) \
+AtomicTypeVisitorResult::Ptr \
+ownerClass##MathematicianLocator::visit(const visitor *, const qint16 op, \
+ const SourceLocationReflection *const r) const \
+{ \
+ Q_UNUSED(r) \
+ /* Note the extra paranteses around validOps. */ \
+ if(((validOps) & AtomicMathematician::Operator(op)) == op) \
+ return AtomicTypeVisitorResult::Ptr(new mather()); \
+ else \
+ return AtomicTypeVisitorResult::Ptr(); \
+}
+
+#define implReportingMathVisit(ownerClass, visitor, mather, validOps) \
+AtomicTypeVisitorResult::Ptr \
+ownerClass##MathematicianLocator::visit(const visitor *, const qint16 op, \
+ const SourceLocationReflection *const r) const \
+{ \
+ /* Note the extra paranteses around validOps. */ \
+ if(((validOps) & AtomicMathematician::Operator(op)) == op) \
+ return AtomicTypeVisitorResult::Ptr(new mather(r)); \
+ else \
+ return AtomicTypeVisitorResult::Ptr(); \
+}
+
+#define implRevReportingMathVisit(ownerClass, visitor, mather, validOps) \
+AtomicTypeVisitorResult::Ptr \
+ownerClass##MathematicianLocator::visit(const visitor *, const qint16 op, \
+ const SourceLocationReflection *const r) const \
+{ \
+ /* Note the extra paranteses around validOps. */ \
+ if(((validOps) & AtomicMathematician::Operator(op)) == op) \
+ return AtomicTypeVisitorResult::Ptr(new OperandSwitcherMathematician( \
+ AtomicMathematician::Ptr(new mather(r)))); \
+ else \
+ return AtomicTypeVisitorResult::Ptr(); \
+}
+
+static const AtomicMathematician::Operators AllMathOperators(AtomicMathematician::Add |
+ AtomicMathematician::Div |
+ AtomicMathematician::IDiv |
+ AtomicMathematician::Mod |
+ AtomicMathematician::Multiply |
+ AtomicMathematician::Substract);
+
+static const AtomicMathematician::Operators DivMultiply(AtomicMathematician::Multiply |
+ AtomicMathematician::Div);
+
+static const AtomicMathematician::Operators DurationOps(AtomicMathematician::Div |
+ AtomicMathematician::Substract |
+ AtomicMathematician::Add);
+
+static const AtomicMathematician::Operators DTOps(AtomicMathematician::Substract |
+ AtomicMathematician::Add);
+
+implReportingMathVisit(Double, DecimalType, DoubleMathematician, AllMathOperators)
+implReportingMathVisit(Double, DoubleType, DoubleMathematician, AllMathOperators)
+implReportingMathVisit(Double, FloatType, DoubleMathematician, AllMathOperators)
+implReportingMathVisit(Double, IntegerType, DoubleMathematician, AllMathOperators)
+implRevReportingMathVisit(Double, YearMonthDurationType, DurationNumericMathematician, AtomicMathematician::Multiply)
+implRevReportingMathVisit(Double, DayTimeDurationType, DurationNumericMathematician, AtomicMathematician::Multiply)
+
+implReportingMathVisit(Float, DecimalType, FloatMathematician, AllMathOperators)
+implReportingMathVisit(Float, DoubleType, DoubleMathematician, AllMathOperators)
+implReportingMathVisit(Float, FloatType, FloatMathematician, AllMathOperators)
+implReportingMathVisit(Float, IntegerType, FloatMathematician, AllMathOperators)
+implRevReportingMathVisit(Float, YearMonthDurationType, DurationNumericMathematician, AtomicMathematician::Multiply)
+implRevReportingMathVisit(Float, DayTimeDurationType, DurationNumericMathematician, AtomicMathematician::Multiply)
+
+implReportingMathVisit(Decimal, DecimalType, DecimalMathematician, AllMathOperators)
+implReportingMathVisit(Decimal, DoubleType, DoubleMathematician, AllMathOperators)
+implReportingMathVisit(Decimal, FloatType, FloatMathematician, AllMathOperators)
+implReportingMathVisit(Decimal, IntegerType, DecimalMathematician, AllMathOperators)
+implRevReportingMathVisit(Decimal, YearMonthDurationType, DurationNumericMathematician, AtomicMathematician::Multiply)
+implRevReportingMathVisit(Decimal, DayTimeDurationType, DurationNumericMathematician, AtomicMathematician::Multiply)
+
+implReportingMathVisit(Integer, DecimalType, DecimalMathematician, AllMathOperators)
+implReportingMathVisit(Integer, DoubleType, DoubleMathematician, AllMathOperators)
+implReportingMathVisit(Integer, FloatType, FloatMathematician, AllMathOperators)
+implReportingMathVisit(Integer, IntegerType, IntegerMathematician, AllMathOperators)
+implRevReportingMathVisit(Integer, YearMonthDurationType, DurationNumericMathematician, AtomicMathematician::Multiply)
+implRevReportingMathVisit(Integer, DayTimeDurationType, DurationNumericMathematician, AtomicMathematician::Multiply)
+
+implRevReportingMathVisit(DayTimeDuration, DateTimeType, DateTimeDurationMathematician, AtomicMathematician::Add)
+implRevReportingMathVisit(DayTimeDuration, DateType, DateTimeDurationMathematician, AtomicMathematician::Add)
+implMathVisit(DayTimeDuration, DayTimeDurationType, DurationDurationMathematician, DurationOps)
+implReportingMathVisit(DayTimeDuration, DecimalType, DurationNumericMathematician, DivMultiply)
+implReportingMathVisit(DayTimeDuration, DoubleType, DurationNumericMathematician, DivMultiply)
+implReportingMathVisit(DayTimeDuration, FloatType, DurationNumericMathematician, DivMultiply)
+implReportingMathVisit(DayTimeDuration, IntegerType, DurationNumericMathematician, DivMultiply)
+implRevReportingMathVisit(DayTimeDuration, SchemaTimeType, DateTimeDurationMathematician, AtomicMathematician::Add)
+
+implRevReportingMathVisit(YearMonthDuration, DateTimeType, DateTimeDurationMathematician, AtomicMathematician::Add)
+implRevReportingMathVisit(YearMonthDuration, DateType, DateTimeDurationMathematician, AtomicMathematician::Add)
+implReportingMathVisit(YearMonthDuration, DecimalType, DurationNumericMathematician, DivMultiply)
+implReportingMathVisit(YearMonthDuration, DoubleType, DurationNumericMathematician, DivMultiply)
+implReportingMathVisit(YearMonthDuration, FloatType, DurationNumericMathematician, DivMultiply)
+implReportingMathVisit(YearMonthDuration, IntegerType, DurationNumericMathematician, DivMultiply)
+implMathVisit(YearMonthDuration, YearMonthDurationType, DurationDurationMathematician, DurationOps)
+
+implMathVisit(Date, DateType, AbstractDateTimeMathematician,
+ AtomicMathematician::Substract)
+implReportingMathVisit(Date, YearMonthDurationType, DateTimeDurationMathematician, DTOps)
+implReportingMathVisit(Date, DayTimeDurationType, DateTimeDurationMathematician, DTOps)
+
+implMathVisit(SchemaTime, SchemaTimeType, AbstractDateTimeMathematician,
+ AtomicMathematician::Substract)
+implReportingMathVisit(SchemaTime, DayTimeDurationType, DateTimeDurationMathematician, DTOps)
+
+implMathVisit(DateTime, DateTimeType, AbstractDateTimeMathematician,
+ AtomicMathematician::Substract)
+implReportingMathVisit(DateTime, YearMonthDurationType, DateTimeDurationMathematician, DTOps)
+implReportingMathVisit(DateTime, DayTimeDurationType, DateTimeDurationMathematician, DTOps)
+
+#undef implMathVisit
+#undef implReportingMathVisit
+#undef implRevReportingMathVisit
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/type/qatomicmathematicianlocators_p.h b/src/xmlpatterns/type/qatomicmathematicianlocators_p.h
new file mode 100644
index 0000000..0d95698
--- /dev/null
+++ b/src/xmlpatterns/type/qatomicmathematicianlocators_p.h
@@ -0,0 +1,249 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_AtomicMathematicianLocators_H
+#define Patternist_AtomicMathematicianLocators_H
+
+#include "qatomicmathematician_p.h"
+#include "qatomicmathematicianlocator_p.h"
+
+/**
+ * @file
+ * @short Contains AtomicMathematicianLocator sub-classes that finds classes
+ * which can perform arithmetics between atomic values.
+ */
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ * @todo docs
+ */
+ class DoubleMathematicianLocator : public AtomicMathematicianLocator
+ {
+ using AtomicMathematicianLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DayTimeDurationType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DecimalType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DoubleType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const FloatType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const IntegerType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const YearMonthDurationType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ * @todo docs
+ */
+ class FloatMathematicianLocator : public AtomicMathematicianLocator
+ {
+ using AtomicMathematicianLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DayTimeDurationType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DecimalType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DoubleType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const FloatType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const IntegerType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const YearMonthDurationType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ * @todo docs
+ */
+ class DecimalMathematicianLocator : public AtomicMathematicianLocator
+ {
+ using AtomicMathematicianLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DayTimeDurationType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DecimalType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DoubleType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const FloatType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const IntegerType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const YearMonthDurationType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ * @todo docs
+ */
+ class IntegerMathematicianLocator : public AtomicMathematicianLocator
+ {
+ using AtomicMathematicianLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DayTimeDurationType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DecimalType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DoubleType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const FloatType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const IntegerType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const YearMonthDurationType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ * @todo docs
+ */
+ class DateMathematicianLocator : public AtomicMathematicianLocator
+ {
+ using AtomicMathematicianLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DateType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const YearMonthDurationType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DayTimeDurationType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ * @todo docs
+ */
+ class SchemaTimeMathematicianLocator : public AtomicMathematicianLocator
+ {
+ using AtomicMathematicianLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const SchemaTimeType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DayTimeDurationType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ * @todo docs
+ */
+ class DateTimeMathematicianLocator : public AtomicMathematicianLocator
+ {
+ using AtomicMathematicianLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DateTimeType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const YearMonthDurationType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DayTimeDurationType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ };
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ * @todo docs
+ */
+ class DayTimeDurationMathematicianLocator : public AtomicMathematicianLocator
+ {
+ using AtomicMathematicianLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DateTimeType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DateType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DayTimeDurationType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DecimalType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DoubleType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const FloatType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const IntegerType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const SchemaTimeType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ };
+
+ /**
+ * @author Frans Englich <frans.englich@nokia.com>
+ * @todo docs
+ */
+ class YearMonthDurationMathematicianLocator : public AtomicMathematicianLocator
+ {
+ using AtomicMathematicianLocator::visit;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DateTimeType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DateType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DecimalType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DoubleType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const FloatType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const IntegerType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ virtual AtomicTypeVisitorResult::Ptr visit(const YearMonthDurationType *, const qint16 op,
+ const SourceLocationReflection *const r) const;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/type/qatomictype.cpp b/src/xmlpatterns/type/qatomictype.cpp
new file mode 100644
index 0000000..398495e
--- /dev/null
+++ b/src/xmlpatterns/type/qatomictype.cpp
@@ -0,0 +1,118 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qitem_p.h"
+#include "qbuiltintypes_p.h"
+#include "qitem_p.h"
+#include "qschematypefactory_p.h"
+#include "qxmlname.h"
+
+#include "qatomictype_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+AtomicType::AtomicType()
+{
+}
+
+AtomicType::~AtomicType()
+{
+}
+
+bool AtomicType::xdtTypeMatches(const ItemType::Ptr &other) const
+{
+ if(other->isAtomicType())
+ {
+ if(*other == *this)
+ return true;
+ else
+ return xdtTypeMatches(other->xdtSuperType());
+ }
+ else
+ return false;
+}
+
+bool AtomicType::itemMatches(const Item &item) const
+{
+ Q_ASSERT(item);
+ if(item.isNode())
+ return false;
+ else
+ {
+ const SchemaType::Ptr t(static_cast<AtomicType *>(item.type().data()));
+ return wxsTypeMatches(t);
+ }
+}
+
+ItemType::Ptr AtomicType::atomizedType() const
+{
+ return AtomicType::Ptr(const_cast<AtomicType *>(this));
+}
+
+QString AtomicType::displayName(const NamePool::Ptr &) const
+{
+ /* A bit faster than calling name()->displayName() */
+ return QLatin1String("xs:anyAtomicType");
+}
+
+bool AtomicType::isNodeType() const
+{
+ return false;
+}
+
+bool AtomicType::isAtomicType() const
+{
+ return true;
+}
+
+SchemaType::TypeCategory AtomicType::category() const
+{
+ return SimpleTypeAtomic;
+}
+
+SchemaType::DerivationMethod AtomicType::derivationMethod() const
+{
+ return DerivationRestriction;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/type/qatomictype_p.h b/src/xmlpatterns/type/qatomictype_p.h
new file mode 100644
index 0000000..e1198d3
--- /dev/null
+++ b/src/xmlpatterns/type/qatomictype_p.h
@@ -0,0 +1,160 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_AtomicType_H
+#define Patternist_AtomicType_H
+
+#include "qanysimpletype_p.h"
+#include "qatomiccasterlocator_p.h"
+#include "qatomiccomparatorlocator_p.h"
+#include "qatomicmathematicianlocator_p.h"
+#include "qatomictypedispatch_p.h"
+#include "qitemtype_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ class Item;
+ class SourceLocationReflection;
+
+ /**
+ * @short Base class for all classes that implements atomic types.
+ *
+ * AtomicType does not implement @c xs:anyAtomicType, it is the C++
+ * base class for classes that implement atomic types, such as @c xs:anyAtomicType.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class AtomicType : public ItemType,
+ public AnySimpleType
+ {
+ public:
+
+ typedef QExplicitlySharedDataPointer<AtomicType> Ptr;
+
+ virtual ~AtomicType();
+
+ /**
+ * Implements a generic algorithm which relies on wxsTypeMatches().
+ *
+ * @returns @c true depending on if @p item is an atomic type, and that
+ * AtomicValue::itemType()'s SequenceType::itemType() matches this type.
+ */
+ virtual bool itemMatches(const Item &item) const;
+
+ /**
+ * @returns the result of SharedQXmlName::displayName(), of the SharedQName
+ * object returned from the name() function.
+ */
+ virtual QString displayName(const NamePool::Ptr &np) const;
+
+ /**
+ * returns always @c false
+ */
+ virtual bool isNodeType() const;
+
+ /**
+ * returns always @c true
+ */
+ virtual bool isAtomicType() const;
+
+ /**
+ * Determines whether @p other is equal to this type, or is a
+ * sub-type of this type.
+ *
+ * The implementation is generic, relying on operator==()
+ * and xdtSuperType().
+ */
+ virtual bool xdtTypeMatches(const ItemType::Ptr &other) const;
+
+ /**
+ * @returns always 'this'
+ */
+ virtual ItemType::Ptr atomizedType() const;
+
+ /**
+ * @returns always SchemaType::SimpleTypeAtomic
+ */
+ virtual TypeCategory category() const;
+
+ /**
+ * @returns DerivationRestriction
+ */
+ virtual DerivationMethod derivationMethod() const;
+
+ virtual AtomicTypeVisitorResult::Ptr
+ accept(const QExplicitlySharedDataPointer<AtomicTypeVisitor> &visitor,
+ const SourceLocationReflection *const) const = 0;
+
+ virtual AtomicTypeVisitorResult::Ptr
+ accept(const ParameterizedAtomicTypeVisitor::Ptr &visitor,
+ const qint16 param,
+ const SourceLocationReflection *const) const = 0;
+
+ virtual AtomicComparatorLocator::Ptr comparatorLocator() const = 0;
+ virtual AtomicMathematicianLocator::Ptr mathematicianLocator() const = 0;
+ virtual AtomicCasterLocator::Ptr casterLocator() const = 0;
+
+ protected:
+ AtomicType();
+
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/type/qatomictypedispatch_p.h b/src/xmlpatterns/type/qatomictypedispatch_p.h
new file mode 100644
index 0000000..a3a4417
--- /dev/null
+++ b/src/xmlpatterns/type/qatomictypedispatch_p.h
@@ -0,0 +1,277 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_AtomicTypeDispatch_H
+#define Patternist_AtomicTypeDispatch_H
+
+#include <QSharedData>
+
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ class AnyAtomicType;
+ class AnyURIType;
+ class Base64BinaryType;
+ class BooleanType;
+ class DateTimeType;
+ class DateType;
+ class DayTimeDurationType;
+ class DecimalType;
+ class DoubleType;
+ class DurationType;
+ class FloatType;
+ class GDayType;
+ class GMonthDayType;
+ class GMonthType;
+ class GYearMonthType;
+ class GYearType;
+ class HexBinaryType;
+ class IntegerType;
+ class NOTATIONType;
+ class QNameType;
+ class SourceLocationReflection;
+ class StringType;
+ class SchemaTimeType;
+ class UntypedAtomicType;
+ class YearMonthDurationType;
+
+ enum TypeOfDerivedInteger
+ {
+ TypeByte,
+ TypeInt,
+ TypeLong,
+ TypeNegativeInteger,
+ TypeNonNegativeInteger,
+ TypeNonPositiveInteger,
+ TypePositiveInteger,
+ TypeShort,
+ TypeUnsignedByte,
+ TypeUnsignedInt,
+ TypeUnsignedLong,
+ TypeUnsignedShort
+ };
+
+ template<TypeOfDerivedInteger DerivedType> class DerivedIntegerType;
+
+ enum TypeOfDerivedString
+ {
+ TypeString,
+ TypeNormalizedString,
+ TypeToken,
+ TypeLanguage,
+ TypeNMTOKEN,
+ TypeName,
+ TypeNCName,
+ TypeID,
+ TypeIDREF,
+ TypeENTITY
+ };
+
+ template<TypeOfDerivedString DerivedType> class DerivedStringType;
+
+ /**
+ * @todo Documentation's missing:
+ * - Add link to wikipedia's "multiple dispatch" and "visitor" page.
+ * - Add link to http://www.eptacom.net/pubblicazioni/pub_eng/mdisp.html
+ *
+ * @defgroup Patternist_types_dispatch Atomic Type Dispatching
+ */
+
+ /**
+ * @todo Docs missing
+ *
+ * @ingroup Patternist_types_dispatch
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class AtomicTypeVisitorResult : public QSharedData
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<AtomicTypeVisitorResult> Ptr;
+ AtomicTypeVisitorResult() {}
+ virtual ~AtomicTypeVisitorResult() {}
+ };
+
+ /**
+ * @todo Docs missing
+ *
+ * @see ParameterizedAtomicTypeVisitor
+ * @ingroup Patternist_types_dispatch
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class AtomicTypeVisitor : public QSharedData
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<AtomicTypeVisitor> Ptr;
+ virtual ~AtomicTypeVisitor() {}
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const AnyAtomicType *,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const AnyURIType *,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const Base64BinaryType *,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const BooleanType *,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DateTimeType *,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DateType *,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DayTimeDurationType *,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DecimalType *,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DoubleType *,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DurationType *,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const FloatType *,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GDayType *,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GMonthDayType *,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GMonthType *,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GYearMonthType *,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GYearType *,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const HexBinaryType *,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const IntegerType *,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const NOTATIONType *,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const QNameType *,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const StringType *,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const SchemaTimeType *,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const YearMonthDurationType *,
+ const SourceLocationReflection *const reflection) const = 0;
+ };
+
+ /**
+ * @todo Docs missing
+ *
+ * @see AtomicTypeVisitor
+ * @ingroup Patternist_types_dispatch
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class ParameterizedAtomicTypeVisitor : public QSharedData
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<ParameterizedAtomicTypeVisitor> Ptr;
+ virtual ~ParameterizedAtomicTypeVisitor() {}
+
+ virtual AtomicTypeVisitorResult::Ptr visit(const AnyAtomicType *, const qint16 param,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const AnyURIType *, const qint16 param,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const Base64BinaryType *, const qint16 param,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const BooleanType *, const qint16 param,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DateTimeType *, const qint16 param,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DateType *, const qint16 param,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DayTimeDurationType *, const qint16 param,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DecimalType *, const qint16 param,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DoubleType *, const qint16 param,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const DurationType *, const qint16 param,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const FloatType *, const qint16 param,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GDayType *, const qint16 param,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GMonthDayType *, const qint16 param,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GMonthType *, const qint16 param,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GYearMonthType *, const qint16 param,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const GYearType *, const qint16 param,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const HexBinaryType *, const qint16 param,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const IntegerType *, const qint16 param,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const NOTATIONType *, const qint16 param,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const QNameType *, const qint16 param,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const StringType *, const qint16 param,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const SchemaTimeType *, const qint16 param,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const UntypedAtomicType *, const qint16 param,
+ const SourceLocationReflection *const reflection) const = 0;
+ virtual AtomicTypeVisitorResult::Ptr visit(const YearMonthDurationType *, const qint16 param,
+ const SourceLocationReflection *const reflection) const = 0;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/type/qbasictypesfactory.cpp b/src/xmlpatterns/type/qbasictypesfactory.cpp
new file mode 100644
index 0000000..ca4559f
--- /dev/null
+++ b/src/xmlpatterns/type/qbasictypesfactory.cpp
@@ -0,0 +1,128 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include "qbuiltintypes_p.h"
+#include "qcommonnamespaces_p.h"
+
+#include "qbasictypesfactory_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+SchemaTypeFactory::Ptr BasicTypesFactory::self(const NamePool::Ptr &np)
+{
+ /* We don't store a global static here, because it's dependent on the NamePool. */
+ return SchemaTypeFactory::Ptr(new BasicTypesFactory(np));
+}
+
+BasicTypesFactory::BasicTypesFactory(const NamePool::Ptr &np)
+{
+ m_types.reserve(48);
+
+#define add(aName) m_types.insert(BuiltinTypes::aName->name(np), AtomicType::Ptr(BuiltinTypes::aName))
+#define addNA(aName) m_types.insert(BuiltinTypes::aName->name(np), BuiltinTypes::aName)
+ add(xsString);
+ add(xsBoolean);
+ add(xsDecimal);
+ add(xsDouble);
+ add(xsFloat);
+ add(xsDate);
+ add(xsTime);
+ add(xsDateTime);
+ add(xsDuration);
+ add(xsAnyURI);
+ add(xsGDay);
+ add(xsGMonthDay);
+ add(xsGMonth);
+ add(xsGYearMonth);
+ add(xsGYear);
+ add(xsBase64Binary);
+ add(xsHexBinary);
+ add(xsQName);
+ add(xsInteger);
+ addNA(xsAnyType);
+ addNA(xsAnySimpleType);
+ add(xsYearMonthDuration);
+ add(xsDayTimeDuration);
+ add(xsAnyAtomicType);
+ addNA(xsUntyped);
+ add(xsUntypedAtomic);
+ add(xsNOTATION);
+ /* Add derived primitives. */
+ add(xsNonPositiveInteger);
+ add(xsNegativeInteger);
+ add(xsLong);
+ add(xsInt);
+ add(xsShort);
+ add(xsByte);
+ add(xsNonNegativeInteger);
+ add(xsUnsignedLong);
+ add(xsUnsignedInt);
+ add(xsUnsignedShort);
+ add(xsUnsignedByte);
+ add(xsPositiveInteger);
+ add(xsNormalizedString);
+ add(xsToken);
+ add(xsLanguage);
+ add(xsNMTOKEN);
+ add(xsName);
+ add(xsNCName);
+ add(xsID);
+ add(xsIDREF);
+ add(xsENTITY);
+
+#undef add
+#undef addNA
+}
+
+SchemaType::Ptr BasicTypesFactory::createSchemaType(const QXmlName name) const
+{
+ return m_types.value(name);
+}
+
+SchemaType::Hash BasicTypesFactory::types() const
+{
+ return m_types;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/type/qbasictypesfactory_p.h b/src/xmlpatterns/type/qbasictypesfactory_p.h
new file mode 100644
index 0000000..95666b9
--- /dev/null
+++ b/src/xmlpatterns/type/qbasictypesfactory_p.h
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_BuiltinTypesFactory_H
+#define Patternist_BuiltinTypesFactory_H
+
+#include <QHash>
+#include "qschematypefactory_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+
+ /**
+ * @short Factory for creating schema types for the types defined in XSL-T 2.0.
+ *
+ * Theses types are essentially the builtin primitive types, plus @c xs:integer,
+ * and the types defined in the XPath Data Model.
+ *
+ * @ingroup Patternist_types
+ * @see <a href="http://www.w3.org/TR/xpath-datamodel/#types-predefined">XQuery 1.0 and
+ * XPath 2.0 Data Model, 2.6.2 Predefined Types</a>
+ * @see <a href="http://www.w3.org/TR/xslt20/#built-in-types">XSL Transformations (XSLT)
+ * Version 2.0, 3.13 Built-in Types</a>
+ * @see <a href="http://www.w3.org/TR/xmlschema-2/#built-in-primitive-datatypes">XML Schema
+ * Part 2: Datatypes Second Edition, 3.2 Primitive datatypes</a>
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class BasicTypesFactory : public SchemaTypeFactory
+ {
+ public:
+
+ /**
+ * Creates a primitive type for @p name. If @p name is not supported,
+ * @c null is returned.
+ * The intened supported types are the builtin primitive and derived types.
+ * That is, the 19 W3C XML Schema types, and the additional 5 in the XPath Data MOdel.
+ *
+ * @note This does not handle user defined types, only builtin types.
+ * @todo Update documentation, proportionally with progress.
+ */
+ virtual SchemaType::Ptr createSchemaType(const QXmlName ) const;
+
+ virtual SchemaType::Hash types() const;
+
+ /**
+ * @returns the singleton instance of BasicTypesFactory.
+ */
+ static SchemaTypeFactory::Ptr self(const NamePool::Ptr &np);
+
+ protected:
+ /**
+ * This constructor is protected. Use the static self() function
+ * to retrieve a singleton instance.
+ */
+ BasicTypesFactory(const NamePool::Ptr &np);
+
+ private:
+ /**
+ * A dictonary of builtin primitive and derived primitives.
+ */
+ SchemaType::Hash m_types;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/type/qbuiltinatomictype.cpp b/src/xmlpatterns/type/qbuiltinatomictype.cpp
new file mode 100644
index 0000000..91accc2
--- /dev/null
+++ b/src/xmlpatterns/type/qbuiltinatomictype.cpp
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qatomictype_p.h"
+#include "qitem_p.h"
+#include "qbuiltintypes_p.h"
+#include "qschematype_p.h"
+
+#include "qbuiltinatomictype_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+BuiltinAtomicType::BuiltinAtomicType(const AtomicType::Ptr &base,
+ const AtomicComparatorLocator::Ptr &comp,
+ const AtomicMathematicianLocator::Ptr &mather,
+ const AtomicCasterLocator::Ptr &casterlocator)
+ : m_superType(base),
+ m_comparatorLocator(comp),
+ m_mathematicianLocator(mather),
+ m_casterLocator(casterlocator)
+{
+}
+
+SchemaType::Ptr BuiltinAtomicType::wxsSuperType() const
+{
+ return m_superType;
+}
+
+ItemType::Ptr BuiltinAtomicType::xdtSuperType() const
+{
+ return m_superType;
+}
+
+bool BuiltinAtomicType::isAbstract() const
+{
+ return false;
+}
+
+AtomicComparatorLocator::Ptr BuiltinAtomicType::comparatorLocator() const
+{
+ return m_comparatorLocator;
+}
+
+AtomicMathematicianLocator::Ptr BuiltinAtomicType::mathematicianLocator() const
+{
+ return m_mathematicianLocator;
+}
+
+AtomicCasterLocator::Ptr BuiltinAtomicType::casterLocator() const
+{
+ return m_casterLocator;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/type/qbuiltinatomictype_p.h b/src/xmlpatterns/type/qbuiltinatomictype_p.h
new file mode 100644
index 0000000..8f164c5
--- /dev/null
+++ b/src/xmlpatterns/type/qbuiltinatomictype_p.h
@@ -0,0 +1,130 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_BuiltinAtomicType_H
+#define Patternist_BuiltinAtomicType_H
+
+#include "qatomictype_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+
+ /**
+ * @short Instances of this class represents types that are sub-classes
+ * of @c xs:anyAtomicType.
+ *
+ * Retrieving instances of builtin types is done
+ * via BuiltinTypesFactory::createSchemaType(), not by instantiating this
+ * class manually.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class BuiltinAtomicType : public AtomicType
+ {
+ public:
+
+ typedef QExplicitlySharedDataPointer<BuiltinAtomicType> Ptr;
+
+ /**
+ * @returns always @c false
+ */
+ virtual bool isAbstract() const;
+
+ /**
+ * @returns the base type as specified in the constructors baseType argument.
+ */
+ virtual SchemaType::Ptr wxsSuperType() const;
+
+ /**
+ * @returns the same type as wxsSuperType(), except for the type @c xs:anyAtomicType, which
+ * returns item()
+ */
+ virtual ItemType::Ptr xdtSuperType() const;
+
+ virtual AtomicComparatorLocator::Ptr comparatorLocator() const;
+ virtual AtomicMathematicianLocator::Ptr mathematicianLocator() const;
+ virtual AtomicCasterLocator::Ptr casterLocator() const;
+
+ protected:
+ friend class BuiltinTypes;
+
+ /**
+ * @param baseType the type that is the super type of the constructed
+ * atomic type. In the case of AnyAtomicType, @c null is passed.
+ * @param comp the AtomicComparatorLocator this type should return. May be @c null.
+ * @param mather similar to @p comp, this is the AtomicMathematicianLocator
+ * that's appropriate for this type May be @c null.
+ * @param casterLocator the CasterLocator that locates classes performing
+ * casting with this type. May be @c null.
+ */
+ BuiltinAtomicType(const AtomicType::Ptr &baseType,
+ const AtomicComparatorLocator::Ptr &comp,
+ const AtomicMathematicianLocator::Ptr &mather,
+ const AtomicCasterLocator::Ptr &casterLocator);
+
+ private:
+ const AtomicType::Ptr m_superType;
+ const AtomicComparatorLocator::Ptr m_comparatorLocator;
+ const AtomicMathematicianLocator::Ptr m_mathematicianLocator;
+ const AtomicCasterLocator::Ptr m_casterLocator;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/type/qbuiltinatomictypes.cpp b/src/xmlpatterns/type/qbuiltinatomictypes.cpp
new file mode 100644
index 0000000..5b9db43
--- /dev/null
+++ b/src/xmlpatterns/type/qbuiltinatomictypes.cpp
@@ -0,0 +1,226 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qatomicmathematicianlocators_p.h"
+#include "qbuiltintypes_p.h"
+
+#include "qbuiltinatomictypes_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+/* -------------------------------------------------------------- */
+#define implAccept(className) \
+AtomicTypeVisitorResult::Ptr className##Type::accept(const AtomicTypeVisitor::Ptr &v, \
+ const SourceLocationReflection *const r) const \
+{ \
+ return v->visit(this, r); \
+} \
+ \
+AtomicTypeVisitorResult::Ptr \
+className##Type::accept(const ParameterizedAtomicTypeVisitor::Ptr &v, \
+ const qint16 op, \
+ const SourceLocationReflection *const r) const \
+{ \
+ return v->visit(this, op, r); \
+}
+
+#define deployComp(className, qname, parent, comp, mather, caster) \
+className##Type::className##Type() : BuiltinAtomicType(BuiltinTypes::parent, \
+ comp, \
+ mather, \
+ caster) \
+{ \
+} \
+implAccept(className)
+
+#define deployBase(className, qname, parent) deployComp(className, qname, parent, \
+ AtomicComparatorLocator::Ptr(), \
+ AtomicMathematicianLocator::Ptr(), \
+ AtomicCasterLocator::Ptr())
+
+#define deployFull(className, qname, parent) \
+deployComp(className, qname, parent, \
+ AtomicComparatorLocator::Ptr(new className##ComparatorLocator()), \
+ AtomicMathematicianLocator::Ptr(), \
+ AtomicCasterLocator::Ptr(new To##className##CasterLocator()))
+
+#define deployMathComp(className, qname, parent) \
+deployComp(className, qname, parent, \
+ AtomicComparatorLocator::Ptr(new className##ComparatorLocator()), \
+ AtomicMathematicianLocator::Ptr(new className##MathematicianLocator()), \
+ AtomicCasterLocator::Ptr(new To##className##CasterLocator()))
+/* -------------------------------------------------------------- */
+
+/* -------------------------------------------------------------- */
+/* xs:anyURI & xs:untypedAtomic are much treated like strings. This ensures
+ * they get the correct operators and automatically takes care of type promotion. */
+deployComp(UntypedAtomic, xsUntypedAtomic, xsAnyAtomicType,
+ AtomicComparatorLocator::Ptr(new StringComparatorLocator()),
+ AtomicMathematicianLocator::Ptr(),
+ AtomicCasterLocator::Ptr(new ToUntypedAtomicCasterLocator()))
+deployComp(AnyURI, xsAnyURI, xsAnyAtomicType,
+ AtomicComparatorLocator::Ptr(new StringComparatorLocator()),
+ AtomicMathematicianLocator::Ptr(),
+ AtomicCasterLocator::Ptr(new ToAnyURICasterLocator()))
+
+deployBase(NOTATION, xsNOTATION, xsAnyAtomicType)
+
+deployMathComp(Float, xsFloat, numeric)
+deployMathComp(Double, xsDouble, numeric)
+deployMathComp(Decimal, xsDecimal, numeric)
+deployMathComp(DayTimeDuration, xsDayTimeDuration, xsDuration)
+deployMathComp(YearMonthDuration, xsYearMonthDuration, xsDuration)
+deployMathComp(Date, xsDate, xsAnyAtomicType)
+deployMathComp(DateTime, xsDateTime, xsAnyAtomicType)
+deployMathComp(SchemaTime, xsTime, xsAnyAtomicType)
+
+deployFull(Base64Binary, xsBase64Binary, xsAnyAtomicType)
+deployFull(Boolean, xsBoolean, xsAnyAtomicType)
+deployFull(Duration, xsDuration, xsAnyAtomicType)
+deployFull(GDay, xsGDay, xsAnyAtomicType)
+deployFull(GMonth, xsGMonth, xsAnyAtomicType)
+deployFull(GMonthDay, xsGMonthDay, xsAnyAtomicType)
+deployFull(GYear, xsGYear, xsAnyAtomicType)
+deployFull(GYearMonth, xsGYearMonth, xsAnyAtomicType)
+deployFull(HexBinary, xsHexBinary, xsAnyAtomicType)
+deployFull(QName, xsQName, xsAnyAtomicType)
+/* --------------------------------------------------------------- */
+
+/* --------------------------------------------------------------- */
+StringType::StringType(const AtomicType::Ptr &pType,
+ const AtomicCasterLocator::Ptr &casterLoc)
+: BuiltinAtomicType(pType,
+ AtomicComparatorLocator::Ptr(new StringComparatorLocator()),
+ AtomicMathematicianLocator::Ptr(),
+ casterLoc)
+{
+}
+implAccept(String)
+/* --------------------------------------------------------------- */
+
+/* --------------------------------------------------------------- */
+IntegerType::IntegerType(const AtomicType::Ptr &pType,
+ const AtomicCasterLocator::Ptr &casterLoc)
+: BuiltinAtomicType(pType,
+ AtomicComparatorLocator::Ptr(new IntegerComparatorLocator()),
+ AtomicMathematicianLocator::Ptr(new IntegerMathematicianLocator()),
+ casterLoc)
+{
+}
+implAccept(Integer)
+/* --------------------------------------------------------------- */
+
+/* ---------------------- Special Overrides ---------------------- */
+AnyAtomicType::AnyAtomicType() : BuiltinAtomicType(AtomicType::Ptr(),
+ AtomicComparatorLocator::Ptr(),
+ AtomicMathematicianLocator::Ptr(),
+ AtomicCasterLocator::Ptr())
+{
+}
+implAccept(AnyAtomic)
+
+ItemType::Ptr AnyAtomicType::xdtSuperType() const
+{
+ return BuiltinTypes::item;
+}
+
+SchemaType::Ptr AnyAtomicType::wxsSuperType() const
+{
+ return BuiltinTypes::xsAnySimpleType;
+}
+
+bool AnyAtomicType::isAbstract() const
+{
+ return true;
+}
+
+bool NOTATIONType::isAbstract() const
+{
+ return true;
+}
+
+#define implementName(className, typeName) \
+QXmlName className##Type::name(const NamePool::Ptr &np) const \
+{ \
+ return np->allocateQName(StandardNamespaces::xs, typeName); \
+} \
+ \
+QString className##Type::displayName(const NamePool::Ptr &np) const \
+{ \
+ return np->displayName(name(np)); \
+}
+
+implementName(AnyAtomic, QLatin1String("anyAtomicType"))
+implementName(AnyURI, QLatin1String("anyURI"))
+implementName(Base64Binary, QLatin1String("base64Binary"))
+implementName(Boolean, QLatin1String("boolean"))
+implementName(Date, QLatin1String("date"))
+implementName(DateTime, QLatin1String("dateTime"))
+implementName(DayTimeDuration, QLatin1String("dayTimeDuration"))
+implementName(Decimal, QLatin1String("decimal"))
+implementName(Double, QLatin1String("double"))
+implementName(Duration, QLatin1String("duration"))
+implementName(Float, QLatin1String("float"))
+implementName(GDay, QLatin1String("gDay"))
+implementName(GMonthDay, QLatin1String("gMonthDay"))
+implementName(GMonth, QLatin1String("gMonth"))
+implementName(GYearMonth, QLatin1String("gYearMonth"))
+implementName(GYear, QLatin1String("gYear"))
+implementName(HexBinary, QLatin1String("hexBinary"))
+implementName(Integer, QLatin1String("integer"))
+implementName(NOTATION, QLatin1String("NOTATION"))
+implementName(QName, QLatin1String("QName"))
+implementName(String, QLatin1String("string"))
+implementName(SchemaTime, QLatin1String("time"))
+implementName(UntypedAtomic, QLatin1String("untypedAtomic"))
+implementName(YearMonthDuration, QLatin1String("yearMonthDuration"))
+/* --------------------------------------------------------------- */
+
+#undef implAccept
+#undef implementName
+#undef deployComp
+#undef deployBase
+#undef deployFull
+#undef deployMathComp
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/type/qbuiltinatomictypes_p.h b/src/xmlpatterns/type/qbuiltinatomictypes_p.h
new file mode 100644
index 0000000..577dd80
--- /dev/null
+++ b/src/xmlpatterns/type/qbuiltinatomictypes_p.h
@@ -0,0 +1,789 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_BuiltinAtomicTypes_H
+#define Patternist_BuiltinAtomicTypes_H
+
+#include "qatomiccasterlocators_p.h"
+#include "qatomiccomparatorlocators_p.h"
+#include "qbuiltinatomictype_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+
+ /**
+ * @short Implements the type @c xs:anyAtomicType.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class AnyAtomicType : public BuiltinAtomicType
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<AnyAtomicType> Ptr;
+
+ virtual AtomicTypeVisitorResult::Ptr accept(const AtomicTypeVisitor::Ptr &visitor,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr accept(const ParameterizedAtomicTypeVisitor::Ptr &visitor,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual QXmlName name(const NamePool::Ptr &np) const;
+ virtual QString displayName(const NamePool::Ptr &np) const;
+
+ /**
+ * Overridden to return <tt>item()</tt>.
+ *
+ * @returns BuiltinTypes::item
+ */
+ virtual ItemType::Ptr xdtSuperType() const;
+
+ /**
+ * Overridden to return @c xs:anySimpleType.
+ *
+ * @returns BuiltinTypes::xsAnySimpleType
+ */
+ virtual SchemaType::Ptr wxsSuperType() const;
+
+ /**
+ * Overridden to return @c true, @c xs:anyAtomicType is abstract.
+ *
+ * @returns always @c true
+ */
+ virtual bool isAbstract() const;
+
+ protected:
+ friend class BuiltinTypes;
+ AnyAtomicType();
+ };
+
+ /**
+ * @short Implements the type @c xs:untypedAtomic.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class UntypedAtomicType : public BuiltinAtomicType
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<UntypedAtomicType> Ptr;
+
+ virtual AtomicTypeVisitorResult::Ptr accept(const AtomicTypeVisitor::Ptr &visitor,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr accept(const ParameterizedAtomicTypeVisitor::Ptr &visitor,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual QXmlName name(const NamePool::Ptr &np) const;
+ virtual QString displayName(const NamePool::Ptr &np) const;
+
+ protected:
+ friend class BuiltinTypes;
+ UntypedAtomicType();
+ };
+
+ /**
+ * @short Implements the type @c xs:dateTime.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class DateTimeType : public BuiltinAtomicType
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<DateTimeType> Ptr;
+
+ virtual AtomicTypeVisitorResult::Ptr accept(const AtomicTypeVisitor::Ptr &visitor,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr accept(const ParameterizedAtomicTypeVisitor::Ptr &visitor,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+
+ virtual QXmlName name(const NamePool::Ptr &np) const;
+ virtual QString displayName(const NamePool::Ptr &np) const;
+ protected:
+ friend class BuiltinTypes;
+ DateTimeType();
+ };
+
+ /**
+ * @short Implements the type @c xs:date.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class DateType : public BuiltinAtomicType
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<DateType> Ptr;
+
+ virtual AtomicTypeVisitorResult::Ptr accept(const AtomicTypeVisitor::Ptr &visitor,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr accept(const ParameterizedAtomicTypeVisitor::Ptr &visitor,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual QXmlName name(const NamePool::Ptr &np) const;
+ virtual QString displayName(const NamePool::Ptr &np) const;
+
+ protected:
+ friend class BuiltinTypes;
+ DateType();
+ };
+
+ /**
+ * @short Implements the type @c xs:time.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class SchemaTimeType : public BuiltinAtomicType
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<SchemaTimeType> Ptr;
+
+ virtual AtomicTypeVisitorResult::Ptr accept(const AtomicTypeVisitor::Ptr &visitor,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr accept(const ParameterizedAtomicTypeVisitor::Ptr &visitor,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+
+ virtual QXmlName name(const NamePool::Ptr &np) const;
+ virtual QString displayName(const NamePool::Ptr &np) const;
+
+ protected:
+ friend class BuiltinTypes;
+ SchemaTimeType();
+ };
+
+ /**
+ * @short Implements the type @c xs:duration.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class DurationType : public BuiltinAtomicType
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<DurationType> Ptr;
+
+ virtual AtomicTypeVisitorResult::Ptr accept(const AtomicTypeVisitor::Ptr &visitor,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr accept(const ParameterizedAtomicTypeVisitor::Ptr &visitor,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual QXmlName name(const NamePool::Ptr &np) const;
+ virtual QString displayName(const NamePool::Ptr &np) const;
+
+ protected:
+ friend class BuiltinTypes;
+ DurationType();
+ };
+
+ /**
+ * @short Implements the type @c xs:yearMonthDuration.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class YearMonthDurationType : public BuiltinAtomicType
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<YearMonthDurationType> Ptr;
+
+ virtual AtomicTypeVisitorResult::Ptr accept(const AtomicTypeVisitor::Ptr &visitor,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr accept(const ParameterizedAtomicTypeVisitor::Ptr &visitor,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual QXmlName name(const NamePool::Ptr &np) const;
+ virtual QString displayName(const NamePool::Ptr &np) const;
+
+ protected:
+ friend class BuiltinTypes;
+ YearMonthDurationType();
+ };
+
+ /**
+ * @short Implements the type @c xs:dayTimeDuration.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class DayTimeDurationType : public BuiltinAtomicType
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<DayTimeDurationType> Ptr;
+
+ virtual AtomicTypeVisitorResult::Ptr accept(const AtomicTypeVisitor::Ptr &visitor,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr accept(const ParameterizedAtomicTypeVisitor::Ptr &visitor,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual QXmlName name(const NamePool::Ptr &np) const;
+ virtual QString displayName(const NamePool::Ptr &np) const;
+
+ protected:
+ friend class BuiltinTypes;
+ DayTimeDurationType();
+ };
+
+ /**
+ * @short Implements the type @c xs:double.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class DoubleType : public BuiltinAtomicType
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<DoubleType> Ptr;
+
+ virtual AtomicTypeVisitorResult::Ptr accept(const AtomicTypeVisitor::Ptr &visitor,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr accept(const ParameterizedAtomicTypeVisitor::Ptr &visitor,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual QXmlName name(const NamePool::Ptr &np) const;
+ virtual QString displayName(const NamePool::Ptr &np) const;
+
+ protected:
+ friend class BuiltinTypes;
+ DoubleType();
+ };
+
+ /**
+ * @short Implements the type @c xs:float.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class FloatType : public BuiltinAtomicType
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<FloatType> Ptr;
+
+ virtual AtomicTypeVisitorResult::Ptr accept(const AtomicTypeVisitor::Ptr &visitor,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr accept(const ParameterizedAtomicTypeVisitor::Ptr &visitor,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual QXmlName name(const NamePool::Ptr &np) const;
+ virtual QString displayName(const NamePool::Ptr &np) const;
+
+ protected:
+ FloatType();
+ friend class BuiltinTypes;
+ };
+
+ /**
+ * @short Implements the type @c xs:decimal.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class DecimalType : public BuiltinAtomicType
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<DecimalType> Ptr;
+
+ virtual AtomicTypeVisitorResult::Ptr accept(const AtomicTypeVisitor::Ptr &visitor,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr accept(const ParameterizedAtomicTypeVisitor::Ptr &visitor,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual QXmlName name(const NamePool::Ptr &np) const;
+ virtual QString displayName(const NamePool::Ptr &np) const;
+
+ protected:
+ friend class BuiltinTypes;
+ DecimalType();
+ };
+
+ /**
+ * @short Implements the type @c xs:integer.
+ *
+ * IntegerType instances are used for representing all different xs:integer
+ * types. The purpose of this is that xs:integer sub-types must use the
+ * class, IntegerType, in order to use the correct behavior in call
+ * dispatch situations. That is, all xs:integer sub-types must use the
+ * same AtomicComparator as xs:integer itself uses, and that is achieved
+ * this way.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class IntegerType : public BuiltinAtomicType
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<IntegerType> Ptr;
+
+ virtual AtomicTypeVisitorResult::Ptr accept(const AtomicTypeVisitor::Ptr &visitor,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr accept(const ParameterizedAtomicTypeVisitor::Ptr &visitor,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual QXmlName name(const NamePool::Ptr &np) const;
+ virtual QString displayName(const NamePool::Ptr &np) const;
+
+ protected:
+ friend class BuiltinTypes;
+ IntegerType(const AtomicType::Ptr &parentType,
+ const AtomicCasterLocator::Ptr &casterLocator);
+ };
+
+ template<TypeOfDerivedInteger derivedType>
+ class DerivedIntegerType : public IntegerType
+ {
+ public:
+ using IntegerType::accept;
+
+ virtual AtomicTypeVisitorResult::Ptr accept(const AtomicTypeVisitor::Ptr &v,
+ const SourceLocationReflection *const r) const
+ {
+ return v->visit(this, r);
+ }
+
+ virtual QXmlName name(const NamePool::Ptr &np) const
+ {
+ switch(derivedType)
+ {
+ case TypeByte: return np->allocateQName(StandardNamespaces::xs, QLatin1String("byte"));
+ case TypeInt: return np->allocateQName(StandardNamespaces::xs, QLatin1String("int"));
+ case TypeLong: return np->allocateQName(StandardNamespaces::xs, QLatin1String("long"));
+ case TypeNegativeInteger: return np->allocateQName(StandardNamespaces::xs, QLatin1String("negativeInteger"));
+ case TypeNonNegativeInteger: return np->allocateQName(StandardNamespaces::xs, QLatin1String("nonNegativeInteger"));
+ case TypeNonPositiveInteger: return np->allocateQName(StandardNamespaces::xs, QLatin1String("nonPositiveInteger"));
+ case TypePositiveInteger: return np->allocateQName(StandardNamespaces::xs, QLatin1String("positiveInteger"));
+ case TypeShort: return np->allocateQName(StandardNamespaces::xs, QLatin1String("short"));
+ case TypeUnsignedByte: return np->allocateQName(StandardNamespaces::xs, QLatin1String("unsignedByte"));
+ case TypeUnsignedInt: return np->allocateQName(StandardNamespaces::xs, QLatin1String("unsignedInt"));
+ case TypeUnsignedLong: return np->allocateQName(StandardNamespaces::xs, QLatin1String("unsignedLong"));
+ case TypeUnsignedShort: return np->allocateQName(StandardNamespaces::xs, QLatin1String("unsignedShort"));
+ }
+
+ Q_ASSERT_X(false, "DerivedIntegerType::name()", "Invalid value in instantiation.");
+ return QXmlName();
+ }
+
+ virtual QString displayName(const NamePool::Ptr &np) const
+ {
+ return np->displayName(name(np));
+ }
+
+ protected:
+ friend class BuiltinTypes;
+
+ DerivedIntegerType(const AtomicType::Ptr &parentType,
+ const AtomicCasterLocator::Ptr &casterLoc) : IntegerType(parentType, casterLoc)
+ {
+ }
+
+ };
+
+ /**
+ * @short Implements the type @c xs:gYearMonth.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class GYearMonthType : public BuiltinAtomicType
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<GYearMonthType> Ptr;
+
+ virtual AtomicTypeVisitorResult::Ptr accept(const AtomicTypeVisitor::Ptr &visitor,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr accept(const ParameterizedAtomicTypeVisitor::Ptr &visitor,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual QXmlName name(const NamePool::Ptr &np) const;
+ virtual QString displayName(const NamePool::Ptr &np) const;
+
+ protected:
+ friend class BuiltinTypes;
+ GYearMonthType();
+ };
+
+ /**
+ * @short Implements the type @c xs:gYear.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class GYearType : public BuiltinAtomicType
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<GYearType> Ptr;
+
+ virtual AtomicTypeVisitorResult::Ptr accept(const AtomicTypeVisitor::Ptr &visitor,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr accept(const ParameterizedAtomicTypeVisitor::Ptr &visitor,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual QXmlName name(const NamePool::Ptr &np) const;
+ virtual QString displayName(const NamePool::Ptr &np) const;
+
+ protected:
+ friend class BuiltinTypes;
+ GYearType();
+ };
+
+ /**
+ * @short Implements the type @c xs:gMonthDay.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class GMonthDayType : public BuiltinAtomicType
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<GMonthDayType> Ptr;
+
+ virtual AtomicTypeVisitorResult::Ptr accept(const AtomicTypeVisitor::Ptr &visitor,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr accept(const ParameterizedAtomicTypeVisitor::Ptr &visitor,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual QXmlName name(const NamePool::Ptr &np) const;
+ virtual QString displayName(const NamePool::Ptr &np) const;
+
+ protected:
+ friend class BuiltinTypes;
+ GMonthDayType();
+ };
+
+ /**
+ * @short Implements the type @c xs:gDay.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class GDayType : public BuiltinAtomicType
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<GDayType> Ptr;
+
+ virtual AtomicTypeVisitorResult::Ptr accept(const AtomicTypeVisitor::Ptr &visitor,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr accept(const ParameterizedAtomicTypeVisitor::Ptr &visitor,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual QXmlName name(const NamePool::Ptr &np) const;
+ virtual QString displayName(const NamePool::Ptr &np) const;
+
+ protected:
+ friend class BuiltinTypes;
+ GDayType();
+ };
+
+ /**
+ * @short Implements the type @c xs:gMonth.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class GMonthType : public BuiltinAtomicType
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<GMonthType> Ptr;
+
+ virtual AtomicTypeVisitorResult::Ptr accept(const AtomicTypeVisitor::Ptr &visitor,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr accept(const ParameterizedAtomicTypeVisitor::Ptr &visitor,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual QXmlName name(const NamePool::Ptr &np) const;
+ virtual QString displayName(const NamePool::Ptr &np) const;
+
+ protected:
+ friend class BuiltinTypes;
+ GMonthType();
+ };
+
+ /**
+ * @short Implements the type @c xs:boolean.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class BooleanType : public BuiltinAtomicType
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<BooleanType> Ptr;
+
+ virtual AtomicTypeVisitorResult::Ptr accept(const AtomicTypeVisitor::Ptr &visitor,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr accept(const ParameterizedAtomicTypeVisitor::Ptr &visitor,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual QXmlName name(const NamePool::Ptr &np) const;
+ virtual QString displayName(const NamePool::Ptr &np) const;
+
+ protected:
+ friend class BuiltinTypes;
+ BooleanType();
+ };
+
+ /**
+ * @short Implements the type @c xs:base64Binary.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class Base64BinaryType : public BuiltinAtomicType
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<Base64BinaryType> Ptr;
+
+ virtual AtomicTypeVisitorResult::Ptr accept(const AtomicTypeVisitor::Ptr &visitor,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr accept(const ParameterizedAtomicTypeVisitor::Ptr &visitor,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual QXmlName name(const NamePool::Ptr &np) const;
+ virtual QString displayName(const NamePool::Ptr &np) const;
+
+ protected:
+ friend class BuiltinTypes;
+ Base64BinaryType();
+ };
+
+ /**
+ * @short Implements the type @c xs:hexBinary.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class HexBinaryType : public BuiltinAtomicType
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<HexBinaryType> Ptr;
+
+ virtual AtomicTypeVisitorResult::Ptr accept(const AtomicTypeVisitor::Ptr &visitor,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr accept(const ParameterizedAtomicTypeVisitor::Ptr &visitor,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual QXmlName name(const NamePool::Ptr &np) const;
+ virtual QString displayName(const NamePool::Ptr &np) const;
+
+ protected:
+ friend class BuiltinTypes;
+ HexBinaryType();
+ };
+
+ /**
+ * @short Implements the type @c xs:anyURI.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class AnyURIType : public BuiltinAtomicType
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<AnyURIType> Ptr;
+
+ virtual AtomicTypeVisitorResult::Ptr accept(const AtomicTypeVisitor::Ptr &visitor,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr accept(const ParameterizedAtomicTypeVisitor::Ptr &visitor,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual QXmlName name(const NamePool::Ptr &np) const;
+ virtual QString displayName(const NamePool::Ptr &np) const;
+
+ protected:
+ friend class BuiltinTypes;
+ AnyURIType();
+ };
+
+ /**
+ * @short Implements the type @c xs:QName.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class QNameType : public BuiltinAtomicType
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<QNameType> Ptr;
+
+ virtual AtomicTypeVisitorResult::Ptr accept(const AtomicTypeVisitor::Ptr &visitor,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr accept(const ParameterizedAtomicTypeVisitor::Ptr &visitor,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual QXmlName name(const NamePool::Ptr &np) const;
+ virtual QString displayName(const NamePool::Ptr &np) const;
+
+ protected:
+ friend class BuiltinTypes;
+ QNameType();
+ };
+
+ /**
+ * Represents the xs:string type and all derived types of
+ * xs:string, such as xs:token.
+ *
+ * StringType instances are used for representing all different string
+ * types. The purpose of this is that xs:string sub-types must use the
+ * class, StringType, in order to use the correct behavior in call
+ * dispatch situations. That is, all xs:string sub-types must use the
+ * same AtomicComparator as xs:string itself uses, and that is achieved
+ * this way.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class StringType : public BuiltinAtomicType
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<StringType> Ptr;
+
+ virtual AtomicTypeVisitorResult::Ptr accept(const AtomicTypeVisitor::Ptr &visitor,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr accept(const ParameterizedAtomicTypeVisitor::Ptr &visitor,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual QXmlName name(const NamePool::Ptr &np) const;
+ virtual QString displayName(const NamePool::Ptr &np) const;
+
+ protected:
+ friend class BuiltinTypes;
+ StringType(const AtomicType::Ptr &parentType,
+ const AtomicCasterLocator::Ptr &casterLoc);
+ };
+
+ template<TypeOfDerivedString derivedType>
+ class DerivedStringType : public StringType
+ {
+ public:
+ using StringType::accept;
+
+ virtual AtomicTypeVisitorResult::Ptr accept(const AtomicTypeVisitor::Ptr &v,
+ const SourceLocationReflection *const r) const
+ {
+ return v->visit(this, r);
+ }
+
+ virtual QXmlName name(const NamePool::Ptr &np) const
+ {
+ switch(derivedType)
+ {
+ case TypeString: return np->allocateQName(StandardNamespaces::xs, QLatin1String("string"));
+ case TypeNormalizedString: return np->allocateQName(StandardNamespaces::xs, QLatin1String("normalizedString"));
+ case TypeToken: return np->allocateQName(StandardNamespaces::xs, QLatin1String("token"));
+ case TypeLanguage: return np->allocateQName(StandardNamespaces::xs, QLatin1String("language"));
+ case TypeNMTOKEN: return np->allocateQName(StandardNamespaces::xs, QLatin1String("NMTOKEN"));
+ case TypeName: return np->allocateQName(StandardNamespaces::xs, QLatin1String("Name"));
+ case TypeNCName: return np->allocateQName(StandardNamespaces::xs, QLatin1String("NCName"));
+ case TypeID: return np->allocateQName(StandardNamespaces::xs, QLatin1String("ID"));
+ case TypeIDREF: return np->allocateQName(StandardNamespaces::xs, QLatin1String("IDREF"));
+ case TypeENTITY: return np->allocateQName(StandardNamespaces::xs, QLatin1String("ENTITY"));
+ }
+
+ Q_ASSERT_X(false, "DerivedStringType::name()", "Invalid value in instantiation.");
+ return QXmlName();
+ }
+
+ virtual QString displayName(const NamePool::Ptr &np) const
+ {
+ return np->displayName(name(np));
+ }
+
+ protected:
+ friend class BuiltinTypes;
+
+ DerivedStringType(const AtomicType::Ptr &parentType,
+ const AtomicCasterLocator::Ptr &casterLoc) : StringType(parentType, casterLoc)
+ {
+ }
+
+ };
+
+ /**
+ * @short Implements the type @c xs:NOTATION.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class NOTATIONType : public BuiltinAtomicType
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<NOTATIONType> Ptr;
+
+ virtual AtomicTypeVisitorResult::Ptr accept(const AtomicTypeVisitor::Ptr &visitor,
+ const SourceLocationReflection *const reflection) const;
+ virtual AtomicTypeVisitorResult::Ptr accept(const ParameterizedAtomicTypeVisitor::Ptr &visitor,
+ const qint16 op,
+ const SourceLocationReflection *const reflection) const;
+ virtual QXmlName name(const NamePool::Ptr &np) const;
+ virtual QString displayName(const NamePool::Ptr &np) const;
+
+ /**
+ * Overridden to return @c true, xs:NOTATION is abstract.
+ *
+ * @returns always @c true
+ */
+ virtual bool isAbstract() const;
+
+ protected:
+ friend class BuiltinTypes;
+ NOTATIONType();
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/type/qbuiltinnodetype.cpp b/src/xmlpatterns/type/qbuiltinnodetype.cpp
new file mode 100644
index 0000000..1b9932b
--- /dev/null
+++ b/src/xmlpatterns/type/qbuiltinnodetype.cpp
@@ -0,0 +1,165 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/**
+ * @file
+ * @short This file is included by BuiltintNodeType.h.
+ * If you need includes in this file, put them in BuiltintNodeType.h, outside of the namespace.
+ */
+
+template <const QXmlNodeModelIndex::NodeKind kind>
+BuiltinNodeType<kind>::BuiltinNodeType()
+{
+}
+
+template <const QXmlNodeModelIndex::NodeKind kind>
+bool BuiltinNodeType<kind>::xdtTypeMatches(const ItemType::Ptr &other) const
+{
+ if(!other->isNodeType())
+ return false;
+
+ return *static_cast<const BuiltinNodeType *>(other.data()) == *this
+ ? true
+ : xdtTypeMatches(other->xdtSuperType());
+}
+
+template <const QXmlNodeModelIndex::NodeKind kind>
+bool BuiltinNodeType<kind>::itemMatches(const Item &item) const
+{
+ Q_ASSERT(item);
+
+ return item.isNode() &&
+ item.asNode().kind() == kind;
+}
+
+template <const QXmlNodeModelIndex::NodeKind kind>
+ItemType::Ptr BuiltinNodeType<kind>::atomizedType() const
+{
+ switch(kind)
+ {
+ /* Fallthrough all these. */
+ case QXmlNodeModelIndex::Attribute:
+ case QXmlNodeModelIndex::Document:
+ case QXmlNodeModelIndex::Element:
+ case QXmlNodeModelIndex::Text:
+ return BuiltinTypes::xsUntypedAtomic;
+ case QXmlNodeModelIndex::ProcessingInstruction:
+ /* Fallthrough. */
+ case QXmlNodeModelIndex::Comment:
+ return BuiltinTypes::xsString;
+ default:
+ {
+ Q_ASSERT_X(false, Q_FUNC_INFO,
+ "Encountered invalid XPath Data Model node type.");
+ return BuiltinTypes::xsUntypedAtomic;
+ }
+ }
+}
+
+template <const QXmlNodeModelIndex::NodeKind kind>
+QString BuiltinNodeType<kind>::displayName(const NamePool::Ptr &) const
+{
+ switch(kind)
+ {
+ case QXmlNodeModelIndex::Element:
+ return QLatin1String("element()");
+ case QXmlNodeModelIndex::Document:
+ return QLatin1String("document()");
+ case QXmlNodeModelIndex::Attribute:
+ return QLatin1String("attribute()");
+ case QXmlNodeModelIndex::Text:
+ return QLatin1String("text()");
+ case QXmlNodeModelIndex::ProcessingInstruction:
+ return QLatin1String("processing-instruction()");
+ case QXmlNodeModelIndex::Comment:
+ return QLatin1String("comment()");
+ default:
+ {
+ Q_ASSERT_X(false, Q_FUNC_INFO,
+ "Encountered invalid XPath Data Model node type.");
+ return QString();
+ }
+ }
+}
+
+template <const QXmlNodeModelIndex::NodeKind kind>
+ItemType::Ptr BuiltinNodeType<kind>::xdtSuperType() const
+{
+ return BuiltinTypes::node;
+}
+
+template <const QXmlNodeModelIndex::NodeKind kind>
+QXmlNodeModelIndex::NodeKind BuiltinNodeType<kind>::nodeKind() const
+{
+ return kind;
+}
+
+template <const QXmlNodeModelIndex::NodeKind kind>
+PatternPriority BuiltinNodeType<kind>::patternPriority() const
+{
+ /* See XSL Transformations (XSLT) Version 2.0, 6.4 Conflict Resolution for
+ * Template Rules */
+ switch(kind)
+ {
+ case QXmlNodeModelIndex::Text:
+ /* Fallthrough. */
+ case QXmlNodeModelIndex::ProcessingInstruction:
+ /* Fallthrough. */
+ case QXmlNodeModelIndex::Comment:
+ /* "If the pattern is any other NodeTest, optionally preceded by a
+ * PatternAxis, then the priority is 0.5."
+ * Fallthrough. */
+ case QXmlNodeModelIndex::Attribute:
+ /* Fallthrough. */
+ case QXmlNodeModelIndex::Element:
+ /* Fallthrough. */
+ case QXmlNodeModelIndex::Document:
+ /* "If the pattern has the form /, then the priority is -0.5.". */
+ return -0.5;
+ default:
+ {
+ Q_ASSERT_X(false, Q_FUNC_INFO, "Unknown node type");
+ return 0;
+ }
+ }
+
+}
+
diff --git a/src/xmlpatterns/type/qbuiltinnodetype_p.h b/src/xmlpatterns/type/qbuiltinnodetype_p.h
new file mode 100644
index 0000000..151ad36
--- /dev/null
+++ b/src/xmlpatterns/type/qbuiltinnodetype_p.h
@@ -0,0 +1,110 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_BuiltinNodeType_H
+#define Patternist_BuiltinNodeType_H
+
+#include "qitem_p.h"
+#include "qanynodetype_p.h"
+#include "qbuiltintypes_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+
+ /**
+ * @short Instances of this class represents types that are sub-classes
+ * of <tt>node()</tt>, such as <tt>processing-instruction()</tt>.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ template <const QXmlNodeModelIndex::NodeKind kind>
+ class BuiltinNodeType : public AnyNodeType
+ {
+ public:
+ virtual bool xdtTypeMatches(const ItemType::Ptr &other) const;
+ virtual bool itemMatches(const Item &item) const;
+
+ /**
+ * @returns for example "text()", depending on what the constructor was passed
+ */
+ virtual QString displayName(const NamePool::Ptr &np) const;
+
+ virtual ItemType::Ptr xdtSuperType() const;
+ virtual ItemType::Ptr atomizedType() const;
+
+ QXmlNodeModelIndex::NodeKind nodeKind() const;
+
+ PatternPriority patternPriority() const;
+
+ protected:
+ friend class BuiltinTypes;
+
+ /**
+ * This constructor does nothing, but exists in order to make it impossible to
+ * instantiate this class from anywhere but from BuiltinTypes.
+ */
+ BuiltinNodeType();
+ };
+
+#include "qbuiltinnodetype.cpp"
+
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/type/qbuiltintypes.cpp b/src/xmlpatterns/type/qbuiltintypes.cpp
new file mode 100644
index 0000000..2953fd6
--- /dev/null
+++ b/src/xmlpatterns/type/qbuiltintypes.cpp
@@ -0,0 +1,161 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qanyitemtype_p.h"
+#include "qderivedinteger_p.h"
+
+#include "qbuiltinatomictypes_p.h"
+#include "qbuiltinnodetype_p.h"
+#include "qbuiltintypes_p.h"
+#include "qxsltnodetest_p.h"
+
+/* Included here to avoid the static initialization failure. */
+#include "qatomiccasterlocators.cpp"
+#include "qatomiccomparatorlocators.cpp"
+#include "qatomicmathematicianlocators.cpp"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+// STATIC DATA
+/* Special cases. */
+#define initType(var, cls) const cls::Ptr BuiltinTypes::var(new cls())
+initType(item, AnyItemType);
+initType(node, AnyNodeType);
+#undef initType
+
+#define initSType(var, cls) const SchemaType::Ptr BuiltinTypes::var(new cls())
+initSType(xsAnyType, AnyType);
+initSType(xsAnySimpleType, AnySimpleType);
+initSType(xsUntyped, Untyped);
+#undef initSType
+
+/* The primitive atomic types. */
+#define at(className, varName) const AtomicType::Ptr BuiltinTypes::varName(new className());
+at(AnyAtomicType, xsAnyAtomicType)
+at(UntypedAtomicType, xsUntypedAtomic)
+at(DateTimeType, xsDateTime)
+at(DateType, xsDate)
+at(SchemaTimeType, xsTime)
+at(DurationType, xsDuration)
+at(YearMonthDurationType, xsYearMonthDuration)
+at(DayTimeDurationType, xsDayTimeDuration)
+
+at(NumericType, numeric)
+at(DecimalType, xsDecimal)
+at(GYearMonthType, xsGYearMonth)
+at(GYearType, xsGYear)
+at(GMonthDayType, xsGMonthDay)
+at(GDayType, xsGDay)
+at(GMonthType, xsGMonth)
+
+at(BooleanType, xsBoolean)
+at(Base64BinaryType, xsBase64Binary)
+at(AnyURIType, xsAnyURI)
+
+#define it(className, varName) const ItemType::Ptr BuiltinTypes::varName(new className());
+at(QNameType, xsQName)
+at(HexBinaryType, xsHexBinary)
+at(FloatType, xsFloat)
+at(DoubleType, xsDouble)
+#undef it
+
+const AtomicType::Ptr BuiltinTypes::xsString(new StringType(BuiltinTypes::xsAnyAtomicType,
+ AtomicCasterLocator::Ptr(new ToStringCasterLocator())));
+
+#define dsType(varName, parent) \
+ const AtomicType::Ptr BuiltinTypes::xs ## varName \
+ (new DerivedStringType<Type ## varName>(BuiltinTypes::parent, \
+ AtomicCasterLocator::Ptr(new ToDerivedStringCasterLocator<Type ## varName>())))
+
+dsType(NormalizedString, xsString);
+dsType(Token, xsNormalizedString);
+dsType(Language, xsToken);
+dsType(NMTOKEN, xsToken);
+dsType(Name, xsToken);
+dsType(NCName, xsName);
+dsType(ID, xsNCName);
+dsType(IDREF, xsNCName);
+dsType(ENTITY, xsNCName);
+#undef sType
+
+const AtomicType::Ptr BuiltinTypes::xsInteger(new IntegerType(BuiltinTypes::xsDecimal,
+ AtomicCasterLocator::Ptr(new ToIntegerCasterLocator())));
+
+#define iType(varName, parent) \
+ const AtomicType::Ptr BuiltinTypes::xs ## varName \
+ (new DerivedIntegerType<Type ## varName>(parent, \
+ AtomicCasterLocator::Ptr(new ToDerivedIntegerCasterLocator<Type ## varName>())))
+
+/* Initialize derived integers. The order of initialization is significant. */
+iType(NonPositiveInteger, xsInteger);
+iType(NegativeInteger, xsNonPositiveInteger);
+iType(Long, xsInteger);
+iType(Int, xsLong);
+iType(Short, xsInt);
+iType(Byte, xsShort);
+iType(NonNegativeInteger, xsInteger);
+iType(UnsignedLong, xsNonNegativeInteger);
+iType(UnsignedInt, xsUnsignedLong);
+iType(UnsignedShort, xsUnsignedInt);
+iType(UnsignedByte, xsUnsignedShort);
+iType(PositiveInteger, xsNonNegativeInteger);
+#undef iType
+
+at(NOTATIONType, xsNOTATION)
+#undef at
+
+/* QXmlNodeModelIndex types */
+#define nt(var, enu) const ItemType::Ptr BuiltinTypes::var = \
+ ItemType::Ptr(new BuiltinNodeType<QXmlNodeModelIndex::enu>())
+
+nt(comment, Comment);
+nt(attribute, Attribute);
+nt(document, Document);
+nt(element, Element);
+nt(text, Text);
+nt(pi, ProcessingInstruction);
+#undef nt
+
+const ItemType::Ptr BuiltinTypes::xsltNodeTest(new XSLTNodeTest());
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/type/qbuiltintypes_p.h b/src/xmlpatterns/type/qbuiltintypes_p.h
new file mode 100644
index 0000000..0bfe2c8
--- /dev/null
+++ b/src/xmlpatterns/type/qbuiltintypes_p.h
@@ -0,0 +1,174 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_BuiltinTypes_H
+#define Patternist_BuiltinTypes_H
+
+#include "qanynodetype_p.h"
+#include "qanysimpletype_p.h"
+#include "qanytype_p.h"
+#include "qbuiltinatomictype_p.h"
+#include "qitemtype_p.h"
+#include "qnumerictype_p.h"
+#include "quntyped_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+
+ /**
+ * @short Provides access to singleton instances of ItemType and SchemaType sub-classes.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class Q_AUTOTEST_EXPORT BuiltinTypes
+ {
+ public:
+ static const SchemaType::Ptr xsAnyType;
+ static const SchemaType::Ptr xsAnySimpleType;
+ static const SchemaType::Ptr xsUntyped;
+
+ static const AtomicType::Ptr xsAnyAtomicType;
+ static const AtomicType::Ptr xsUntypedAtomic;
+ static const AtomicType::Ptr xsDateTime;
+ static const AtomicType::Ptr xsDate;
+ static const AtomicType::Ptr xsTime;
+ static const AtomicType::Ptr xsDuration;
+ static const AtomicType::Ptr xsYearMonthDuration;
+ static const AtomicType::Ptr xsDayTimeDuration;
+
+ /**
+ * An artificial type for implementation purposes
+ * that represents the XPath type @c numeric.
+ */
+ static const AtomicType::Ptr numeric;
+ static const AtomicType::Ptr xsFloat;
+ static const AtomicType::Ptr xsDouble;
+ static const AtomicType::Ptr xsInteger;
+ static const AtomicType::Ptr xsDecimal;
+ static const AtomicType::Ptr xsNonPositiveInteger;
+ static const AtomicType::Ptr xsNegativeInteger;
+ static const AtomicType::Ptr xsLong;
+ static const AtomicType::Ptr xsInt;
+ static const AtomicType::Ptr xsShort;
+ static const AtomicType::Ptr xsByte;
+ static const AtomicType::Ptr xsNonNegativeInteger;
+ static const AtomicType::Ptr xsUnsignedLong;
+ static const AtomicType::Ptr xsUnsignedInt;
+ static const AtomicType::Ptr xsUnsignedShort;
+ static const AtomicType::Ptr xsUnsignedByte;
+ static const AtomicType::Ptr xsPositiveInteger;
+
+
+ static const AtomicType::Ptr xsGYearMonth;
+ static const AtomicType::Ptr xsGYear;
+ static const AtomicType::Ptr xsGMonthDay;
+ static const AtomicType::Ptr xsGDay;
+ static const AtomicType::Ptr xsGMonth;
+
+ static const AtomicType::Ptr xsBoolean;
+
+ static const AtomicType::Ptr xsBase64Binary;
+ static const AtomicType::Ptr xsHexBinary;
+ static const AtomicType::Ptr xsAnyURI;
+ static const AtomicType::Ptr xsQName;
+ static const AtomicType::Ptr xsString;
+ static const AtomicType::Ptr xsNormalizedString;
+ static const AtomicType::Ptr xsToken;
+ static const AtomicType::Ptr xsLanguage;
+ static const AtomicType::Ptr xsNMTOKEN;
+ static const AtomicType::Ptr xsName;
+ static const AtomicType::Ptr xsNCName;
+ static const AtomicType::Ptr xsID;
+ static const AtomicType::Ptr xsIDREF;
+ static const AtomicType::Ptr xsENTITY;
+
+ static const AtomicType::Ptr xsNOTATION;
+ static const ItemType::Ptr item;
+
+ static const AnyNodeType::Ptr node;
+
+ /**
+ * When the node test node() is used without axes in a pattern in
+ * XSL-T, it doesn't match document nodes. See 5.5.3 The Meaning of a
+ * Pattern.
+ *
+ * This node test does that.
+ */
+ static const ItemType::Ptr xsltNodeTest;
+
+ static const ItemType::Ptr attribute;
+ static const ItemType::Ptr comment;
+ static const ItemType::Ptr document;
+ static const ItemType::Ptr element;
+ static const ItemType::Ptr pi;
+ static const ItemType::Ptr text;
+
+ private:
+ /**
+ * The constructor is protected because this class is not meant to be instantiated,
+ * but should only be used via its static const members.
+ */
+ BuiltinTypes();
+ Q_DISABLE_COPY(BuiltinTypes)
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
+
diff --git a/src/xmlpatterns/type/qcardinality.cpp b/src/xmlpatterns/type/qcardinality.cpp
new file mode 100644
index 0000000..7940a1a
--- /dev/null
+++ b/src/xmlpatterns/type/qcardinality.cpp
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qpatternistlocale_p.h"
+
+#include "qcardinality_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+QString Cardinality::displayName(const CustomizeDisplayName explain) const
+{
+ if(explain == IncludeExplanation)
+ {
+ if(isEmpty())
+ return QString(QtXmlPatterns::tr("empty") + QLatin1String("(\"empty-sequence()\")"));
+ else if(isZeroOrOne())
+ return QString(QtXmlPatterns::tr("zero or one") + QLatin1String("(\"?\")"));
+ else if(isExactlyOne())
+ return QString(QtXmlPatterns::tr("exactly one"));
+ else if(isOneOrMore())
+ return QString(QtXmlPatterns::tr("one or more") + QLatin1String("(\"+\")"));
+ else
+ return QString(QtXmlPatterns::tr("zero or more") + QLatin1String("(\"*\")"));
+ }
+ else
+ {
+ Q_ASSERT(explain == ExcludeExplanation);
+
+ if(isEmpty() || isZeroOrOne())
+ return QLatin1String("?");
+ else if(isExactlyOne())
+ return QString();
+ else if(isExact())
+ {
+ return QString(QLatin1Char('{')) +
+ QString::number(maximum()) +
+ QLatin1Char('}');
+ }
+ else
+ {
+ if(m_max == -1)
+ {
+ if(isOneOrMore())
+ return QChar::fromLatin1('+');
+ else
+ return QChar::fromLatin1('*');
+ }
+ else
+ {
+ /* We have a range. We use a RegExp-like syntax. */
+ return QString(QLatin1Char('{')) +
+ QString::number(minimum()) +
+ QLatin1String(", ") +
+ QString::number(maximum()) +
+ QLatin1Char('}');
+
+ }
+ }
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/type/qcardinality_p.h b/src/xmlpatterns/type/qcardinality_p.h
new file mode 100644
index 0000000..e7ba587
--- /dev/null
+++ b/src/xmlpatterns/type/qcardinality_p.h
@@ -0,0 +1,544 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_Cardinality_H
+#define Patternist_Cardinality_H
+
+#include <QtCore/QtGlobal>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+class QString;
+
+namespace QPatternist
+{
+ /**
+ * @short Represents a cardinality, a possible , often represented by occurrence indicators.
+ *
+ * As opposed to the cardinality concept in the XQuery/XPath specifications, which
+ * only allows cardinalities to be expressed with kleene operators, this representation
+ * allows ranges. For example, the cardinality 10-11, describes a sequence containing
+ * ten or eleven items, inclusive.
+ *
+ * @ingroup Patternist_types
+ * @see ItemType
+ * @see SequenceType
+ * @see <a href="http://www.w3.org/TR/xpath20/#prod-xpath-SequenceType">XML Path Language
+ * (XPath) 2.0, The EBNF grammar for SequenceType</a>
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class Cardinality
+ {
+ public:
+ /**
+ * This integer type, is what Cardinality uses for representing its ranges.
+ */
+ typedef qint32 Count;
+
+ /**
+ * Used with displayName(), and specifies
+ * how a display name for a Cardinality should be.
+ */
+ enum CustomizeDisplayName
+ {
+ /**
+ * Includes a describing string in the return value of displayName().
+ */
+ IncludeExplanation = 1,
+
+ /**
+ * Excludes a describing string in the return value of displayName().
+ */
+ ExcludeExplanation
+ };
+
+ /**
+ * A traditional copy constructor. This Cardinality becomes identical
+ * to @p other.
+ */
+ inline Cardinality(const Cardinality &other) : m_min(other.m_min),
+ m_max(other.m_max)
+ {
+ }
+
+ /**
+ * This default constructor constructs an invalid Cardinality. Using
+ * its operators and members yields undefined results. A value must
+ * first be assigned to it by creating a Cardinality with fromRange(), fromCount(),
+ * or one of the predefined cardinalities such as empty() or oneOrMore().
+ */
+ inline Cardinality() : m_min(-1), m_max(0)
+ {
+ }
+
+ /**
+ * The cardinality assigned to the exprssion <tt>()</tt>, formally speaking. The
+ * cardinality part of <tt>empty-sequence()</tt>.
+ */
+ static inline Cardinality empty()
+ {
+ return Cardinality(0, 0);
+ }
+
+ /**
+ * The cardinality implicitly specified in for example the sequence type
+ * <tt>item()</tt>. It has no kleene operator.
+ */
+ static inline Cardinality exactlyOne()
+ {
+ return Cardinality(1, 1);
+ }
+
+ /**
+ * Allows both no item, as in empty(), and exactlyOne(). Represented
+ * by the kleene operator <tt>?</tt>.
+ */
+ static inline Cardinality zeroOrOne()
+ {
+ return Cardinality(0, 1);
+ }
+
+ /**
+ * Allows any amount. This is therefore the widest, an unconstrained
+ * cardinality. Represented by the kleene operator <tt>*</tt>.
+ */
+ static inline Cardinality zeroOrMore()
+ {
+ return Cardinality(0, -1);
+ }
+
+ /**
+ * Allows one or more. Represented by the kleene operator <tt>+</tt>.
+ */
+ static inline Cardinality oneOrMore()
+ {
+ return Cardinality(1, -1);
+ }
+
+ /**
+ * Allows one or more. This cardinality has no kleene operator and is used
+ * by the implementation in order to be able to know when a cardinality
+ * that at amximum allows one, is exceeded.
+ */
+ static inline Cardinality twoOrMore()
+ {
+ return Cardinality(2, -1);
+ }
+
+ /**
+ * Determines the cardinality from the count of a sequence. For example, if
+ * @p count is 11, a Cardinality is returned that allows at minimum and maximum
+ * 11 items.
+ *
+ * @p count must be positive or zero. If it is not, the result is undefined.
+ * When debugging is enabled, a Q_ASSERT() macro ensures this.
+ */
+ static inline Cardinality fromCount(const Count count)
+ {
+ Q_ASSERT_X(count > -1, Q_FUNC_INFO,
+ "A count smaller than 0 makes no sense.");
+ return Cardinality(count, count);
+ }
+
+ /**
+ * Creates a Cardinality that allows @p minimum and @p maximum
+ * items, inclusive.
+ *
+ * If @p maximum is -1, it signals infinity.
+ *
+ * If you before hand knows that a predefined Cardinality is needed,
+ * remember to use one of the factory functions empty(), zeroOrOne(),
+ * exactlyOne(), oneOrMore() or zeroOrMore(), since they improves
+ * readability, are safer, and slightly faster.
+ */
+ static inline Cardinality fromRange(const Count minimum, const Count maximum)
+ {
+ Q_ASSERT_X(minimum > -1, Q_FUNC_INFO,
+ "minimum should never be less than 0.");
+ Q_ASSERT_X(minimum <= maximum || maximum == -1, Q_FUNC_INFO,
+ "minimum cannot be larger than maximum.");
+
+ return Cardinality(minimum, maximum);
+ }
+
+ static inline Cardinality fromExact(const Count count)
+ {
+ Q_ASSERT(count >= 0);
+ return Cardinality(count, count);
+ }
+
+ /**
+ * @returns the minimum amount of items this Cardinality allows. For example,
+ * for zeroOrOne() is 0 returned.
+ */
+ inline Count minimum() const
+ {
+ Q_ASSERT_X(m_min != -1, Q_FUNC_INFO, "The cardinality are invalid.");
+ return m_min;
+ }
+
+ /**
+ * @returns the maximum amount of items this Cardinality allows. For example,
+ * for zeroOrOne() is 1 returned.
+ */
+ inline Count maximum() const
+ {
+ Q_ASSERT_X(m_min != -1, Q_FUNC_INFO, "The cardinality are invalid.");
+ return m_max;
+ }
+
+ /**
+ * @returns @c true if this Cardinality allows one or more items. For example, for
+ * zeroOrOne() is @c false returned, while for zeroOrMore() is @c true returned.
+ */
+ inline bool allowsMany() const
+ {
+ Q_ASSERT_X(m_min != -1, Q_FUNC_INFO, "The cardinality are invalid.");
+ return m_max == -1 || m_max > 1;
+ }
+
+ /**
+ * @returns @c true if this Cardinality allows no items. For example, for
+ * zeroOrOne() is @c true returned, while for oneOrMore() is @c false returned.
+ */
+ inline bool allowsEmpty() const
+ {
+ Q_ASSERT_X(m_min != -1, Q_FUNC_INFO, "The cardinality are invalid.");
+ return m_min == 0;
+ }
+
+ /**
+ * Maps directly to Formal Semantics' @c aggregate_quantifier function.
+ *
+ * @returns zeroOrOne() if this Cardinality allows the empty sequence, otherwise exactlyOne()
+ * @see <a href="http://www.w3.org/TR/xquery-semantics/#jd_quantifier">XQuery 1.0 and
+ * XPath 2.0 Formal Semantics, The function quantifier()</a>
+ */
+ inline Cardinality toWithoutMany() const
+ {
+ return m_min == 0 ? Cardinality(0, 1)
+ : Cardinality(1, 1);
+ }
+
+ /**
+ * Determines whether all the possible outcomes represented by @p other,
+ * will always match this Cardinality. For example, if this Cardinality
+ * is oneOrMore(), @c true will be returned if @p other is exactlyOne(), but
+ * false if @p other is zeroOrOne().
+ */
+ inline bool isMatch(const Cardinality &other) const
+ {
+ Q_ASSERT_X(m_min != -1 && other.m_min != -1, Q_FUNC_INFO, "One of the cardinalities are invalid.");
+ if(other.m_min < m_min)
+ return false;
+ else
+ { /* Ok, we now know the minimum will always be ok. */
+ if(m_max == -1)
+ return true; /* We allow infinite, so anything can match. */
+ else if(other.m_max == -1)
+ return false; /* other allows infinity, while we don't. */
+ else
+ return m_max >= other.m_max;
+ }
+ }
+
+ /**
+ * Determines whether at least one of the possible outcomes represented by @p other,
+ * can match this Cardinality. For example, if this Cardinality
+ * is oneOrMore(), @c true will be returned if @p other is exactlyOne() or zeroOrOne().
+ */
+ inline bool canMatch(const Cardinality &other) const
+ {
+ Q_ASSERT_X(m_min != -1 && other.m_min != -1, Q_FUNC_INFO, "One of the cardinalities are invalid.");
+ if(m_max == -1)
+ return m_min <= other.m_min || other.m_max >= m_min || other.m_max == -1;
+ else
+ {
+ if(m_max == other.m_min)
+ return true;
+ else if(m_max > other.m_min)
+ return other.m_max >= m_min || other.m_max == -1;
+ else /* m_max < other.m_min */
+ return false;
+ }
+ }
+
+ /**
+ * @returns @c true if this Cardinality is empty, the <tt>empty-sequence()</tt>, otherwise
+ * @c false.
+ */
+ inline bool isEmpty() const
+ {
+ Q_ASSERT_X(m_min != -1, Q_FUNC_INFO, "The cardinality is invalid.");
+ return m_min == 0 && m_max == 0;
+ }
+
+ /**
+ * @returns @c true if this Cardinality is zero-or-one, <tt>?</tt>, otherwise
+ * @c false.
+ */
+ inline bool isZeroOrOne() const
+ {
+ Q_ASSERT_X(m_min != -1, Q_FUNC_INFO, "The cardinality is invalid.");
+ return m_min == 0 && m_max == 1;
+ }
+
+ /**
+ * @returns @c true if this Cardinality only allows exactly one item, otherwise
+ * @c false.
+ */
+ inline bool isExactlyOne() const
+ {
+ Q_ASSERT_X(m_min != -1, Q_FUNC_INFO, "The cardinality is invalid.");
+ return m_min == 1 && m_max == 1;
+ }
+
+ /**
+ * @returns @c true if this Cardinality only allows one or more items, otherwise
+ * @c false.
+ */
+ inline bool isOneOrMore() const
+ {
+ Q_ASSERT_X(m_min != -1, Q_FUNC_INFO, "The cardinality is invalid.");
+ return m_min > 0 && (m_max == -1 || m_max >= 1);
+ }
+
+ /**
+ * Determines whether this Cardinality only allows a specific length. For example,
+ * empty() and exactlyOne() are exact, but oneOrMore() or zeroOrOne() is not.
+ */
+ inline bool isExact() const
+ {
+ Q_ASSERT_X(m_min != -1, Q_FUNC_INFO, "The cardinality is invalid.");
+ return m_min == m_max;
+ }
+
+ /**
+ * Returns a string representation of this Cardinality.
+ *
+ * If @p explain is ExcludeExplanation the kleene operator is returned. For example, if
+ * the Cardinality is zeroOrOne, is "?" returned.
+ *
+ * If explain is IncludeExplanation a string more suited for human interpretation is returned,
+ * which is appropriately translated. For example, when the locale is English and
+ * this Cardinality being zeroOrOne, then is 'zero or one("?")' returned.
+ *
+ * Typically, passing ExcludeExplanation is useful when generating function
+ * signatures and the like, while passing IncludeExplanation
+ * is suitable appropriate when generating error messages.
+ *
+ * @returns a string representation for this Cardinality.
+ */
+ QString displayName(const CustomizeDisplayName explanation) const;
+
+ /**
+ * Computes the Cardinality that comprises this Cardinality as well as @p other. For
+ * example, if this Cardinality is zeroOrOne() and @p other is oneOrMore(), then
+ * is zeroOrMore() returned.
+ */
+ inline Cardinality operator|(const Cardinality &other) const
+ {
+ Q_ASSERT_X(m_min != -1 && other.m_min != -1, Q_FUNC_INFO, "One of the cardinalities are invalid.");
+ if(m_max == -1 || other.m_max == -1)
+ return Cardinality(qMin(m_min, other.m_min), -1);
+ else
+ return Cardinality(qMin(m_min, other.m_min), qMax(m_max, other.m_max));
+ }
+
+ /**
+ * Behaves as operator|() but assigns the result to this Cardinality.
+ */
+ inline Cardinality &operator|=(const Cardinality &other)
+ {
+ Q_ASSERT_X(m_min != -1 && other.m_min != -1, Q_FUNC_INFO, "One of the cardinalities are invalid.");
+ m_min = qMin(m_min, other.m_min);
+
+ if(m_max == -1)
+ return *this;
+ else if(other.m_max == -1)
+ m_max = -1;
+ else
+ m_max = qMax(m_max, other.m_max);
+
+ return *this;
+ }
+
+ /**
+ * Computes the intersection of this Cardinality and @p other, and returns
+ * the result. For example, the intersection between zeroOrOne() and
+ * oneOrMore() is exactlyOne().
+ *
+ * If no intersection exists, such as the case in empty() and exactlyOne(), then
+ * is a default constructed Cardinality is returned. That is, an invalid Cardinality.
+ */
+ inline Cardinality operator&(const Cardinality &other) const
+ {
+ Q_ASSERT_X(m_min != -1 && other.m_min != -1, Q_FUNC_INFO, "One of the cardinalities are invalid.");
+
+ if(m_max < other.m_min) /* No intersection. */
+ return empty();
+
+ const Count min = qMax(m_min, other.m_min);
+
+ if(m_max == -1)
+ return Cardinality(min, other.m_max);
+ else if(other.m_max == -1)
+ return Cardinality(min, m_max);
+ else
+ return Cardinality(min, qMin(m_max, other.m_max));
+ }
+
+ /**
+ * Adds two cardinalities, as if two sequences represented by them were concatenated.
+ * For example, if this Cardinality allows the range 6-8 and @p other allows
+ * 0-1, the return Cardinality has a range of 6-9.
+ *
+ * @returns the result of the comparison.
+ */
+ inline Cardinality operator+(const Cardinality &other) const
+ {
+ Q_ASSERT_X(m_min != -1 && other.m_min != -1, Q_FUNC_INFO, "One of the cardinalities are invalid.");
+ if(m_max == -1 || other.m_max == -1)
+ return Cardinality(m_min + other.m_min, -1);
+ else
+ return Cardinality(m_min + other.m_min, m_max + other.m_max);
+ }
+
+ /**
+ * Behaves as operator+() but assigns the result to this Cardinality.
+ */
+ inline Cardinality &operator+=(const Cardinality &other)
+ {
+ Q_ASSERT_X(m_min != -1 && other.m_min != -1, Q_FUNC_INFO,
+ "One of the cardinalities are invalid.");
+ m_min += other.m_min;
+
+ if(m_max == -1)
+ return *this;
+ if(other.m_max == -1)
+ m_max = -1;
+ else
+ m_max += other.m_max;
+
+ return *this;
+ }
+
+ /**
+ * Multiplies this Cardinality with @p other, and returns the result. The minimum and maximum
+ * of each Cardinality is multiplied such that the new Cardinality represents the possible
+ * range of the two sequences being multiplied, length-wise. For example the Cardinality
+ * 4, 5 multiplied with 2, 3 becomes 8, 15.
+ */
+ inline Cardinality operator*(const Cardinality &other) const
+ {
+ Q_ASSERT_X(m_min != -1 && other.m_min != -1, Q_FUNC_INFO,
+ "One of the cardinalities are invalid.");
+ if(m_max == -1 || other.m_max == -1)
+ return Cardinality(m_min * other.m_min, -1);
+ else
+ return Cardinality(m_min * other.m_min, m_max * other.m_max);
+ }
+
+ /**
+ * A traditional assignment operator. Behaves as assignment
+ * operators typically do.
+ */
+ inline Cardinality &operator=(const Cardinality &other)
+ {
+ Q_ASSERT_X(this != &other, Q_FUNC_INFO, "Assigning to oneself makes no sense.");
+ m_min = other.m_min;
+ m_max = other.m_max;
+ return *this;
+ }
+
+ /**
+ * Determines whether @p other is equal to this Cardinality.
+ *
+ * For example, empty() is equal to empty(), but zeroOrOne()
+ * is not equal to exactlyOne().
+ *
+ * @returns @c true if @p other is equal to this Cardinality.
+ */
+ inline bool operator==(const Cardinality &other) const
+ {
+ return m_min == other.m_min &&
+ m_max == other.m_max;
+ }
+
+ /**
+ * @returns the opposite of operator==()
+ */
+ inline bool operator!=(const Cardinality &other) const
+ {
+ return m_min != other.m_min ||
+ m_max != other.m_max;
+ }
+
+ private:
+ inline Cardinality(const Count min, const Count max) : m_min(min),
+ m_max(max)
+ {
+ }
+
+ Count m_min;
+ Count m_max;
+ };
+}
+
+Q_DECLARE_TYPEINFO(QPatternist::Cardinality, Q_MOVABLE_TYPE);
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/type/qcommonsequencetypes.cpp b/src/xmlpatterns/type/qcommonsequencetypes.cpp
new file mode 100644
index 0000000..7da810e
--- /dev/null
+++ b/src/xmlpatterns/type/qcommonsequencetypes.cpp
@@ -0,0 +1,132 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qebvtype_p.h"
+#include "qgenericsequencetype_p.h"
+#include "qnonetype_p.h"
+
+#include "qcommonsequencetypes_p.h"
+
+/* To avoid the static initialization fiasco, we put the builtin types in this compilation unit, since
+ * the sequence types depends on them. */
+#include "qbuiltintypes.cpp"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+// STATIC DATA
+#define st(var, type, card) \
+const SequenceType::Ptr \
+CommonSequenceTypes::var(new GenericSequenceType(BuiltinTypes::type, \
+ Cardinality::card()))
+
+/* Alphabetically. */
+st(ExactlyOneAnyURI, xsAnyURI, exactlyOne);
+st(ExactlyOneAtomicType, xsAnyAtomicType, exactlyOne);
+st(ExactlyOneAttribute, attribute, exactlyOne);
+st(ExactlyOneBase64Binary, xsBase64Binary, exactlyOne);
+st(ExactlyOneBoolean, xsBoolean, exactlyOne);
+st(ExactlyOneComment, comment, exactlyOne);
+st(ExactlyOneDateTime, xsDateTime, exactlyOne);
+st(ExactlyOneDate, xsDate, exactlyOne);
+st(ExactlyOneDayTimeDuration, xsDayTimeDuration, exactlyOne);
+st(ExactlyOneDecimal, xsDecimal, exactlyOne);
+st(ExactlyOneDocumentNode, document, exactlyOne);
+st(OneOrMoreDocumentNodes, document, oneOrMore);
+st(ExactlyOneDouble, xsDouble, exactlyOne);
+st(ExactlyOneDuration, xsDuration, exactlyOne);
+st(ExactlyOneElement, element, exactlyOne);
+st(ExactlyOneFloat, xsFloat, exactlyOne);
+st(ExactlyOneGDay, xsGDay, exactlyOne);
+st(ExactlyOneGMonthDay, xsGMonthDay, exactlyOne);
+st(ExactlyOneGMonth, xsGMonth, exactlyOne);
+st(ExactlyOneGYearMonth, xsGYearMonth, exactlyOne);
+st(ExactlyOneGYear, xsGYear, exactlyOne);
+st(ExactlyOneHexBinary, xsHexBinary, exactlyOne);
+st(ExactlyOneInteger, xsInteger, exactlyOne);
+st(ExactlyOneItem, item, exactlyOne);
+st(ExactlyOneNCName, xsNCName, exactlyOne);
+st(ExactlyOneNode, node, exactlyOne);
+st(ExactlyOneNumeric, numeric, exactlyOne);
+st(ExactlyOneProcessingInstruction, pi, exactlyOne);
+st(ExactlyOneQName, xsQName, exactlyOne);
+st(ExactlyOneString, xsString, exactlyOne);
+st(ExactlyOneTextNode, text, exactlyOne);
+st(ExactlyOneTime, xsTime, exactlyOne);
+st(ExactlyOneUntypedAtomic, xsUntypedAtomic, exactlyOne);
+st(ExactlyOneYearMonthDuration, xsYearMonthDuration, exactlyOne);
+st(OneOrMoreItems, item, oneOrMore);
+st(ZeroOrMoreAtomicTypes, xsAnyAtomicType, zeroOrMore);
+st(ZeroOrMoreElements, element, zeroOrMore);
+st(ZeroOrMoreIntegers, xsInteger, zeroOrMore);
+st(ZeroOrMoreItems, item, zeroOrMore);
+st(ZeroOrMoreNodes, node, zeroOrMore);
+st(ZeroOrMoreStrings, xsString, zeroOrMore);
+st(ZeroOrOneAnyURI, xsAnyURI, zeroOrOne);
+st(ZeroOrOneAtomicType, xsAnyAtomicType, zeroOrOne);
+st(ZeroOrOneBoolean, xsBoolean, zeroOrOne);
+st(ZeroOrOneDateTime, xsDateTime, zeroOrOne);
+st(ZeroOrOneDate, xsDate, zeroOrOne);
+st(ZeroOrOneDayTimeDuration, xsDayTimeDuration, zeroOrOne);
+st(ZeroOrOneDecimal, xsDecimal, zeroOrOne);
+st(ZeroOrOneDocumentNode, document, zeroOrOne);
+st(ZeroOrOneDuration, xsDuration, zeroOrOne);
+st(ZeroOrOneInteger, xsInteger, zeroOrOne);
+st(ZeroOrOneItem, item, zeroOrOne);
+st(ZeroOrOneNCName, xsNCName, zeroOrOne);
+st(ZeroOrOneNode, node, zeroOrOne);
+st(ZeroOrOneNumeric, numeric, zeroOrOne);
+st(ZeroOrOneQName, xsQName, zeroOrOne);
+st(ZeroOrOneString, xsString, zeroOrOne);
+st(ZeroOrOneTextNode, text, zeroOrOne);
+st(ZeroOrOneTime, xsTime, zeroOrOne);
+st(ZeroOrOneYearMonthDuration, xsYearMonthDuration, zeroOrOne);
+
+#undef st
+
+/* Special cases. */
+const EmptySequenceType::Ptr CommonSequenceTypes::Empty (new EmptySequenceType());
+const NoneType::Ptr CommonSequenceTypes::None (new NoneType());
+const SequenceType::Ptr CommonSequenceTypes::EBV (new EBVType());
+
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/type/qcommonsequencetypes_p.h b/src/xmlpatterns/type/qcommonsequencetypes_p.h
new file mode 100644
index 0000000..52cfabb
--- /dev/null
+++ b/src/xmlpatterns/type/qcommonsequencetypes_p.h
@@ -0,0 +1,414 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_CommonSequenceTypes_H
+#define Patternist_CommonSequenceTypes_H
+
+#include "qemptysequencetype_p.h"
+#include "qnonetype_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short Provides access to singleton instances of SequenceType sub-classes.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class Q_AUTOTEST_EXPORT CommonSequenceTypes
+ {
+ public:
+ /**
+ * <tt>xs:anyAtomicType?</tt>
+ */
+ static const SequenceType::Ptr ZeroOrOneAtomicType;
+
+ /**
+ * <tt>xs:anyAtomicType</tt>
+ */
+ static const SequenceType::Ptr ExactlyOneAtomicType;
+
+ /**
+ * <tt>xs:anyAtomicType*</tt>
+ */
+ static const SequenceType::Ptr ZeroOrMoreAtomicTypes;
+
+ /**
+ * <tt>item()</tt>
+ */
+ static const SequenceType::Ptr ExactlyOneItem;
+
+ /**
+ * <tt>item()*</tt>
+ */
+ static const SequenceType::Ptr ZeroOrMoreItems;
+
+ /**
+ * <tt>item()?</tt>
+ */
+ static const SequenceType::Ptr ZeroOrOneItem;
+
+ /**
+ * <tt>item()+</tt>
+ */
+ static const SequenceType::Ptr OneOrMoreItems;
+
+ /**
+ * The empty sequence, <tt>empty-sequence()</tt>.
+ */
+ static const EmptySequenceType::Ptr Empty;
+
+ /**
+ * The special type @c none. Used for the function <tt>fn:error()</tt>, for example.
+ */
+ static const NoneType::Ptr None;
+
+ /**
+ * <tt>xs:anyURI</tt>
+ */
+ static const SequenceType::Ptr ExactlyOneAnyURI;
+
+ /**
+ * <tt>xs:boolean</tt>
+ */
+ static const SequenceType::Ptr ExactlyOneBoolean;
+
+ /**
+ * <tt>xs:boolean?</tt>
+ */
+ static const SequenceType::Ptr ZeroOrOneBoolean;
+
+ /**
+ * <tt>xs:untypedAtomic</tt>
+ */
+ static const SequenceType::Ptr ExactlyOneUntypedAtomic;
+
+ /**
+ * <tt>xs:integer</tt>
+ */
+ static const SequenceType::Ptr ExactlyOneInteger;
+
+ /**
+ * <tt>xs:integer?</tt>
+ */
+ static const SequenceType::Ptr ZeroOrOneInteger;
+
+ /**
+ * <tt>xs:decimal?</tt>
+ */
+ static const SequenceType::Ptr ZeroOrOneDecimal;
+
+ /**
+ * <tt>xs:integer*</tt>
+ */
+ static const SequenceType::Ptr ZeroOrMoreIntegers;
+
+ /**
+ * <tt>xs:double</tt>
+ */
+ static const SequenceType::Ptr ExactlyOneDouble;
+
+ /**
+ * <tt>xs:decimal</tt>
+ */
+ static const SequenceType::Ptr ExactlyOneDecimal;
+
+ /**
+ * <tt>xs:float</tt>
+ */
+ static const SequenceType::Ptr ExactlyOneFloat;
+
+ /**
+ * <tt>xs:QName</tt>
+ */
+ static const SequenceType::Ptr ExactlyOneQName;
+
+ /**
+ * <tt>xs:string</tt>
+ */
+ static const SequenceType::Ptr ExactlyOneString;
+
+ /**
+ * <tt>xs:string?</tt>
+ */
+ static const SequenceType::Ptr ZeroOrOneString;
+
+ /**
+ * <tt>xs:string*</tt>
+ */
+ static const SequenceType::Ptr ZeroOrMoreStrings;
+
+ /**
+ * <tt>xs:NCName?</tt>
+ */
+ static const SequenceType::Ptr ZeroOrOneNCName;
+
+ /**
+ * <tt>xs:NCName</tt>
+ */
+ static const SequenceType::Ptr ExactlyOneNCName;
+
+ /**
+ * <tt>xs:QName?</tt>
+ */
+ static const SequenceType::Ptr ZeroOrOneQName;
+
+ /**
+ * The artificial type in XPath 2.0 that covers @c xs:double, @c xs:float,
+ * @c xs:decimal, with cardinality zero or one.
+ *
+ * @see <a href="http://www.w3.org/TR/xpath20/#dt-numeric">XML Path Language
+ * (XPath) 2.0, definition for Numeric</a>
+ * @see <a href="http://www.w3.org/TR/xpath-functions/#func-signatures">XQuery 1.0
+ * and XPath 2.0 Functions and Operators, 1.3 Function Signatures and Descriptions</a>
+ * @see BuiltinTypes::numeric
+ */
+ static const SequenceType::Ptr ZeroOrOneNumeric;
+
+ /**
+ * @c numeric
+ */
+ static const SequenceType::Ptr ExactlyOneNumeric;
+
+ /**
+ * <tt>node()?</tt>
+ */
+ static const SequenceType::Ptr ZeroOrOneNode;
+
+ /**
+ * <tt>node()</tt>
+ */
+ static const SequenceType::Ptr ExactlyOneNode;
+
+ /**
+ * <tt>node()*</tt>
+ */
+ static const SequenceType::Ptr ZeroOrMoreNodes;
+
+ /**
+ * <tt>element()</tt>
+ */
+ static const SequenceType::Ptr ExactlyOneElement;
+
+ /**
+ * <tt>processing-instruction()</tt>
+ */
+ static const SequenceType::Ptr ExactlyOneProcessingInstruction;
+
+ /**
+ * <tt>attribute()</tt>
+ */
+ static const SequenceType::Ptr ExactlyOneAttribute;
+
+ /**
+ * <tt>text()</tt>
+ */
+ static const SequenceType::Ptr ExactlyOneTextNode;
+
+ /**
+ * <tt>text()?</tt>
+ */
+ static const SequenceType::Ptr ZeroOrOneTextNode;
+
+ /**
+ * <tt>comment()</tt>
+ */
+ static const SequenceType::Ptr ExactlyOneComment;
+
+ /**
+ * <tt>element()*</tt>
+ */
+ static const SequenceType::Ptr ZeroOrMoreElements;
+
+ /**
+ * <tt>document-node()?</tt>
+ */
+ static const SequenceType::Ptr ZeroOrOneDocumentNode;
+
+ /**
+ * <tt>document-node()</tt>
+ */
+ static const SequenceType::Ptr ExactlyOneDocumentNode;
+
+ /**
+ * <tt>document-node()+</tt>
+ */
+ static const SequenceType::Ptr OneOrMoreDocumentNodes;
+
+ /**
+ * Identifiers all values which the Effective %Boolean Value
+ * can be extracted from.
+ */
+ static const SequenceType::Ptr EBV;
+
+ /**
+ * <tt>xs:anyURI?</tt>
+ */
+ static const SequenceType::Ptr ZeroOrOneAnyURI;
+
+ /**
+ * <tt>xs:hexBinary</tt>
+ */
+ static const SequenceType::Ptr ExactlyOneHexBinary;
+
+ /**
+ * <tt>xs:base64Binary</tt>
+ */
+ static const SequenceType::Ptr ExactlyOneBase64Binary;
+
+ /**
+ * <tt>xs:date</tt>
+ */
+ static const SequenceType::Ptr ExactlyOneDate;
+
+ /**
+ * <tt>xs:dateTime</tt>
+ */
+ static const SequenceType::Ptr ExactlyOneDateTime;
+
+ /**
+ * <tt>xs:dayTimeDuration</tt>
+ */
+ static const SequenceType::Ptr ExactlyOneDayTimeDuration;
+
+ /**
+ * <tt>xs:duration</tt>
+ */
+ static const SequenceType::Ptr ExactlyOneDuration;
+
+ /**
+ * <tt>xs:gDay</tt>
+ */
+ static const SequenceType::Ptr ExactlyOneGDay;
+
+ /**
+ * <tt>xs:gMonth</tt>
+ */
+ static const SequenceType::Ptr ExactlyOneGMonth;
+
+ /**
+ * <tt>xs:gMonthDay</tt>
+ */
+ static const SequenceType::Ptr ExactlyOneGMonthDay;
+
+ /**
+ * <tt>xs:gYear</tt>
+ */
+ static const SequenceType::Ptr ExactlyOneGYear;
+
+ /**
+ * <tt>xs:gYearMonth</tt>
+ */
+ static const SequenceType::Ptr ExactlyOneGYearMonth;
+
+ /**
+ * <tt>xs:yearMonthDuration</tt>
+ */
+ static const SequenceType::Ptr ExactlyOneYearMonthDuration;
+
+ /**
+ * <tt>xs:time</tt>
+ */
+ static const SequenceType::Ptr ExactlyOneTime;
+
+ /**
+ * <tt>xs:time?</tt>
+ */
+ static const SequenceType::Ptr ZeroOrOneDate;
+
+ /**
+ * <tt>xs:dateTime?</tt>
+ */
+ static const SequenceType::Ptr ZeroOrOneDateTime;
+
+ /**
+ * <tt>xs:dayTimeDuration?</tt>
+ */
+ static const SequenceType::Ptr ZeroOrOneDayTimeDuration;
+
+ /**
+ * <tt>xs:duration?</tt>
+ */
+ static const SequenceType::Ptr ZeroOrOneDuration;
+
+ /**
+ * <tt>xs:time?</tt>
+ */
+ static const SequenceType::Ptr ZeroOrOneTime;
+
+ /**
+ * <tt>xs:yearMonthDuration?</tt>
+ */
+ static const SequenceType::Ptr ZeroOrOneYearMonthDuration;
+
+ private:
+ /**
+ * The constructor is private and has no implementation,
+ * because this class is not meant to be instantiated.
+ *
+ * It should only be used via its static members.
+ */
+ inline CommonSequenceTypes();
+
+ Q_DISABLE_COPY(CommonSequenceTypes)
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
+
diff --git a/src/xmlpatterns/type/qebvtype.cpp b/src/xmlpatterns/type/qebvtype.cpp
new file mode 100644
index 0000000..2e376d6
--- /dev/null
+++ b/src/xmlpatterns/type/qebvtype.cpp
@@ -0,0 +1,123 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qbuiltintypes_p.h"
+#include "qcommonsequencetypes_p.h"
+#include "qitem_p.h"
+
+#include "qebvtype_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+EBVType::EBVType()
+{
+}
+
+bool EBVType::itemMatches(const Item &item) const
+{
+ if(item.isNode())
+ return false;
+
+ return BuiltinTypes::xsBoolean->itemMatches(item) ||
+ BuiltinTypes::numeric->itemMatches(item) ||
+ BuiltinTypes::xsString->itemMatches(item) ||
+ BuiltinTypes::xsAnyURI->itemMatches(item) ||
+ CommonSequenceTypes::Empty->itemMatches(item) ||
+ BuiltinTypes::xsUntypedAtomic->itemMatches(item);
+}
+
+bool EBVType::xdtTypeMatches(const ItemType::Ptr &t) const
+{
+ return BuiltinTypes::node->xdtTypeMatches(t) ||
+ BuiltinTypes::xsBoolean->xdtTypeMatches(t) ||
+ BuiltinTypes::numeric->xdtTypeMatches(t) ||
+ BuiltinTypes::xsString->xdtTypeMatches(t) ||
+ BuiltinTypes::xsAnyURI->xdtTypeMatches(t) ||
+ *CommonSequenceTypes::Empty == *t ||
+ BuiltinTypes::xsUntypedAtomic->xdtTypeMatches(t) ||
+ /* Item & xs:anyAtomicType is ok, we do the checking at runtime. */
+ *BuiltinTypes::item == *t ||
+ *BuiltinTypes::xsAnyAtomicType == *t;
+}
+
+QString EBVType::displayName(const NamePool::Ptr &) const
+{
+ /* Some QName-lexical is not used here because it makes little sense
+ * for this strange type. Instead the operand type of the fn:boolean()'s
+ * argument is used. */
+ return QLatin1String("item()*(: EBV extractable type :)");
+}
+
+Cardinality EBVType::cardinality() const
+{
+ return Cardinality::zeroOrMore();
+}
+
+ItemType::Ptr EBVType::xdtSuperType() const
+{
+ return BuiltinTypes::item;
+}
+
+ItemType::Ptr EBVType::itemType() const
+{
+ return ItemType::Ptr(const_cast<EBVType *>(this));
+}
+
+bool EBVType::isAtomicType() const
+{
+ return false;
+}
+
+bool EBVType::isNodeType() const
+{
+ return true;
+}
+
+ItemType::Ptr EBVType::atomizedType() const
+{
+ Q_ASSERT_X(false, Q_FUNC_INFO,
+ "That this function is called makes no sense.");
+ return AtomicType::Ptr();
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/type/qebvtype_p.h b/src/xmlpatterns/type/qebvtype_p.h
new file mode 100644
index 0000000..4ae3301
--- /dev/null
+++ b/src/xmlpatterns/type/qebvtype_p.h
@@ -0,0 +1,135 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_EBVType_H
+#define Patternist_EBVType_H
+
+#include "qatomictype_p.h"
+#include "qsequencetype_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+
+ /**
+ * @short Represents the type for which a value of can an Effective %Boolean Value
+ * be extracted from.
+ *
+ * EBVType is an artificial type. It is not available to users of any host language
+ * or is specified in any specification. It is used for implementing static type
+ * checking for expressions such as IfThenClause and AndExpression.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class EBVType : public ItemType,
+ public SequenceType
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<EBVType> Ptr;
+
+ /**
+ * @todo docs if it's an ebvable type, etc.
+ */
+ virtual bool itemMatches(const Item &item) const;
+ virtual bool xdtTypeMatches(const ItemType::Ptr &other) const;
+
+ virtual QString displayName(const NamePool::Ptr &np) const;
+
+ /**
+ * @note The semantical meaning of this type's item type can
+ * surely be discussed. The function is provided due to
+ * it being mandated by the SequenceType base class.
+ *
+ * @returns always 'this' since EBVType is also an ItemType
+ */
+ virtual ItemType::Ptr itemType() const;
+
+ /**
+ * @note The semantical meaning of this type's cardinality
+ * can surely be discussed. The function is provided due to
+ * it being mandated by the SequenceType base class.
+ *
+ * @returns always Cardinality::zeroOrMore()
+ */
+ virtual Cardinality cardinality() const;
+
+ virtual bool isAtomicType() const;
+
+ /**
+ * @returns always @c null
+ */
+ virtual ItemType::Ptr atomizedType() const;
+
+ /**
+ * @returns always BuiltinTypes::item
+ */
+ virtual ItemType::Ptr xdtSuperType() const;
+
+ /**
+ * @returns always @c false
+ */
+ virtual bool isNodeType() const;
+
+ protected:
+ friend class CommonSequenceTypes;
+ EBVType();
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/type/qemptysequencetype.cpp b/src/xmlpatterns/type/qemptysequencetype.cpp
new file mode 100644
index 0000000..205e99b
--- /dev/null
+++ b/src/xmlpatterns/type/qemptysequencetype.cpp
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qbuiltintypes_p.h"
+#include "qcommonsequencetypes_p.h"
+
+#include "qemptysequencetype_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+EmptySequenceType::EmptySequenceType()
+{
+}
+
+bool EmptySequenceType::xdtTypeMatches(const ItemType::Ptr &other) const
+{
+ return *other == *this ||
+ CommonSequenceTypes::None->xdtTypeMatches(other);
+}
+
+bool EmptySequenceType::itemMatches(const Item &) const
+{
+ return false;
+}
+
+QString EmptySequenceType::displayName(const NamePool::Ptr &) const
+{
+ return QLatin1String("empty-sequence()");
+}
+
+ItemType::Ptr EmptySequenceType::xdtSuperType() const
+{
+ return BuiltinTypes::item;
+}
+
+Cardinality EmptySequenceType::cardinality() const
+{
+ return Cardinality::empty();
+}
+
+ItemType::Ptr EmptySequenceType::itemType() const
+{
+ return ItemType::Ptr(const_cast<EmptySequenceType *>(this));
+}
+
+bool EmptySequenceType::isNodeType() const
+{
+ return false;
+}
+
+bool EmptySequenceType::isAtomicType() const
+{
+ return false;
+}
+
+ItemType::Ptr EmptySequenceType::atomizedType() const
+{
+ return BuiltinTypes::xsAnyAtomicType;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/type/qemptysequencetype_p.h b/src/xmlpatterns/type/qemptysequencetype_p.h
new file mode 100644
index 0000000..a3bf6bb
--- /dev/null
+++ b/src/xmlpatterns/type/qemptysequencetype_p.h
@@ -0,0 +1,124 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_EmptySequenceType_H
+#define Patternist_EmptySequenceType_H
+
+#include "qatomictype_p.h"
+#include "qsequencetype_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+
+ /**
+ * @short Represents the <tt>empty-sequence()</tt> type.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class EmptySequenceType : public ItemType,
+ public SequenceType
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<EmptySequenceType> Ptr;
+
+ /**
+ * Possibly surprisingly, this function also returns true for the @c none type.
+ *
+ * @returns @c true if @p other is NoneType or EmptySequenceType, otherwise @c false.
+ */
+ virtual bool xdtTypeMatches(const ItemType::Ptr &other) const;
+
+ /**
+ * @returns always @c false
+ */
+ virtual bool itemMatches(const Item &item) const;
+
+ /**
+ * @returns always "empty-sequence()"
+ */
+ virtual QString displayName(const NamePool::Ptr &np) const;
+
+ virtual ItemType::Ptr xdtSuperType() const;
+
+ virtual bool isNodeType() const;
+ virtual bool isAtomicType() const;
+
+ /**
+ * @return always Cardinality::empty()
+ */
+ virtual Cardinality cardinality() const;
+
+ /**
+ * @returns always 'this' since it is also an ItemType
+ */
+ virtual ItemType::Ptr itemType() const;
+
+ /**
+ * @returns always @c xs:anyAtomicType
+ */
+ virtual ItemType::Ptr atomizedType() const;
+
+ protected:
+ friend class CommonSequenceTypes;
+ EmptySequenceType();
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/type/qgenericsequencetype.cpp b/src/xmlpatterns/type/qgenericsequencetype.cpp
new file mode 100644
index 0000000..41b9aaa
--- /dev/null
+++ b/src/xmlpatterns/type/qgenericsequencetype.cpp
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QString>
+
+#include "qgenericsequencetype_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+GenericSequenceType::GenericSequenceType(const ItemType::Ptr &iType,
+ const Cardinality &card) : m_itemType(iType),
+ m_cardinality(card)
+{
+ Q_ASSERT(m_itemType);
+}
+
+QString GenericSequenceType::displayName(const NamePool::Ptr &np) const
+{
+ return m_itemType->displayName(np) + m_cardinality.displayName(Cardinality::ExcludeExplanation);
+}
+
+Cardinality GenericSequenceType::cardinality() const
+{
+ return m_cardinality;
+}
+
+ItemType::Ptr GenericSequenceType::itemType() const
+{
+ return m_itemType;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/type/qgenericsequencetype_p.h b/src/xmlpatterns/type/qgenericsequencetype_p.h
new file mode 100644
index 0000000..0f48cc9
--- /dev/null
+++ b/src/xmlpatterns/type/qgenericsequencetype_p.h
@@ -0,0 +1,115 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_GenericSequenceType_H
+#define Patternist_GenericSequenceType_H
+
+#include "qcommonsequencetypes_p.h"
+#include "qsequencetype_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @todo Documentation is missing.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class GenericSequenceType : public SequenceType
+ {
+ public:
+ GenericSequenceType(const ItemType::Ptr &itemType, const Cardinality &card);
+
+ /**
+ * Generates a name for the sequence type for display purposes. The
+ * prefix used for the QName identifying the schema type is conventional.
+ * An example of a display name for a GenericSequenceType is "xs:integer?".
+ */
+ virtual QString displayName(const NamePool::Ptr &np) const;
+
+ virtual Cardinality cardinality() const;
+
+ virtual ItemType::Ptr itemType() const;
+
+ private:
+ const ItemType::Ptr m_itemType;
+ const Cardinality m_cardinality;
+ };
+
+ /**
+ * @short An object generator for GenericSequenceType.
+ *
+ * makeGenericSequenceType() is a convenience function for avoiding invoking
+ * the @c new operator, and wrapping the result in GenericSequenceType::Ptr.
+ *
+ * @returns a smart pointer to to a GenericSequenceType instaniated from @p itemType and @p cardinality.
+ * @relates GenericSequenceType
+ */
+ static inline SequenceType::Ptr
+ makeGenericSequenceType(const ItemType::Ptr &itemType, const Cardinality &cardinality)
+ {
+ /* An empty sequence of say integers, is the empty-sequence(). */
+ if(cardinality.isEmpty())
+ return CommonSequenceTypes::Empty;
+ else
+ return SequenceType::Ptr(new GenericSequenceType(itemType, cardinality));
+ }
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/type/qitemtype.cpp b/src/xmlpatterns/type/qitemtype.cpp
new file mode 100644
index 0000000..6252672
--- /dev/null
+++ b/src/xmlpatterns/type/qitemtype.cpp
@@ -0,0 +1,103 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGlobal>
+
+#include "qcommonsequencetypes_p.h"
+
+#include "qitemtype_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+ItemType::~ItemType()
+{
+}
+
+const ItemType &ItemType::operator|(const ItemType &other) const
+{
+ const ItemType *ca = this;
+
+ if(other == *CommonSequenceTypes::None)
+ return *ca;
+
+ if(*ca == *CommonSequenceTypes::Empty)
+ return other;
+ else if(other == *CommonSequenceTypes::Empty)
+ return *ca;
+
+ do
+ {
+ const ItemType *cb = &other;
+ do
+ {
+ if(*ca == *cb)
+ return *ca;
+
+ cb = cb->xdtSuperType().data();
+ }
+ while(cb);
+
+ ca = ca->xdtSuperType().data();
+ }
+ while(ca);
+
+ Q_ASSERT_X(false, Q_FUNC_INFO, "We should never reach this line.");
+ return *this;
+}
+
+ItemType::Category ItemType::itemTypeCategory() const
+{
+ return Other;
+}
+
+bool ItemType::operator==(const ItemType &other) const
+{
+ return this == &other;
+}
+
+ItemType::InstanceOf ItemType::instanceOf() const
+{
+ return ClassOther;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/type/qitemtype_p.h b/src/xmlpatterns/type/qitemtype_p.h
new file mode 100644
index 0000000..f3e5285
--- /dev/null
+++ b/src/xmlpatterns/type/qitemtype_p.h
@@ -0,0 +1,286 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_ItemType_H
+#define Patternist_ItemType_H
+
+#include <QSharedData>
+
+#include <QtXmlPatterns/private/qnamepool_p.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+template<typename T> class QList;
+
+namespace QPatternist
+{
+ class Item;
+
+ /**
+ * @short Base class for the XPath Data Model's type hierarchy.
+ *
+ * It can not be instantiated, but it's possible via ItemType's two subtypes:
+ * Nodes, represented by QXmlNodeModelIndex, and atom types, represented by AtomicType.
+ *
+ * ItemType tries to by its design stay close to the notation used in Formal Semantics.
+ * The operator|() is a good example, it allow typing code to be written
+ * similar to how inference rules in the specification are written.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class ItemType : public virtual QSharedData
+ {
+ public:
+ /**
+ * A smart pointer wrapping ItemType instances.
+ */
+ typedef QExplicitlySharedDataPointer<ItemType> Ptr;
+ /**
+ * A list of ItemType instances, each wrapped in a smart pointer.
+ */
+ typedef QList<ItemType::Ptr> List;
+
+ virtual ~ItemType();
+
+ enum Category
+ {
+ NodeNameTest = 1,
+ Other = 2
+ };
+
+ /**
+ * Determines whether this ItemType is equal to @p other.
+ *
+ * Many types are represented by singleton instances. For example, there
+ * exists only one instance of IntegerType. This operator==() takes advantage
+ * of that and uses equalness of object addresses for determining semantic
+ * equalness. This function is as a result fast.
+ *
+ * However, it's overridden in some cases, such as for name tests, where
+ * it's not guaranteed that there exists two types.
+ *
+ * @returns @c true if this ItemType is equal to @p other, otherwise @c false.
+ */
+ virtual bool operator==(const ItemType &other) const;
+
+ /**
+ * @returns the result of operator==() negated.
+ */
+ inline bool operator!=(const ItemType &other) const;
+
+ /**
+ * @returns a string representing the type. Used for diagnostic purposes. For a
+ * type whose name is a QName, a lexical representation should be returned
+ * with the prefix being a conventional one. Examples of a display names
+ * are "item()" and "xs:nonPositiveInteger".
+ */
+ virtual QString displayName(const NamePool::Ptr &np) const = 0;
+
+ /**
+ * @param item the item that is to be matched. This is guaranteed by the caller
+ * to never be @c null.
+ */
+ virtual bool itemMatches(const Item &item) const = 0;
+
+ /**
+ * @short Returns @c true if @p other matches this type. That is, if @p
+ * other is equal to this type or a subtype of this type.
+ *
+ * For instance this statements evaluates to @c true:
+ *
+ * @code
+ * BuiltinTypes::xsAnyAtomicType->xdtTypeMatches(BuiltinTypes::xsString);
+ * @endcode
+ *
+ * but this evaluates to @c false:
+ *
+ * @code
+ * BuiltinTypes::attribute->xdtTypeMatches(BuiltinTypes::node);
+ * @endcode
+ *
+ * @param other the other ItemType that is to be matched. This is guaranteed by the caller
+ * to never be @c null.
+ */
+ virtual bool xdtTypeMatches(const ItemType::Ptr &other) const = 0;
+
+ virtual bool isNodeType() const = 0;
+ virtual bool isAtomicType() const = 0;
+
+ /**
+ * Determines the type's parent type in the XPath Data Model hierarchy. For example,
+ * for the type xs:anyAtomicType, the super type in the XPath Data Model is item(), not
+ * xs:anySimpleType. SchemaType::xdtSuperType navigates the schema hierarchy.
+ *
+ * @see SchemaType::wxsSuperType()
+ * @returns the type's super type.
+ */
+ virtual ItemType::Ptr xdtSuperType() const = 0;
+
+ /**
+ * @todo docs mention union, give if-expression example.
+ *
+ * Determines the super type that is closest to this ItemType and @p other. That is,
+ * the parent type of them both. For example, for the type xs:integer and xs:string
+ * the parent type is xs:anyAtomicType. For xs:NOTATION and processing-instruction(), it
+ * is item(), to name another example.
+ *
+ * This function can be seen as the type function prime(Type), defined in Formal Semantics.
+ *
+ * This walks the XPath Data Model type hierarchy, not the W3C XML Schema hierarchy.
+ * @param other the item type 'this' object, should be compared with. Invoking xdtSuperType
+ * on 'this' object with @p other as argument yields the same result as invoking the
+ * function on @p other with 'this'
+ * as argument.
+ * @returns the parent type of 'this' and @p other
+ * @see <a href="http://www.w3.org/TR/xquery-semantics/\#jd_prime">XQuery 1.0 and XPath 2.0
+ * Formal Semantics, Prime Types, type function prime(Type)</a>
+ */
+ virtual const ItemType &operator|(const ItemType &other) const;
+
+ /**
+ * Determines the atomic type that the resulting sequence after
+ * atomization of this node would be an instance of. For example, for document node,
+ * xs:untypedAtomic is returned. Phrased differently, the returned type is the
+ * type of the result of the typed-value accessor.
+ *
+ * If the type cannot be atomized, it returns @c null.
+ *
+ * This function is also defined on SchemaType, because some schema types can also be
+ * atomized.
+ *
+ * @see SchemaType::atomizedType()
+ * @see <a href="http://www.w3.org/TR/xpath-datamodel/\#dm-typed-value">XQuery 1.0
+ * and XPath 2.0 Data Model, 5.15 typed-value Accessor</a>
+ * @see <a href="http://www.w3.org/TR/xquery-semantics/#jd_data">XQuery 1.0
+ * and XPath 2.0 Formal Semantics, data on auxiliary judgment</a>
+ * @returns the atomic type that the resulting sequence
+ * when performing atomization is an instance of.
+ */
+ virtual ItemType::Ptr atomizedType() const = 0;
+
+ /**
+ * @returns always Other
+ */
+ virtual Category itemTypeCategory() const;
+
+ enum InstanceOf
+ {
+ ClassLocalNameTest,
+ ClassNamespaceNameTest,
+ ClassQNameTest,
+ ClassOther
+ };
+
+ /**
+ * Determines what class this ItemType is an instance of. This
+ * is in needed in some implementations of operator operator==(). By
+ * default, Other is returned.
+ */
+ virtual InstanceOf instanceOf() const;
+
+ inline ItemType()
+ {
+ }
+
+ private:
+ Q_DISABLE_COPY(ItemType)
+ };
+
+ /**
+ * This operator exists for making it easier to use the ItemType class, which
+ * always are wrapped in ItemType::Ptr, by taking care of the dereferencing
+ * of ItemType::Ptr instances. Semantically, it performs the same as
+ * ItemType's operator of the same name.
+ *
+ * @relates ItemType
+ * @see ItemType::operator|()
+ * @see operator|=(ItemType::Ptr &, const ItemType::Ptr &)
+ */
+ inline ItemType::Ptr operator|(const ItemType::Ptr &op1,
+ const ItemType::Ptr &op2)
+ {
+ return ItemType::Ptr(const_cast<ItemType *>(&(*op1 | *op2)));
+ }
+
+ bool ItemType::operator!=(const ItemType &other) const
+ {
+ return this != &other;
+ }
+
+ /**
+ * @short Computes the union type of @p op1 and @p op2, and assigns it to @p op1.
+ *
+ * This operator exists for making it easier to use the ItemType class, which
+ * always are wrapped in ItemType::Ptr, by taking care of the dereferencing
+ * of the ItemType::Ptr instances.
+ *
+ * @relates ItemType
+ * @see operator|(const ItemType::Ptr &, const ItemType::Ptr &)
+ * @param op1 if @c null, @p op2 is returned unchanged
+ * @param op2 the other operand
+ */
+ inline void operator|=(ItemType::Ptr &op1, const ItemType::Ptr &op2)
+ {
+ op1 = op1 | op2;
+ }
+
+}
+
+Q_DECLARE_TYPEINFO(QPatternist::ItemType::Ptr, Q_MOVABLE_TYPE);
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/type/qlocalnametest.cpp b/src/xmlpatterns/type/qlocalnametest.cpp
new file mode 100644
index 0000000..4c47476
--- /dev/null
+++ b/src/xmlpatterns/type/qlocalnametest.cpp
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QHash>
+
+#include "qbuiltintypes_p.h"
+#include "qitem_p.h"
+#include "qitem_p.h"
+#include "qxpathhelper_p.h"
+
+#include "qlocalnametest_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+LocalNameTest::LocalNameTest(const ItemType::Ptr &primaryType,
+ const QXmlName::LocalNameCode &ncName) : AbstractNodeTest(primaryType),
+ m_ncName(ncName)
+{
+}
+
+ItemType::Ptr LocalNameTest::create(const ItemType::Ptr &primaryType, const QXmlName::LocalNameCode localName)
+{
+ Q_ASSERT(primaryType);
+
+ return ItemType::Ptr(new LocalNameTest(primaryType, localName));
+}
+
+bool LocalNameTest::itemMatches(const Item &item) const
+{
+ Q_ASSERT(item.isNode());
+ return m_primaryType->itemMatches(item) &&
+ item.asNode().name().localName() == m_ncName;
+}
+
+QString LocalNameTest::displayName(const NamePool::Ptr &np) const
+{
+ QString displayOther(m_primaryType->displayName(np));
+
+ return displayOther.insert(displayOther.size() - 1,
+ QString::fromLatin1("*:") + np->stringForLocalName(m_ncName));
+}
+
+ItemType::InstanceOf LocalNameTest::instanceOf() const
+{
+ return ClassLocalNameTest;
+}
+
+bool LocalNameTest::operator==(const ItemType &other) const
+{
+ return other.instanceOf() == ClassLocalNameTest &&
+ static_cast<const LocalNameTest &>(other).m_ncName == m_ncName;
+}
+
+PatternPriority LocalNameTest::patternPriority() const
+{
+ return -0.25;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/type/qlocalnametest_p.h b/src/xmlpatterns/type/qlocalnametest_p.h
new file mode 100644
index 0000000..dc54fcf
--- /dev/null
+++ b/src/xmlpatterns/type/qlocalnametest_p.h
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_LocalNameTest_H
+#define Patternist_LocalNameTest_H
+
+#include "qabstractnodetest_p.h"
+
+template<typename Key, typename Value> class QHash;
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short A name test that is of the type <tt>*:local-name</tt>.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class LocalNameTest : public AbstractNodeTest
+ {
+ public:
+ typedef QHash<QString, ItemType::Ptr> Hash;
+
+ static ItemType::Ptr create(const ItemType::Ptr &primaryType, const QXmlName::LocalNameCode localName);
+
+ /**
+ * @note This function assumes that @p item is a QXmlNodeModelIndex.
+ */
+ virtual bool itemMatches(const Item &item) const;
+
+ virtual QString displayName(const NamePool::Ptr &np) const;
+
+ virtual bool operator==(const ItemType &other) const;
+ virtual PatternPriority patternPriority() const;
+
+ protected:
+ virtual InstanceOf instanceOf() const;
+
+ private:
+ LocalNameTest(const ItemType::Ptr &primaryType, const QXmlName::LocalNameCode &ncName);
+
+ const QXmlName::LocalNameCode m_ncName;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/type/qmultiitemtype.cpp b/src/xmlpatterns/type/qmultiitemtype.cpp
new file mode 100644
index 0000000..49261f3
--- /dev/null
+++ b/src/xmlpatterns/type/qmultiitemtype.cpp
@@ -0,0 +1,140 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qatomictype_p.h"
+
+#include "qmultiitemtype_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+MultiItemType::MultiItemType(const ItemType::List &list) : m_types(list),
+ m_end(list.constEnd())
+{
+ Q_ASSERT_X(list.count() >= 2, Q_FUNC_INFO,
+ "It makes no sense to use MultiItemType for types less than two.");
+ Q_ASSERT_X(list.count(ItemType::Ptr()) == 0, Q_FUNC_INFO,
+ "No member in the list can be null.");
+}
+
+QString MultiItemType::displayName(const NamePool::Ptr &np) const
+{
+ QString result;
+ ItemType::List::const_iterator it(m_types.constBegin());
+
+ while(true)
+ {
+ result += (*it)->displayName(np);
+ ++it;
+
+ if(it != m_end)
+ result += QLatin1String(" | ");
+ else
+ break;
+ }
+
+ return result;
+}
+
+bool MultiItemType::itemMatches(const Item &item) const
+{
+ for(ItemType::List::const_iterator it(m_types.constBegin()); it != m_end; ++it)
+ if((*it)->itemMatches(item))
+ return true;
+
+ return false;
+}
+
+bool MultiItemType::xdtTypeMatches(const ItemType::Ptr &type) const
+{
+ for(ItemType::List::const_iterator it(m_types.constBegin()); it != m_end; ++it)
+ if((*it)->xdtTypeMatches(type))
+ return true;
+
+ return false;
+}
+
+bool MultiItemType::isNodeType() const
+{
+ for(ItemType::List::const_iterator it(m_types.constBegin()); it != m_end; ++it)
+ if((*it)->isNodeType())
+ return true;
+
+ return false;
+}
+
+bool MultiItemType::isAtomicType() const
+{
+ for(ItemType::List::const_iterator it(m_types.constBegin()); it != m_end; ++it)
+ if((*it)->isAtomicType())
+ return true;
+
+ return false;
+}
+
+ItemType::Ptr MultiItemType::xdtSuperType() const
+{
+ ItemType::List::const_iterator it(m_types.constBegin());
+ /* Load the first one, and jump over it in the loop. */
+ ItemType::Ptr result((*it)->xdtSuperType());
+ ++it;
+
+ for(; it != m_end; ++it)
+ result |= (*it)->xdtSuperType();
+
+ return result;
+}
+
+ItemType::Ptr MultiItemType::atomizedType() const
+{
+ ItemType::List::const_iterator it(m_types.constBegin());
+ /* Load the first one, and jump over it in the loop. */
+ ItemType::Ptr result((*it)->atomizedType());
+ ++it;
+
+ for(; it != m_end; ++it)
+ result |= (*it)->atomizedType();
+
+ return result;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/type/qmultiitemtype_p.h b/src/xmlpatterns/type/qmultiitemtype_p.h
new file mode 100644
index 0000000..6069172
--- /dev/null
+++ b/src/xmlpatterns/type/qmultiitemtype_p.h
@@ -0,0 +1,146 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_MultiItemType_H
+#define Patternist_MultiItemType_H
+
+#include <QList>
+
+#include "qitemtype_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short Represents multiple types such as <tt>document()</tt> @em or <tt>xs:integer</tt>.
+ *
+ * In some situations two or more different types are allowed. For example, XQuery's
+ * @c validate expression accepts document or element nodes(but not attribute
+ * nodes, for example). MultiItemType is useful in such situations, its constructor
+ * takes a list of ItemType instances which its member functions treats as a wholeness.
+ *
+ * For example, xdtTypeMatches() returns @c true if any of the represented types matches.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class MultiItemType : public ItemType
+ {
+ public:
+ /**
+ * Creates a MultiItemType representing the types in @p typeList. @p typeList must
+ * contain two or more types.
+ */
+ MultiItemType(const ItemType::List &typeList);
+
+ /**
+ * The display name are the names concatenated with "|" as separator. For example,
+ * if this MultiItemType represents the types <tt>document()</tt>, <tt>xs:integer</tt>,
+ * and <tt>xs:anyAtomicType</tt>, the display name is
+ * "document() | xs:integer | xs:anyAtomicType".
+ */
+ virtual QString displayName(const NamePool::Ptr &np) const;
+
+ /**
+ * If any of the types this MultiItemType represents matches @p item, it is
+ * considered a match.
+ *
+ * @returns @c true if any of the housed ItemType instances matches @p item, otherwise @c false
+ */
+ virtual bool itemMatches(const Item &item) const;
+
+ /**
+ * If any of the types this MultiItemType represents matches @p other, it is
+ * considered a match.
+ *
+ * @returns @c true if any of the housed ItemType instances matches @p other, otherwise @c false
+ */
+ virtual bool xdtTypeMatches(const ItemType::Ptr &other) const;
+
+ /**
+ * @returns @c true if any of the represented types is a node type.
+ */
+ virtual bool isNodeType() const;
+
+ /**
+ * @returns @c true if any of the represented types is an atomic type.
+ */
+ virtual bool isAtomicType() const;
+
+ /**
+ * Determines the union type of all the represented types super types. For example,
+ * if the represented types are <tt>xs:integer</tt>, <tt>document()</tt>
+ * and <tt>xs:string</tt>, <tt>item()</tt> is returned.
+ */
+ virtual ItemType::Ptr xdtSuperType() const;
+
+ /**
+ * Determines the union type of all the represented types atomized types. For example,
+ * if the represented types are <tt>xs:integer</tt> and <tt>document()</tt>,
+ * <tt>xs:anyAtomicType</tt> is returned, because that's the super type of <tt>xs:integer</tt>
+ * and <tt>xs:untypedAtomic</tt>.
+ */
+ virtual ItemType::Ptr atomizedType() const;
+
+ private:
+ const ItemType::List m_types;
+ const ItemType::List::const_iterator m_end;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/type/qnamedschemacomponent.cpp b/src/xmlpatterns/type/qnamedschemacomponent.cpp
new file mode 100644
index 0000000..0edd593
--- /dev/null
+++ b/src/xmlpatterns/type/qnamedschemacomponent.cpp
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qnamedschemacomponent_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+NamedSchemaComponent::NamedSchemaComponent()
+{
+}
+
+NamedSchemaComponent::~NamedSchemaComponent()
+{
+}
+
+void NamedSchemaComponent::setName(const QXmlName &name)
+{
+ m_name = name;
+}
+
+QXmlName NamedSchemaComponent::name(const NamePool::Ptr&) const
+{
+ return m_name;
+}
+
+QString NamedSchemaComponent::displayName(const NamePool::Ptr &np) const
+{
+ return np->displayName(m_name);
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/type/qnamedschemacomponent_p.h b/src/xmlpatterns/type/qnamedschemacomponent_p.h
new file mode 100644
index 0000000..2c8c6ce
--- /dev/null
+++ b/src/xmlpatterns/type/qnamedschemacomponent_p.h
@@ -0,0 +1,127 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_NamedSchemaComponent_H
+#define Patternist_NamedSchemaComponent_H
+
+#include "qnamepool_p.h"
+#include "qschemacomponent_p.h"
+#include "qxmlname.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short Base class for all named components that can appear in a W3C XML Schema.
+ *
+ * @ingroup Patternist_types
+ * @author Tobias Koenig <tobias.koenig@nokia.com>
+ */
+ class NamedSchemaComponent : public SchemaComponent
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<NamedSchemaComponent> Ptr;
+
+ /**
+ * Describes the blocking constraints that are given by the 'block' attributes.
+ */
+ enum BlockingConstraint
+ {
+ RestrictionConstraint = 1,
+ ExtensionConstraint = 2,
+ SubstitutionConstraint = 4
+ };
+ Q_DECLARE_FLAGS(BlockingConstraints, BlockingConstraint)
+
+ /**
+ * Creates a new named schema component.
+ */
+ NamedSchemaComponent();
+
+ /**
+ * Destroys the named schema component.
+ */
+ virtual ~NamedSchemaComponent();
+
+ /**
+ * Sets the @p name of the schema component.
+ */
+ void setName(const QXmlName &name);
+
+ /**
+ * Returns the name of the schema component.
+ *
+ * @param namePool The name pool the name belongs to.
+ */
+ virtual QXmlName name(const NamePool::Ptr &namePool) const;
+
+ /**
+ * Returns the display name of the schema component.
+ *
+ * @param namePool The name pool the name belongs to.
+ */
+ virtual QString displayName(const NamePool::Ptr &namePool) const;
+
+ private:
+ QXmlName m_name;
+ };
+
+ Q_DECLARE_OPERATORS_FOR_FLAGS(NamedSchemaComponent::BlockingConstraints)
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/type/qnamespacenametest.cpp b/src/xmlpatterns/type/qnamespacenametest.cpp
new file mode 100644
index 0000000..3975c87
--- /dev/null
+++ b/src/xmlpatterns/type/qnamespacenametest.cpp
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QHash>
+
+#include "qbuiltintypes_p.h"
+#include "qitem_p.h"
+#include "qitem_p.h"
+
+#include "qnamespacenametest_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+NamespaceNameTest::NamespaceNameTest(const ItemType::Ptr &primaryType,
+ const QXmlName::NamespaceCode namespaceURI) : AbstractNodeTest(primaryType),
+ m_namespaceURI(namespaceURI)
+{
+}
+
+ItemType::Ptr NamespaceNameTest::create(const ItemType::Ptr &primaryType, const QXmlName::NamespaceCode namespaceURI)
+{
+ Q_ASSERT(primaryType);
+
+ return ItemType::Ptr(new NamespaceNameTest(primaryType, namespaceURI));
+}
+
+bool NamespaceNameTest::itemMatches(const Item &item) const
+{
+ Q_ASSERT(item.isNode());
+ return m_primaryType->itemMatches(item) &&
+ item.asNode().name().namespaceURI() == m_namespaceURI;
+}
+
+QString NamespaceNameTest::displayName(const NamePool::Ptr &np) const
+{
+ return QLatin1Char('{') + np->stringForNamespace(m_namespaceURI) + QLatin1String("}:*");
+}
+
+ItemType::InstanceOf NamespaceNameTest::instanceOf() const
+{
+ return ClassNamespaceNameTest;
+}
+
+bool NamespaceNameTest::operator==(const ItemType &other) const
+{
+ return other.instanceOf() == ClassNamespaceNameTest &&
+ static_cast<const NamespaceNameTest &>(other).m_namespaceURI == m_namespaceURI;
+}
+
+PatternPriority NamespaceNameTest::patternPriority() const
+{
+ return -0.25;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/type/qnamespacenametest_p.h b/src/xmlpatterns/type/qnamespacenametest_p.h
new file mode 100644
index 0000000..96724de
--- /dev/null
+++ b/src/xmlpatterns/type/qnamespacenametest_p.h
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_NamespaceNameTest_H
+#define Patternist_NamespaceNameTest_H
+
+#include "qabstractnodetest_p.h"
+
+template<typename Key, typename Value> class QHash;
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short A name test that is of the type <tt>prefix:*</tt>.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class NamespaceNameTest : public AbstractNodeTest
+ {
+ public:
+ typedef QHash<QString, ItemType::Ptr> Hash;
+
+ static ItemType::Ptr create(const ItemType::Ptr &primaryType, const QXmlName::NamespaceCode namespaceURI);
+
+ /**
+ * @note This function assumes that @p item is a QXmlNodeModelIndex.
+ */
+ virtual bool itemMatches(const Item &item) const;
+
+ virtual QString displayName(const NamePool::Ptr &np) const;
+
+ virtual bool operator==(const ItemType &other) const;
+ PatternPriority patternPriority() const;
+
+ protected:
+ virtual InstanceOf instanceOf() const;
+
+ private:
+ NamespaceNameTest(const ItemType::Ptr &primaryType, const QXmlName::NamespaceCode namespaceURI);
+ const QXmlName::NamespaceCode m_namespaceURI;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/type/qnonetype.cpp b/src/xmlpatterns/type/qnonetype.cpp
new file mode 100644
index 0000000..0ec5a7b
--- /dev/null
+++ b/src/xmlpatterns/type/qnonetype.cpp
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qbuiltintypes_p.h"
+
+#include "qnonetype_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+NoneType::NoneType()
+{
+}
+
+bool NoneType::itemMatches(const Item &) const
+{
+ return false;
+}
+
+bool NoneType::xdtTypeMatches(const ItemType::Ptr &t) const
+{
+ return *this == *t;
+}
+
+const ItemType &NoneType::operator|(const ItemType &other) const
+{
+ return other;
+}
+
+QString NoneType::displayName(const NamePool::Ptr &) const
+{
+ return QLatin1String("none");
+}
+
+Cardinality NoneType::cardinality() const
+{
+ return Cardinality::zeroOrMore();
+}
+
+ItemType::Ptr NoneType::itemType() const
+{
+ return ItemType::Ptr(const_cast<NoneType *>(this));
+}
+
+bool NoneType::isAtomicType() const
+{
+ return false;
+}
+
+bool NoneType::isNodeType() const
+{
+ return false;
+}
+
+ItemType::Ptr NoneType::atomizedType() const
+{
+ return BuiltinTypes::xsAnyAtomicType;
+}
+
+ItemType::Ptr NoneType::xdtSuperType() const
+{
+ return BuiltinTypes::item;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/type/qnonetype_p.h b/src/xmlpatterns/type/qnonetype_p.h
new file mode 100644
index 0000000..f68d27d
--- /dev/null
+++ b/src/xmlpatterns/type/qnonetype_p.h
@@ -0,0 +1,155 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_NoneType_H
+#define Patternist_NoneType_H
+
+#include "qatomictype_p.h"
+#include "qsequencetype_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+
+ /**
+ * @short Represents the special <tt>none</tt> type.
+ *
+ * @ingroup Patternist_types
+ * @see <a href="http://www.w3.org/TR/xquery-semantics/#sec_content_models">XQuery 1.0 and
+ * XPath 2.0 Formal Semantics, 2.4.3 Content models</a>
+ * @see <a href="http://www.w3.org/TR/xquery-semantics/#sec_fnerror">XQuery 1.0 and XPath 2.0
+ * Formal Semantics, 7.2.9 The fn:error function</a>
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class NoneType : public ItemType,
+ public SequenceType
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<NoneType> Ptr;
+
+ virtual bool itemMatches(const Item &item) const;
+ virtual bool xdtTypeMatches(const ItemType::Ptr &other) const;
+
+ /**
+ * @returns always "none". That is, no namespace prefix
+ */
+ virtual QString displayName(const NamePool::Ptr &np) const;
+
+ /**
+ * @note The semantical meaning of this type's item type can
+ * surely be discussed. The function is provided due to
+ * it being mandated by the SequenceType base class.
+ *
+ * @returns always 'this' since NoneType is also an ItemType
+ */
+ virtual ItemType::Ptr itemType() const;
+
+ /**
+ * @note The semantical meaning of this type's cardinality
+ * can surely be discussed. The function is provided due to
+ * it being mandated by the SequenceType base class.
+ *
+ * @returns always Cardinality::zeroOrMore()
+ */
+ virtual Cardinality cardinality() const;
+
+ /**
+ * @returns always @c false
+ */
+ virtual bool isAtomicType() const;
+
+ /**
+ * This can be thought to be a weird function for this type(none). There
+ * is no atomized type for none, perhaps the best from a conceptual perspective
+ * would be to return @c null.
+ *
+ * This function returns BuiltinTypes::xsAnyAtomicType because
+ * the generic type checking code inserts an Atomizer in the AST
+ * when an error() function(or other node which has type none) is part of
+ * an operator expression(value/general comparison, arithmetics). The Atomizer
+ * returns the atomizedType() of its child, and by here returning xsAnyAtomicType,
+ * static operator lookup is postponed to runtime. Subsequently, expressions like error()
+ * works properly with other XPath expressions.
+ */
+ virtual ItemType::Ptr atomizedType() const;
+
+ /**
+ * @returns always @c false
+ */
+ virtual bool isNodeType() const;
+
+ /**
+ * @returns always item()
+ */
+ virtual ItemType::Ptr xdtSuperType() const;
+
+ /**
+ * @returns always @p other. The none type can be thought as
+ * disappearing when attempting to find the union of it and
+ * another type.
+ */
+ virtual const ItemType &operator|(const ItemType &other) const;
+
+ protected:
+
+ friend class CommonSequenceTypes;
+ NoneType();
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/type/qnumerictype.cpp b/src/xmlpatterns/type/qnumerictype.cpp
new file mode 100644
index 0000000..bfcb6d0
--- /dev/null
+++ b/src/xmlpatterns/type/qnumerictype.cpp
@@ -0,0 +1,142 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qatomictype_p.h"
+#include "qbuiltintypes_p.h"
+#include "qitem_p.h"
+#include "qschematype_p.h"
+
+#include "qnumerictype_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+NumericType::NumericType()
+{
+}
+
+NumericType::~NumericType()
+{
+}
+
+bool NumericType::itemMatches(const Item &item) const
+{
+ if(item.isNode())
+ return false;
+
+ return BuiltinTypes::xsDouble->itemMatches(item) ||
+ BuiltinTypes::xsDecimal->itemMatches(item) ||
+ BuiltinTypes::xsFloat->itemMatches(item);
+}
+
+bool NumericType::xdtTypeMatches(const ItemType::Ptr &t) const
+{
+ return BuiltinTypes::xsDouble->xdtTypeMatches(t) ||
+ BuiltinTypes::xsDecimal->xdtTypeMatches(t) ||
+ BuiltinTypes::xsFloat->xdtTypeMatches(t) ||
+ *t == *this; /* If it's NumericType */
+}
+
+QString NumericType::displayName(const NamePool::Ptr &) const
+{
+ return QLatin1String("numeric");
+}
+
+SchemaType::Ptr NumericType::wxsSuperType() const
+{
+ return BuiltinTypes::xsAnyAtomicType;
+}
+
+ItemType::Ptr NumericType::xdtSuperType() const
+{
+ return BuiltinTypes::xsAnyAtomicType;
+}
+
+bool NumericType::isAbstract() const
+{
+ return true;
+}
+
+bool NumericType::isNodeType() const
+{
+ return false;
+}
+
+bool NumericType::isAtomicType() const
+{
+ return true;
+}
+
+ItemType::Ptr NumericType::atomizedType() const
+{
+ return AtomicType::Ptr();
+}
+
+AtomicTypeVisitorResult::Ptr NumericType::accept(const AtomicTypeVisitor::Ptr &,
+ const SourceLocationReflection *const) const
+{
+ return AtomicTypeVisitorResult::Ptr();
+}
+
+AtomicTypeVisitorResult::Ptr NumericType::accept(const ParameterizedAtomicTypeVisitor::Ptr &,
+ const qint16,
+ const SourceLocationReflection *const) const
+{
+ return AtomicTypeVisitorResult::Ptr();
+}
+
+AtomicComparatorLocator::Ptr NumericType::comparatorLocator() const
+{
+ return AtomicComparatorLocator::Ptr();
+}
+
+AtomicMathematicianLocator::Ptr NumericType::mathematicianLocator() const
+{
+ return AtomicMathematicianLocator::Ptr();
+}
+
+AtomicCasterLocator::Ptr NumericType::casterLocator() const
+{
+ return AtomicCasterLocator::Ptr();
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/type/qnumerictype_p.h b/src/xmlpatterns/type/qnumerictype_p.h
new file mode 100644
index 0000000..69c683a
--- /dev/null
+++ b/src/xmlpatterns/type/qnumerictype_p.h
@@ -0,0 +1,174 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_NumericType_H
+#define Patternist_NumericType_H
+
+#include "qatomictype_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short Represents the internal and abstract type @c fs:numeric.
+ *
+ * @see <a href="http://www.w3.org/TR/xquery-semantics/#dt-fs_numeric">XQuery 1.0
+ * and XPath 2.0 Formal Semantics, Definition: fs:numeric</a>
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class NumericType : public AtomicType
+ {
+ public:
+ virtual ~NumericType();
+
+ virtual bool itemMatches(const Item &item) const;
+ virtual bool xdtTypeMatches(const ItemType::Ptr &other) const;
+
+ /**
+ * @returns always "numeric". That is, no namespace prefix
+ */
+ virtual QString displayName(const NamePool::Ptr &np) const;
+
+ /**
+ * @returns always @c true
+ */
+ virtual bool isAbstract() const;
+
+ /**
+ * @returns always @c false
+ */
+ virtual bool isNodeType() const;
+
+ /**
+ * @returns always @c true
+ */
+ virtual bool isAtomicType() const;
+
+ /**
+ * @returns always xs:anyAtomicType
+ */
+ virtual SchemaType::Ptr wxsSuperType() const;
+
+ /**
+ * @returns always xs:anyAtomicType
+ */
+ virtual ItemType::Ptr xdtSuperType() const;
+
+ /**
+ * @returns @c null. It makes no sense to atomize the abstract type @c fs:numeric.
+ */
+ virtual ItemType::Ptr atomizedType() const;
+
+ /**
+ * NumericType cannot be visited. This function is only implemented
+ * to satisfy the abstract super class's interface.
+ *
+ * @returns always a @c null pointer
+ */
+ virtual AtomicTypeVisitorResult::Ptr accept(const AtomicTypeVisitor::Ptr &visitor,
+ const SourceLocationReflection *const) const;
+
+ /**
+ * NumericType cannot be visited. This function is only implemented
+ * to satisfy the abstract super class's interface.
+ *
+ * @returns always a @c null pointer
+ */
+ virtual AtomicTypeVisitorResult::Ptr accept(const ParameterizedAtomicTypeVisitor::Ptr &visitor,
+ const qint16 op,
+ const SourceLocationReflection *const) const;
+
+ /**
+ * The type @c fs:numeric is an abstract type which therefore
+ * cannot be involved in comparisons. Hence, this function returns
+ * @c null. This function is only implemented to satisfy the abstract
+ * super class's interface.
+ *
+ * @returns always a @c null pointer
+ */
+ virtual AtomicComparatorLocator::Ptr comparatorLocator() const;
+
+ /**
+ * The type @c fs:numeric is an abstract type which therefore
+ * cannot be involved in arithmetics. Hence, this function returns
+ * @c null. This function is only implemented to satisfy the abstract
+ * super class's interface.
+ *
+ * @returns always a @c null pointer
+ */
+ virtual AtomicMathematicianLocator::Ptr mathematicianLocator() const;
+
+
+ /**
+ * The type @c fs:numeric is an abstract type which therefore
+ * cannot be involved in casting. Hence, this function returns
+ * @c null. This function is only implemented to satisfy the abstract
+ * super class's interface.
+ *
+ * @returns always a @c null pointer
+ */
+ virtual AtomicCasterLocator::Ptr casterLocator() const;
+
+ protected:
+ friend class BuiltinTypes;
+ NumericType();
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/type/qprimitives_p.h b/src/xmlpatterns/type/qprimitives_p.h
new file mode 100644
index 0000000..ebbebcc
--- /dev/null
+++ b/src/xmlpatterns/type/qprimitives_p.h
@@ -0,0 +1,203 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_Primitives_H
+#define Patternist_Primitives_H
+
+#include <QtGlobal>
+#include <QtCore/QHash>
+#include <QtCore/QUrl>
+
+/**
+ * @file
+ * @short Contains enumerators and typedefs applying
+ * for Patternist on a global scale, as well as central documentation.
+ */
+
+/**
+ * @short Contains Patternist, an XPath 2.0, XQuery 1.0 and XSL-T 2.0 implementation.
+ *
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+class QString;
+
+/**
+ * @short The namespace for the internal API of QtXmlPatterns
+ * @internal
+ */
+namespace QPatternist
+{
+ /**
+ * @defgroup Patternist_cppWXSTypes C++ Primitives for W3C XML Schema Number Types
+ *
+ * The implementations of W3C XML Schema's(WXS) number types, more specifically
+ * their value spaces, must in the end be represented by primitive C++ types.
+ * In addition, there is an extensive range of functions and classes that in
+ * different ways deals with data that will end up as instances of the WXS
+ * types. For this reason, a set of typedefs for these primitives exists, that
+ * are used throughout the API. This ensures consistency, reduces the amount
+ * of conversions, and potentially precision loss in conversions.
+ *
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+
+ /**
+ * This is the native C++ scalar type holding the value space
+ * for atomic values of type xs:double. Taking this type, xsDouble,
+ * as parameter, is the most efficient way to integrate with xs:double.
+ *
+ * @ingroup Patternist_cppWXSTypes
+ */
+ typedef qreal xsDouble;
+
+ /**
+ * This is the native C++ scalar type holding the value space
+ * for atomic values of type xs:float. Taking this type, xsFloat,
+ * as parameter, is the most efficient way to integrate with xs:float.
+ *
+ * @ingroup Patternist_cppWXSTypes
+ */
+ typedef xsDouble xsFloat;
+
+ /**
+ * This is the native C++ scalar type holding the value space
+ * for atomic values of type xs:decimal. Taking this type, xsDecimal,
+ * as parameter, is the most efficient way to integrate with xs:decimal.
+ *
+ * @ingroup Patternist_cppWXSTypes
+ */
+ typedef xsDouble xsDecimal;
+
+ /**
+ * This is the native C++ scalar type holding the value space
+ * for atomic values of type xs:integer. Taking this type, xsInteger,
+ * as parameter, is the most efficient way to integrate with xs:integer.
+ *
+ * @ingroup Patternist_cppWXSTypes
+ */
+ typedef qint64 xsInteger;
+
+ /**
+ * This is the native C++ scalar type holding the value space
+ * for atomic values of type xs:integer. Taking this type, xsInteger,
+ * as parameter, is the most efficient way to integrate with xs:integer.
+ *
+ * @ingroup Patternist_cppWXSTypes
+ */
+ typedef qint32 VariableSlotID;
+
+ typedef qint32 DayCountProperty;
+ typedef qint32 HourCountProperty;
+ typedef qint32 MinuteCountProperty;
+ typedef qint32 MonthCountProperty;
+ typedef qint32 SecondCountProperty;
+ typedef qint64 MSecondCountProperty;
+ typedef qint32 SecondProperty;
+ typedef qint32 YearProperty;
+ typedef qint8 DayProperty;
+ typedef qint8 HourProperty;
+ typedef qint8 MinuteProperty;
+ typedef qint8 MonthProperty;
+
+ /**
+ * Milliseconds. 1 equals 0.001 SecondProperty.
+ */
+ typedef qint16 MSecondProperty;
+
+ /**
+ * The hour property of a zone offset. For example, -13 in the
+ * zone offset "-13:08".
+ */
+ typedef qint8 ZOHourProperty;
+
+ /**
+ * The minute property of a zone offset. For example, -08 in the
+ * zone offset "-13:08".
+ */
+ typedef qint8 ZOMinuteProperty;
+
+ /**
+ * The full zone offset in minutes.
+ */
+ typedef qint32 ZOTotal;
+
+ typedef xsDouble PatternPriority;
+
+ /**
+ * Signifies the import precedence of a template. For instance, the first
+ * stylesheet module has 1, the first import 2, and so forth. Smaller means
+ * higher import precedence. 0 is reserved for builtin templates.
+ */
+ typedef int ImportPrecedence;
+
+ /**
+ * @short Similar to Qt::escape(), but also escapes apostrophes and quotes,
+ * such that the result is suitable as attribute content too.
+ *
+ * Since Qt::escape() is in QtGui, using it creates a dependency on that
+ * library. This function does not.
+ *
+ * The implementation resides in qpatternistlocale.cpp.
+ *
+ * @see Qt::escape()
+ */
+ QString Q_AUTOTEST_EXPORT escape(const QString &input);
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/type/qqnametest.cpp b/src/xmlpatterns/type/qqnametest.cpp
new file mode 100644
index 0000000..5acead6
--- /dev/null
+++ b/src/xmlpatterns/type/qqnametest.cpp
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QHash>
+
+#include "qbuiltintypes_p.h"
+#include "qitem_p.h"
+#include "qitem_p.h"
+
+#include "qqnametest_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+QNameTest::QNameTest(const ItemType::Ptr &primaryType,
+ const QXmlName qName) : AbstractNodeTest(primaryType)
+ , m_qName(qName)
+{
+ Q_ASSERT(!qName.isNull());
+}
+
+ItemType::Ptr QNameTest::create(const ItemType::Ptr &primaryType, const QXmlName qName)
+{
+ Q_ASSERT(!qName.isNull());
+ Q_ASSERT(primaryType);
+
+ return ItemType::Ptr(new QNameTest(primaryType, qName));
+}
+
+bool QNameTest::itemMatches(const Item &item) const
+{
+ Q_ASSERT(item.isNode());
+ return m_primaryType->itemMatches(item) &&
+ item.asNode().name() == m_qName;
+}
+
+QString QNameTest::displayName(const NamePool::Ptr &np) const
+{
+ QString displayOther(m_primaryType->displayName(np));
+
+ return displayOther.insert(displayOther.size() - 1, np->displayName(m_qName));
+}
+
+ItemType::InstanceOf QNameTest::instanceOf() const
+{
+ return ClassQNameTest;
+}
+
+bool QNameTest::operator==(const ItemType &other) const
+{
+ return other.instanceOf() == ClassQNameTest &&
+ static_cast<const QNameTest &>(other).m_qName == m_qName;
+}
+
+PatternPriority QNameTest::patternPriority() const
+{
+ return 0;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/type/qqnametest_p.h b/src/xmlpatterns/type/qqnametest_p.h
new file mode 100644
index 0000000..29639ed
--- /dev/null
+++ b/src/xmlpatterns/type/qqnametest_p.h
@@ -0,0 +1,103 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_QNameTest_H
+#define Patternist_QNameTest_H
+
+#include "qabstractnodetest_p.h"
+
+template<typename Key, typename Value> class QHash;
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short A name test that is of the type <tt>prefix:ncName</tt>.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class QNameTest : public AbstractNodeTest
+ {
+ public:
+ typedef QHash<QString, QNameTest::Ptr> Hash;
+
+ static ItemType::Ptr create(const ItemType::Ptr &primaryType, const QXmlName qName);
+
+ /**
+ * @note This function assumes that @p item is a QXmlNodeModelIndex.
+ */
+ virtual bool itemMatches(const Item &item) const;
+
+ virtual QString displayName(const NamePool::Ptr &np) const;
+
+ virtual bool operator==(const ItemType &other) const;
+
+ virtual PatternPriority patternPriority() const;
+
+ protected:
+ virtual InstanceOf instanceOf() const;
+
+ private:
+ QNameTest(const ItemType::Ptr &primaryType, const QXmlName qName);
+
+ const QXmlName m_qName;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/type/qschemacomponent.cpp b/src/xmlpatterns/type/qschemacomponent.cpp
new file mode 100644
index 0000000..4bd64b8
--- /dev/null
+++ b/src/xmlpatterns/type/qschemacomponent.cpp
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qschemacomponent_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+SchemaComponent::SchemaComponent()
+{
+}
+
+SchemaComponent::~SchemaComponent()
+{
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/type/qschemacomponent_p.h b/src/xmlpatterns/type/qschemacomponent_p.h
new file mode 100644
index 0000000..15567eb
--- /dev/null
+++ b/src/xmlpatterns/type/qschemacomponent_p.h
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_SchemaComponent_H
+#define Patternist_SchemaComponent_H
+
+#include <QSharedData>
+#include <QtGlobal>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short Base class for all constructs that can appear in a W3C XML Schema.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class SchemaComponent : public virtual QSharedData
+ {
+ public:
+ SchemaComponent();
+ virtual ~SchemaComponent();
+
+ private:
+ Q_DISABLE_COPY(SchemaComponent)
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/type/qschematype.cpp b/src/xmlpatterns/type/qschematype.cpp
new file mode 100644
index 0000000..61e1b48
--- /dev/null
+++ b/src/xmlpatterns/type/qschematype.cpp
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qschematype_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+SchemaType::SchemaType()
+{
+}
+
+SchemaType::~SchemaType()
+{
+}
+
+bool SchemaType::isSimpleType() const
+{
+ switch(category())
+ {
+ /* Fallthrough */
+ case SimpleTypeAtomic:
+ case SimpleTypeList:
+ case SimpleTypeUnion:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool SchemaType::isComplexType() const
+{
+ return category() == ComplexType;
+}
+
+bool SchemaType::isDefinedBySchema() const
+{
+ return false;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/type/qschematype_p.h b/src/xmlpatterns/type/qschematype_p.h
new file mode 100644
index 0000000..bd84ab0
--- /dev/null
+++ b/src/xmlpatterns/type/qschematype_p.h
@@ -0,0 +1,248 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_SchemaType_H
+#define Patternist_SchemaType_H
+
+#include "qnamepool_p.h"
+#include "qschemacomponent_p.h"
+#include "qxmlname.h"
+
+template<typename N, typename M> class QHash;
+template<typename N> class QList;
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ class AtomicType;
+
+ /**
+ * @short Base class for W3C XML Schema types.
+ *
+ * This is the base class of all data types in a W3C XML Schema.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class SchemaType : public SchemaComponent
+ {
+ public:
+
+ typedef QExplicitlySharedDataPointer<SchemaType> Ptr;
+ typedef QHash<QXmlName, SchemaType::Ptr> Hash;
+ typedef QList<SchemaType::Ptr> List;
+
+ /**
+ * Schema types are divided into different categories such as
+ * complex type, atomic imple type, union simple type, and so forth. This
+ * enumerator, which category() returns a value of, identifies what
+ * category the type belong to.
+ *
+ * @todo Add docs & links for the enums
+ */
+ enum TypeCategory
+ {
+ None = 0,
+ /**
+ * A simple atomic type. These are also sometimes
+ * referred to as primitive types. An example of this type is
+ * xs:string.
+ *
+ * Formally speaking, a simple type with variety atomic.
+ */
+ SimpleTypeAtomic,
+ SimpleTypeList,
+ SimpleTypeUnion,
+ ComplexType
+ };
+
+ enum DerivationMethod
+ {
+ DerivationRestriction = 1,
+ DerivationExtension = 2,
+ DerivationUnion = 4,
+ DerivationList = 8,
+ /**
+ * Used for <tt>xs:anyType</tt>.
+ */
+ NoDerivation = 16
+ };
+
+ /**
+ * Describes the derivation constraints that are given by the 'final' or 'block' attributes.
+ */
+ enum DerivationConstraint
+ {
+ RestrictionConstraint = 1,
+ ExtensionConstraint = 2,
+ ListConstraint = 4,
+ UnionConstraint = 8
+ };
+ Q_DECLARE_FLAGS(DerivationConstraints, DerivationConstraint)
+
+ SchemaType();
+ virtual ~SchemaType();
+
+ /**
+ * Determines how this SchemaType is derived from its super type.
+ *
+ * @note Despite that DerivationMethod is designed for being
+ * used for bitwise OR'd value, this function may only return one enum
+ * value. If the type does not derive from any type, which is the case of
+ * <tt>xs:anyType</tt>, this function returns NoDerivation.
+ *
+ * @see SchemaType::wxsSuperType()
+ * @see <a href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#TypeInfo-DerivationMethods">Document
+ * Object Model (DOM) Level 3 Core Specification, Definition group DerivationMethods</a>
+ * @returns a DerivationMethod enumerator signifiying how
+ * this SchemaType is derived from its base type
+ */
+ virtual DerivationMethod derivationMethod() const = 0;
+
+ /**
+ * Determines what derivation constraints exists for the type.
+ */
+ virtual DerivationConstraints derivationConstraints() const = 0;
+
+ /**
+ * Determines whether the type is an abstract type.
+ *
+ * @note It is important a correct value is returned, since
+ * abstract types must not be instantiated.
+ */
+ virtual bool isAbstract() const = 0;
+
+ /**
+ * @short Returns the name of the type.
+ *
+ * The reason to why we take the name pool argument, is that the basic
+ * types, @c xs:anySimpleType and so on, are stored globally in
+ * BuiltinTypes and ComonSequenceTypes, and therefore cannot be tied to
+ * a certain name pool. Type instances that knows they always will be
+ * used with a certain name pool, can therefore ignore @p np and return
+ * a QXmlName instance stored as a member.
+ *
+ * If the type code was refactored to not be store globally and
+ * therefore by design would be tied to a name pool, this argument could
+ * be removed.
+ */
+ virtual QXmlName name(const NamePool::Ptr &np) const = 0;
+
+ /**
+ * @short Returns a suitable display name for this type.
+ *
+ * See name() for an explanation to why we take a NamePool as argument.
+ */
+ virtual QString displayName(const NamePool::Ptr &np) const = 0;
+
+ /**
+ * @returns the W3C XML Schema base type that this type derives from. All types
+ * returns an instance, except for the xs:anyType since it
+ * is the very base type of all types, and it returns 0. Hence,
+ * one can walk the hierarchy of a schema type by recursively calling
+ * wxsSuperType, until zero is returned.
+ *
+ * This function walks the Schema hierarchy. Some simple types, the atomic types,
+ * is also part of the XPath Data Model hierarchy, and their super type in that
+ * hierarchy can be introspected with xdtSuperType().
+ *
+ * wxsSuperType() can be said to correspond to the {base type definition} property
+ * in the Post Schema Valid Infoset(PSVI).
+ *
+ * @see ItemType::xdtSuperType()
+ */
+ virtual SchemaType::Ptr wxsSuperType() const = 0;
+
+ /**
+ * @returns @c true if @p other is identical to 'this' schema type or if @p other
+ * is either directly or indirectly a base type of 'this'. Hence, calling
+ * AnyType::wxsTypeMatches() with @p other as argument returns @c true for all types,
+ * since all types have @c xs:anyType as super type.
+ */
+ virtual bool wxsTypeMatches(const SchemaType::Ptr &other) const = 0;
+
+ virtual TypeCategory category() const = 0;
+
+ /**
+ * Determines whether the type is a simple type, by introspecting
+ * the result of category().
+ *
+ * @note Do not re-implement this function, but instead override category()
+ * and let it return an appropriate value.
+ */
+ virtual bool isSimpleType() const;
+
+ /**
+ * Determines whether the type is a complex type, by introspecting
+ * the result of category().
+ *
+ * @note Do not re-implement this function, but instead override category()
+ * and let it return an appropriate value.
+ */
+ virtual bool isComplexType() const;
+
+ /**
+ * Returns whether the value has been defined by a schema (is not a built in type).
+ */
+ virtual bool isDefinedBySchema() const;
+ };
+
+ Q_DECLARE_OPERATORS_FOR_FLAGS(SchemaType::DerivationConstraints)
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/type/qschematypefactory.cpp b/src/xmlpatterns/type/qschematypefactory.cpp
new file mode 100644
index 0000000..a138c59
--- /dev/null
+++ b/src/xmlpatterns/type/qschematypefactory.cpp
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qschematypefactory_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+SchemaTypeFactory::SchemaTypeFactory()
+{
+}
+
+SchemaTypeFactory::~SchemaTypeFactory()
+{
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/type/qschematypefactory_p.h b/src/xmlpatterns/type/qschematypefactory_p.h
new file mode 100644
index 0000000..b7e646f
--- /dev/null
+++ b/src/xmlpatterns/type/qschematypefactory_p.h
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_SchemaTypeFactory_H
+#define Patternist_SchemaTypeFactory_H
+
+#include <QSharedData>
+
+#include "qreportcontext_p.h"
+#include "qitemtype_p.h"
+#include "qschematype_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short A factory creating schema types.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class SchemaTypeFactory : public QSharedData
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<SchemaTypeFactory> Ptr;
+
+ SchemaTypeFactory();
+ virtual ~SchemaTypeFactory();
+
+ /**
+ * @returns a schema type for name @p name. If no schema type exists for @p name, @c null
+ * is returned
+ */
+ virtual SchemaType::Ptr createSchemaType(const QXmlName name) const = 0;
+
+ /**
+ * @returns a dictionary containing the types this factory serves. The key
+ * is the type's QName in Clark name syntax.
+ */
+ virtual SchemaType::Hash types() const = 0;
+
+ private:
+ Q_DISABLE_COPY(SchemaTypeFactory)
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/type/qsequencetype.cpp b/src/xmlpatterns/type/qsequencetype.cpp
new file mode 100644
index 0000000..29d9bb6
--- /dev/null
+++ b/src/xmlpatterns/type/qsequencetype.cpp
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qsequencetype_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+SequenceType::~SequenceType()
+{
+}
+
+bool SequenceType::matches(const SequenceType::Ptr other) const
+{
+ Q_ASSERT(other);
+
+ return itemType()->xdtTypeMatches(other->itemType()) &&
+ cardinality().isMatch(other->cardinality());
+}
+
+bool SequenceType::is(const SequenceType::Ptr &other) const
+{
+ return matches(other) && other->matches(Ptr(this));
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/type/qsequencetype_p.h b/src/xmlpatterns/type/qsequencetype_p.h
new file mode 100644
index 0000000..969e587
--- /dev/null
+++ b/src/xmlpatterns/type/qsequencetype_p.h
@@ -0,0 +1,138 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_SequenceType_H
+#define Patternist_SequenceType_H
+
+template<typename T> class QList;
+
+#include <QSharedData>
+
+#include "qcardinality_p.h"
+#include "qitemtype_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ class ItemType;
+
+ /**
+ * @short A SequenceType instance represents the type of a sequence of Item
+ * instances.
+ *
+ * It carries a Cardinality and ItemType, and is hence conceptually
+ * identical to the SequenceType EBNF construct.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ * @see <a href="http://www.w3.org/TR/xpath20/#id-sequencetype-syntax">XML
+ * Path Language (XPath) 2.0, 2.5.3 SequenceType Syntax</a>
+ */
+ class SequenceType : public virtual QSharedData
+ {
+ public:
+ inline SequenceType()
+ {
+ }
+
+ /**
+ * A smart pointer wrapping SequenceType instances.
+ */
+ typedef QExplicitlySharedDataPointer<const SequenceType> Ptr;
+
+ /**
+ * A list of SequenceType instances, each wrapped in a smart pointer.
+ */
+ typedef QList<SequenceType::Ptr> List;
+
+ virtual ~SequenceType();
+
+ /**
+ * Generates a name for the sequence type for display purposes. The
+ * prefix used for the QName identifying the schema type is conventional.
+ * An example of a display name for a SequenceType is "xs:integer?".
+ */
+ virtual QString displayName(const NamePool::Ptr &np) const = 0;
+
+ virtual Cardinality cardinality() const = 0;
+
+ virtual ItemType::Ptr itemType() const = 0;
+
+ /**
+ * Determines whether @p other is identical to, or a sub-type
+ * of this SequenceType. For example, if this SequenceType is
+ * <tt>xs:anyAtomicType</tt>, @c false is returned if @p other is <tt>element()</tt>,
+ * but @c true if @p other is <tt>xs:string</tt>.
+ *
+ * The return values of cardinality() and itemType() used with ItemType::xdtTypeMatches
+ * and Cardinality::isWithinScope() is used for achieving this.
+ *
+ * @see <a href="http://www.w3.org/TR/xquery/#id-sequencetype-matching">XQuery 1.0:
+ * An XML Query Language, 2.5.4 SequenceType Matching</a>
+ */
+ bool matches(const SequenceType::Ptr other) const;
+
+ bool is(const SequenceType::Ptr &other) const;
+ private:
+ Q_DISABLE_COPY(SequenceType)
+ };
+}
+
+Q_DECLARE_TYPEINFO(QPatternist::SequenceType::Ptr, Q_MOVABLE_TYPE);
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/type/qtypechecker.cpp b/src/xmlpatterns/type/qtypechecker.cpp
new file mode 100644
index 0000000..ffc947b
--- /dev/null
+++ b/src/xmlpatterns/type/qtypechecker.cpp
@@ -0,0 +1,296 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qargumentconverter_p.h"
+#include "qatomictype_p.h"
+#include "qatomizer_p.h"
+#include "qbuiltintypes_p.h"
+#include "qcardinalityverifier_p.h"
+#include "qcommonsequencetypes_p.h"
+#include "qfunctionfactory_p.h"
+#include "qitemverifier_p.h"
+#include "qpatternistlocale_p.h"
+#include "quntypedatomicconverter_p.h"
+
+#include "qtypechecker_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+QString TypeChecker::wrongType(const NamePool::Ptr &np,
+ const ItemType::Ptr &reqType,
+ const ItemType::Ptr &opType)
+{
+ return QtXmlPatterns::tr("Required type is %1, but %2 was found.")
+ .arg(formatType(np, reqType), formatType(np, opType));
+}
+
+Expression::Ptr TypeChecker::applyFunctionConversion(const Expression::Ptr &operand,
+ const SequenceType::Ptr &reqType,
+ const StaticContext::Ptr &context,
+ const ReportContext::ErrorCode code,
+ const Options options)
+{
+ Q_ASSERT_X(!ReportContext::codeToString(code).isEmpty(), Q_FUNC_INFO,
+ "This test ensures 'code' exists, otherwise codeToString() would assert.");
+ Q_ASSERT(operand);
+ Q_ASSERT(reqType);
+ Q_ASSERT(context);
+
+ /* Do it in two steps: verify type, and then cardinality. */
+ const Expression::Ptr cardVerified(CardinalityVerifier::verifyCardinality(operand, reqType->cardinality(), context, code));
+ return verifyType(cardVerified, reqType, context, code, options);
+}
+
+bool TypeChecker::promotionPossible(const ItemType::Ptr &fromType,
+ const ItemType::Ptr &toType,
+ const StaticContext::Ptr &context)
+{
+ /* These types can be promoted to xs:string. xs:untypedAtomic should be
+ * cast when interpreting it formally, but implementing it as a promotion
+ * gives the same result(and is faster). */
+ if(*toType == *BuiltinTypes::xsString &&
+ (BuiltinTypes::xsUntypedAtomic->xdtTypeMatches(fromType) ||
+ BuiltinTypes::xsAnyURI->xdtTypeMatches(fromType)))
+ return true;
+
+ if(*toType == *BuiltinTypes::xsDouble &&
+ BuiltinTypes::numeric->xdtTypeMatches(fromType))
+ {
+ /* Any numeric can be promoted to xs:double. */
+ return true;
+ }
+
+ /* xs:decimal/xs:integer can be promoted to xs:float. */
+ if(*toType == *BuiltinTypes::xsFloat && BuiltinTypes::xsDecimal->xdtTypeMatches(fromType))
+
+ {
+ context->warning(QtXmlPatterns::tr("Promoting %1 to %2 may cause loss of precision.")
+ .arg(formatType(context->namePool(), fromType))
+ .arg(formatType(context->namePool(), BuiltinTypes::xsFloat)));
+ return true;
+ }
+
+ return false;
+}
+
+Expression::Ptr TypeChecker::typeCheck(Expression *const op,
+ const StaticContext::Ptr &context,
+ const SequenceType::Ptr &reqType)
+{
+ return Expression::Ptr(op->typeCheck(context, reqType));
+}
+
+Expression::Ptr TypeChecker::verifyType(const Expression::Ptr &operand,
+ const SequenceType::Ptr &reqSeqType,
+ const StaticContext::Ptr &context,
+ const ReportContext::ErrorCode code,
+ const Options options)
+{
+ const ItemType::Ptr reqType(reqSeqType->itemType());
+ const Expression::Properties props(operand->properties());
+
+ /* If operand requires a focus, do the necessary type checking for that. */
+ if(props.testFlag(Expression::RequiresFocus) && options.testFlag(CheckFocus))
+ {
+ const ItemType::Ptr contextType(context->contextItemType());
+ if(contextType)
+ {
+ if(props.testFlag(Expression::RequiresContextItem))
+ {
+ Q_ASSERT_X(operand->expectedContextItemType(), Q_FUNC_INFO,
+ "When the Expression sets the RequiresContextItem property, it must "
+ "return a type in expectedContextItemType()");
+ const ItemType::Ptr expectedContextType(operand->expectedContextItemType());
+
+ /* Allow the empty sequence. We don't want to trigger XPTY0020 on ()/... . */
+ if(!expectedContextType->xdtTypeMatches(contextType) && contextType != CommonSequenceTypes::Empty)
+ {
+ context->error(wrongType(context->namePool(), operand->expectedContextItemType(), contextType),
+ ReportContext::XPTY0020, operand.data());
+ return operand;
+ }
+ }
+ }
+ else
+ {
+ context->error(QtXmlPatterns::tr("The focus is undefined."), ReportContext::XPDY0002, operand.data());
+ return operand;
+ }
+ }
+
+ SequenceType::Ptr operandSeqType(operand->staticType());
+ ItemType::Ptr operandType(operandSeqType->itemType());
+
+ /* This returns the operand if the types are identical or if operandType
+ * is a subtype of reqType. */
+ if(reqType->xdtTypeMatches(operandType) || *operandType == *CommonSequenceTypes::Empty)
+ return operand;
+
+ /* Since we haven't exited yet, it means that the operandType is a super type
+ * of reqType, and that there hence is a path down to it through the
+ * type hierachy -- but that doesn't necessarily mean that a up-cast(down the
+ * hierarchy) would succeed. */
+
+ Expression::Ptr result(operand);
+
+ if(reqType->isAtomicType())
+ {
+ const Expression::ID opID = operand->id();
+ if((opID == Expression::IDArgumentReference ||
+ (opID == Expression::IDCardinalityVerifier && operand->operands().first()->is(Expression::IDArgumentReference)))
+ && *BuiltinTypes::item == *operandType)
+ return Expression::Ptr(new ArgumentConverter(result, reqType));
+
+ if(!operandType->isAtomicType())
+ {
+ result = Expression::Ptr(new Atomizer(result));
+ /* The atomizer might know more about the type. */
+ operandType = result->staticType()->itemType();
+ }
+
+ if(reqType->xdtTypeMatches(operandType))
+ {
+ /* Atomization was sufficient. Either the expected type is xs:anyAtomicType
+ * or the type the Atomizer knows it returns, matches the required type. */
+ return result;
+ }
+
+ const bool compatModeEnabled = context->compatModeEnabled();
+
+ if((options.testFlag(AutomaticallyConvert) && BuiltinTypes::xsUntypedAtomic->xdtTypeMatches(operandType)) ||
+ (compatModeEnabled && BuiltinTypes::xsString->xdtTypeMatches(reqType)))
+ {
+ if(*reqType == *BuiltinTypes::numeric)
+ {
+ result = typeCheck(new UntypedAtomicConverter(result, BuiltinTypes::xsDouble, code),
+ context, reqSeqType);
+ }
+ else
+ result = typeCheck(new UntypedAtomicConverter(result, reqType, code), context, reqSeqType);
+
+ /* The UntypedAtomicConverter might know more about the type, so reload. */
+ operandType = result->staticType()->itemType();
+ }
+ else if(compatModeEnabled && *reqType == *BuiltinTypes::xsDouble)
+ {
+ const FunctionFactory::Ptr functions(context->functionSignatures());
+ Expression::List numberArgs;
+ numberArgs.append(operand);
+
+ result = functions->createFunctionCall(QXmlName(StandardNamespaces::fn, StandardLocalNames::number),
+ numberArgs,
+ context,
+ operand.data())->typeCheck(context, reqSeqType);
+ operandType = result->staticType()->itemType();
+ context->wrapExpressionWith(operand.data(), result);
+ }
+
+ if(reqType->xdtTypeMatches(operandType))
+ return result;
+
+ /* Test if promotion will solve it; the xdtTypeMatches didn't
+ * do that. */
+ if(options.testFlag(AutomaticallyConvert) && promotionPossible(operandType, reqType, context))
+ {
+ if(options.testFlag(GeneratePromotion))
+ return Expression::Ptr(new UntypedAtomicConverter(result, reqType));
+ else
+ return result;
+ }
+
+ if(operandType->xdtTypeMatches(reqType))
+ {
+ /* For example, operandType is numeric, and reqType is xs:integer. */
+ return Expression::Ptr(new ItemVerifier(result, reqType, code));
+ }
+ else
+ {
+ context->error(wrongType(context->namePool(), reqType, operandType), code, operand.data());
+ return result;
+ }
+ }
+ else if(reqType->isNodeType())
+ {
+
+ ReportContext::ErrorCode myCode;
+
+ if(*reqType == *CommonSequenceTypes::EBV->itemType())
+ myCode = ReportContext::FORG0006;
+ else
+ myCode = code;
+
+ /* empty-sequence() is considered valid because it's ok to do
+ * for example nilled( () ). That is, to pass an empty sequence to a
+ * function requiring for example node()?. */
+ if(*operandType == *CommonSequenceTypes::Empty)
+ return result;
+ else if(!operandType->xdtTypeMatches(reqType))
+ {
+ context->error(wrongType(context->namePool(), reqType, operandType), myCode, operand.data());
+ return result;
+ }
+
+ /* Operand must be an item. Thus, the sequence can contain both
+ * nodes and atomic values: we have to verify. */
+ return Expression::Ptr(new ItemVerifier(result, reqType, myCode));
+ }
+ else
+ {
+ Q_ASSERT(*reqType == *CommonSequenceTypes::Empty);
+
+ /* element() doesn't match empty-sequence(), but element()* does. */
+ if(!reqType->xdtTypeMatches(operandType) &&
+ !operandSeqType->cardinality().allowsEmpty())
+ {
+ context->error(wrongType(context->namePool(), reqType, operandType),
+ code, operand.data());
+ return result;
+ }
+ }
+
+ /* This line should be reached if required type is
+ * EBVType, and the operand is compatible. */
+ return result;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/type/qtypechecker_p.h b/src/xmlpatterns/type/qtypechecker_p.h
new file mode 100644
index 0000000..7dd1f5f
--- /dev/null
+++ b/src/xmlpatterns/type/qtypechecker_p.h
@@ -0,0 +1,185 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_TypeChecker_H
+#define Patternist_TypeChecker_H
+
+#include "qstaticcontext_p.h"
+#include "qexpression_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short Contains functions that applies Function Conversion Rules and other
+ * kinds of compile-time type checking tasks.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ */
+ class TypeChecker
+ {
+ public:
+ enum Option
+ {
+ /**
+ * @short When set, the function conversion rules are applied.
+ *
+ * For instance, this is type promotion and conversions from @c
+ * xs:untypedAtomic to @c xs:date. This is done for function calls,
+ * but not when binding an expression to a variable.
+ */
+ AutomaticallyConvert = 1,
+
+ /**
+ * @short Whether the focus should be checked or not.
+ *
+ * Sometimes the focus is unknown at the time
+ * applyFunctionConversion() is called, and therefore it is
+ * of interest to post pone the check to later on.
+ */
+ CheckFocus = 2,
+
+ /**
+ * When applyFunctionConversion() is passed AutomaticallyConvert
+ * and promotion is required, such as from @c xs:integer to
+ * @c xs:float, there will be no conversion performed, with the
+ * assumption that the receiver will call Numeric::toFloat() or
+ * similar.
+ *
+ * However, when GeneratePromotion is set, code will be generated
+ * that performs this conversion regardless of what any receiver
+ * do.
+ *
+ * This is useful in the case where one Expression only pipes the
+ * result of another. The only known case of that as of this
+ * writing is when UserFunctionCallsite evaluates its body.
+ */
+ GeneratePromotion
+ };
+ typedef QFlags<Option> Options;
+
+ /**
+ * @short Builds a pipeline of artificial AST nodes that ensures @p operand
+ * conforms to the type @p reqType by applying the Function
+ * Conversion Rules.
+ *
+ * This new Expression is returned, or, if no conversions were necessary,
+ * @p operand as it is.
+ *
+ * applyFunctionConversion() also performs various checks, such as if
+ * @p operand needs the focus and that the focus is defined in the
+ * @p context. These checks are largely guided by @p operand's
+ * Expression::properties().
+ *
+ * @see <a href="http://www.w3.org/TR/xpath20/\#id-function-calls">XML Path
+ * Language (XPath) 2.0, 3.1.5 Function Calls</a>, more specifically the
+ * Function Conversion Rules
+ */
+ static Expression::Ptr
+ applyFunctionConversion(const Expression::Ptr &operand,
+ const SequenceType::Ptr &reqType,
+ const StaticContext::Ptr &context,
+ const ReportContext::ErrorCode code = ReportContext::XPTY0004,
+ const Options = Options(AutomaticallyConvert | CheckFocus));
+ private:
+
+ static inline Expression::Ptr typeCheck(Expression *const op,
+ const StaticContext::Ptr &context,
+ const SequenceType::Ptr &reqType);
+ /**
+ * @short Implements the type checking and promotion part of the Function Conversion Rules.
+ */
+ static Expression::Ptr verifyType(const Expression::Ptr &operand,
+ const SequenceType::Ptr &reqSeqType,
+ const StaticContext::Ptr &context,
+ const ReportContext::ErrorCode code,
+ const Options options);
+
+ /**
+ * Determines whether type promotion is possible from one type to another. False
+ * is returned when a promotion is not possible or if a promotion is not needed(as when
+ * the types are identical), since that can be considered to not be type promotion.
+ *
+ * @returns @c true if @p fromType can be promoted to @p toType.
+ * @see <a href="http://www.w3.org/TR/xpath20/#promotion">XML Path Language
+ * (XPath) 2.0, B.1 Type Promotion</a>
+ */
+ static bool promotionPossible(const ItemType::Ptr &fromType,
+ const ItemType::Ptr &toType,
+ const StaticContext::Ptr &context);
+
+ /**
+ * @short Centralizes a message-string to reduce work for translators
+ * and increase consistency.
+ */
+ static inline QString wrongType(const NamePool::Ptr &np,
+ const ItemType::Ptr &reqType,
+ const ItemType::Ptr &opType);
+
+ /**
+ * No implementation is provided for this constructor. This class
+ * is not supposed to be instantiated.
+ */
+ inline TypeChecker();
+
+ Q_DISABLE_COPY(TypeChecker)
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/type/quntyped.cpp b/src/xmlpatterns/type/quntyped.cpp
new file mode 100644
index 0000000..234b3a9
--- /dev/null
+++ b/src/xmlpatterns/type/quntyped.cpp
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qbuiltintypes_p.h"
+
+#include "quntyped_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+Untyped::Untyped()
+{
+}
+
+SchemaType::Ptr Untyped::wxsSuperType() const
+{
+ return BuiltinTypes::xsAnyType;
+}
+
+QXmlName Untyped::name(const NamePool::Ptr &np) const
+{
+ return np->allocateQName(StandardNamespaces::xs, QLatin1String("untyped"));
+}
+
+ItemType::Ptr Untyped::atomizedType() const
+{
+ return BuiltinTypes::xsUntypedAtomic;
+}
+
+SchemaType::TypeCategory Untyped::category() const
+{
+ return SchemaType::ComplexType;
+}
+
+SchemaType::DerivationMethod Untyped::derivationMethod() const
+{
+ return NoDerivation;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/type/quntyped_p.h b/src/xmlpatterns/type/quntyped_p.h
new file mode 100644
index 0000000..3056050
--- /dev/null
+++ b/src/xmlpatterns/type/quntyped_p.h
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_Untyped_H
+#define Patternist_Untyped_H
+
+#include "qanytype_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ class AtomicType;
+
+ /**
+ * @short Represents the complex W3C XML Schema type <tt>xs:untyped</tt>.
+ *
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ * @see <a href="http://www.w3.org/TR/xpath-datamodel/#types-predefined">XQuery 1.0 and XPath 2.0
+ * Data Model, 2.6.2 Predefined Types</a>
+ */
+ class Untyped : public AnyType
+ {
+ public:
+
+ typedef QExplicitlySharedDataPointer<Untyped> Ptr;
+
+ /**
+ * @returns always BuiltinTypes::xsAnyType.
+ */
+ virtual SchemaType::Ptr wxsSuperType() const;
+
+ virtual QXmlName name(const NamePool::Ptr &np) const;
+
+ /**
+ * @returns always <tt>xs:untypedAtomic</tt>
+ */
+ virtual ItemType::Ptr atomizedType() const;
+
+ /**
+ * @returns always SchemaType::ComplexType
+ */
+ virtual TypeCategory category() const;
+
+ /**
+ * @returns always NoDerivation
+ */
+ virtual DerivationMethod derivationMethod() const;
+
+ protected:
+ friend class BuiltinTypes;
+
+ Untyped();
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/type/qxsltnodetest.cpp b/src/xmlpatterns/type/qxsltnodetest.cpp
new file mode 100644
index 0000000..0ae33e4
--- /dev/null
+++ b/src/xmlpatterns/type/qxsltnodetest.cpp
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qbuiltintypes_p.h"
+#include "qxsltnodetest_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+bool XSLTNodeTest::xdtTypeMatches(const ItemType::Ptr &other) const
+{
+ if(!other->isNodeType())
+ return false;
+
+ return *static_cast<const XSLTNodeTest *>(other.data()) == *this
+ ? true
+ : xdtTypeMatches(other->xdtSuperType());
+}
+
+bool XSLTNodeTest::itemMatches(const Item &item) const
+{
+ Q_ASSERT(item);
+
+ return item.isNode() &&
+ item.asNode().kind() != QXmlNodeModelIndex::Document;
+}
+
+ItemType::Ptr XSLTNodeTest::xdtSuperType() const
+{
+ return BuiltinTypes::node;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/type/qxsltnodetest_p.h b/src/xmlpatterns/type/qxsltnodetest_p.h
new file mode 100644
index 0000000..a3f9204
--- /dev/null
+++ b/src/xmlpatterns/type/qxsltnodetest_p.h
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Patternist_XSLTNodeTest_H
+#define Patternist_XSLTNodeTest_H
+
+#include "qanynodetype_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+
+ /**
+ * @short Represents @c node() in patterns in XSL-T, which
+ * are just like how @c node() usually is, except that it doesn't
+ * match document nodes.
+ *
+ * @see <a href="http://www.w3.org/TR/xslt20/#pattern-semantics">XSL
+ * Transformations (XSLT) Version 2.0, 5.5.3 The Meaning of a Pattern</a>
+ * @ingroup Patternist_types
+ * @author Frans Englich <frans.englich@nokia.com>
+ * @since 4.5
+ */
+ class XSLTNodeTest : public AnyNodeType
+ {
+ public:
+ virtual bool xdtTypeMatches(const ItemType::Ptr &other) const;
+ virtual bool itemMatches(const Item &item) const;
+
+ virtual ItemType::Ptr xdtSuperType() const;
+
+ protected:
+ friend class BuiltinTypes;
+
+ /**
+ * This constructor does nothing, but exists in order to make it impossible to
+ * instantiate this class from anywhere but from BuiltinTypes.
+ */
+ inline XSLTNodeTest()
+ {
+ }
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/type/type.pri b/src/xmlpatterns/type/type.pri
new file mode 100644
index 0000000..5425298
--- /dev/null
+++ b/src/xmlpatterns/type/type.pri
@@ -0,0 +1,72 @@
+HEADERS += $$PWD/qabstractnodetest_p.h \
+ $$PWD/qanyitemtype_p.h \
+ $$PWD/qanynodetype_p.h \
+ $$PWD/qanysimpletype_p.h \
+ $$PWD/qanytype_p.h \
+ $$PWD/qatomiccasterlocator_p.h \
+ $$PWD/qatomiccasterlocators_p.h \
+ $$PWD/qatomiccomparatorlocator_p.h \
+ $$PWD/qatomiccomparatorlocators_p.h \
+ $$PWD/qatomicmathematicianlocator_p.h \
+ $$PWD/qatomicmathematicianlocators_p.h \
+ $$PWD/qatomictypedispatch_p.h \
+ $$PWD/qatomictype_p.h \
+ $$PWD/qbasictypesfactory_p.h \
+ $$PWD/qbuiltinatomictype_p.h \
+ $$PWD/qbuiltinatomictypes_p.h \
+ $$PWD/qbuiltinnodetype_p.h \
+ $$PWD/qbuiltintypes_p.h \
+ $$PWD/qcardinality_p.h \
+ $$PWD/qcommonsequencetypes_p.h \
+ $$PWD/qebvtype_p.h \
+ $$PWD/qemptysequencetype_p.h \
+ $$PWD/qgenericsequencetype_p.h \
+ $$PWD/qitemtype_p.h \
+ $$PWD/qlocalnametest_p.h \
+ $$PWD/qmultiitemtype_p.h \
+ $$PWD/qnamedschemacomponent_p.h \
+ $$PWD/qnamespacenametest_p.h \
+ $$PWD/qnonetype_p.h \
+ $$PWD/qnumerictype_p.h \
+ $$PWD/qprimitives_p.h \
+ $$PWD/qqnametest_p.h \
+ $$PWD/qschemacomponent_p.h \
+ $$PWD/qschematypefactory_p.h \
+ $$PWD/qschematype_p.h \
+ $$PWD/qsequencetype_p.h \
+ $$PWD/qtypechecker_p.h \
+ $$PWD/quntyped_p.h \
+ $$PWD/qxsltnodetest_p.h
+
+SOURCES += $$PWD/qabstractnodetest.cpp \
+ $$PWD/qanyitemtype.cpp \
+ $$PWD/qanynodetype.cpp \
+ $$PWD/qanysimpletype.cpp \
+ $$PWD/qanytype.cpp \
+ $$PWD/qatomiccasterlocator.cpp \
+ $$PWD/qatomiccomparatorlocator.cpp \
+ $$PWD/qatomicmathematicianlocator.cpp \
+ $$PWD/qatomictype.cpp \
+ $$PWD/qbasictypesfactory.cpp \
+ $$PWD/qbuiltinatomictype.cpp \
+ $$PWD/qbuiltinatomictypes.cpp \
+ $$PWD/qcardinality.cpp \
+ $$PWD/qcommonsequencetypes.cpp \
+ $$PWD/qebvtype.cpp \
+ $$PWD/qemptysequencetype.cpp \
+ $$PWD/qgenericsequencetype.cpp \
+ $$PWD/qitemtype.cpp \
+ $$PWD/qlocalnametest.cpp \
+ $$PWD/qmultiitemtype.cpp \
+ $$PWD/qnamedschemacomponent.cpp \
+ $$PWD/qnamespacenametest.cpp \
+ $$PWD/qnonetype.cpp \
+ $$PWD/qnumerictype.cpp \
+ $$PWD/qqnametest.cpp \
+ $$PWD/qschemacomponent.cpp \
+ $$PWD/qschematype.cpp \
+ $$PWD/qschematypefactory.cpp \
+ $$PWD/qsequencetype.cpp \
+ $$PWD/qtypechecker.cpp \
+ $$PWD/quntyped.cpp \
+ $$PWD/qxsltnodetest.cpp