summaryrefslogtreecommitdiffstats
path: root/src/xmlpatterns/data
diff options
context:
space:
mode:
authorJason Barron <jbarron@trolltech.com>2009-07-24 09:45:33 (GMT)
committerJason Barron <jbarron@trolltech.com>2009-07-27 13:04:30 (GMT)
commit3643028959f0b38350e57e60ba4000435b75e592 (patch)
treec129e4dee11487abd437ab8ebd993ba261e06fa6 /src/xmlpatterns/data
parentcf66c667a97c0079141eb3f2d9e997b7378ae792 (diff)
parentc36139c665e61866aff4bf8572890a735167a7d0 (diff)
downloadQt-3643028959f0b38350e57e60ba4000435b75e592.zip
Qt-3643028959f0b38350e57e60ba4000435b75e592.tar.gz
Qt-3643028959f0b38350e57e60ba4000435b75e592.tar.bz2
Merge commit 'qt/master-stable'
Conflicts: configure.exe qmake/Makefile.unix qmake/generators/makefile.cpp src/corelib/global/qglobal.h src/corelib/kernel/kernel.pri src/corelib/kernel/qcoreevent.cpp src/corelib/kernel/qsharedmemory_unix.cpp src/gui/graphicsview/qgraphicsscene.cpp src/gui/kernel/qaction.cpp src/gui/kernel/qaction.h src/gui/kernel/qaction_p.h src/gui/kernel/qapplication.cpp src/gui/kernel/qapplication.h src/gui/kernel/qwidget.cpp src/gui/kernel/qwidget.h src/gui/kernel/qwidget_mac.mm src/gui/painting/qgraphicssystemfactory.cpp src/gui/styles/qwindowsstyle.cpp src/gui/text/qfontengine_qpf.cpp src/gui/widgets/qabstractscrollarea_p.h src/network/access/qnetworkaccessdebugpipebackend.cpp src/network/socket/qlocalsocket_unix.cpp src/network/socket/qnativesocketengine_p.h src/network/socket/qnativesocketengine_unix.cpp src/openvg/qpaintengine_vg.cpp tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp tests/auto/qcssparser/qcssparser.pro tests/auto/qdir/tst_qdir.cpp tests/auto/qfile/tst_qfile.cpp tests/auto/qobject/tst_qobject.cpp tests/auto/qpathclipper/qpathclipper.pro tests/auto/qprocess/tst_qprocess.cpp tests/auto/qsettings/tst_qsettings.cpp tests/auto/qsharedpointer/qsharedpointer.pro tests/auto/qsqlquerymodel/qsqlquerymodel.pro tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro tests/auto/qsqltablemodel/qsqltablemodel.pro tests/auto/qsqlthread/qsqlthread.pro tests/auto/qwidget/tst_qwidget.cpp
Diffstat (limited to 'src/xmlpatterns/data')
-rw-r--r--src/xmlpatterns/data/data.pri20
-rw-r--r--src/xmlpatterns/data/qboolean.cpp2
-rw-r--r--src/xmlpatterns/data/qcomparisonfactory.cpp154
-rw-r--r--src/xmlpatterns/data/qcomparisonfactory_p.h121
-rw-r--r--src/xmlpatterns/data/qitem_p.h5
-rw-r--r--src/xmlpatterns/data/qresourceloader_p.h2
-rw-r--r--src/xmlpatterns/data/qvaluefactory.cpp106
-rw-r--r--src/xmlpatterns/data/qvaluefactory_p.h98
8 files changed, 498 insertions, 10 deletions
diff --git a/src/xmlpatterns/data/data.pri b/src/xmlpatterns/data/data.pri
index 99591d4..ccfed42 100644
--- a/src/xmlpatterns/data/data.pri
+++ b/src/xmlpatterns/data/data.pri
@@ -1,8 +1,8 @@
HEADERS += $$PWD/qabstractdatetime_p.h \
$$PWD/qabstractduration_p.h \
$$PWD/qabstractfloatcasters_p.h \
- $$PWD/qabstractfloat_p.h \
$$PWD/qabstractfloatmathematician_p.h \
+ $$PWD/qabstractfloat_p.h \
$$PWD/qanyuri_p.h \
$$PWD/qatomiccaster_p.h \
$$PWD/qatomiccasters_p.h \
@@ -14,8 +14,8 @@ HEADERS += $$PWD/qabstractdatetime_p.h \
$$PWD/qbase64binary_p.h \
$$PWD/qboolean_p.h \
$$PWD/qcommonvalues_p.h \
+ $$PWD/qcomparisonfactory_p.h \
$$PWD/qdate_p.h \
- $$PWD/qschemadatetime_p.h \
$$PWD/qdaytimeduration_p.h \
$$PWD/qdecimal_p.h \
$$PWD/qderivedinteger_p.h \
@@ -24,19 +24,21 @@ HEADERS += $$PWD/qabstractdatetime_p.h \
$$PWD/qgday_p.h \
$$PWD/qgmonthday_p.h \
$$PWD/qgmonth_p.h \
- $$PWD/qgyear_p.h \
$$PWD/qgyearmonth_p.h \
+ $$PWD/qgyear_p.h \
$$PWD/qhexbinary_p.h \
$$PWD/qinteger_p.h \
$$PWD/qitem_p.h \
$$PWD/qnodebuilder_p.h \
- $$PWD/qschemanumeric_p.h \
$$PWD/qqnamevalue_p.h \
$$PWD/qresourceloader_p.h \
- $$PWD/qsorttuple.cpp \
+ $$PWD/qschemadatetime_p.h \
+ $$PWD/qschemanumeric_p.h \
$$PWD/qschematime_p.h \
+ $$PWD/qsorttuple.cpp \
$$PWD/quntypedatomic_p.h \
$$PWD/qvalidationerror_p.h \
+ $$PWD/qvaluefactory_p.h \
$$PWD/qyearmonthduration_p.h
SOURCES += $$PWD/qabstractdatetime.cpp \
@@ -53,8 +55,8 @@ SOURCES += $$PWD/qabstractdatetime.cpp \
$$PWD/qbase64binary.cpp \
$$PWD/qboolean.cpp \
$$PWD/qcommonvalues.cpp \
+ $$PWD/qcomparisonfactory.cpp \
$$PWD/qdate.cpp \
- $$PWD/qschemadatetime.cpp \
$$PWD/qdaytimeduration.cpp \
$$PWD/qdecimal.cpp \
$$PWD/qduration.cpp \
@@ -68,11 +70,13 @@ SOURCES += $$PWD/qabstractdatetime.cpp \
$$PWD/qitem.cpp \
$$PWD/qnodebuilder.cpp \
$$PWD/qnodemodel.cpp \
- $$PWD/qschemanumeric.cpp \
$$PWD/qqnamevalue.cpp \
$$PWD/qresourceloader.cpp \
- $$PWD/qsorttuple.cpp \
+ $$PWD/qschemadatetime.cpp \
+ $$PWD/qschemanumeric.cpp \
$$PWD/qschematime.cpp \
+ $$PWD/qsorttuple.cpp \
$$PWD/quntypedatomic.cpp \
$$PWD/qvalidationerror.cpp \
+ $$PWD/qvaluefactory.cpp \
$$PWD/qyearmonthduration.cpp
diff --git a/src/xmlpatterns/data/qboolean.cpp b/src/xmlpatterns/data/qboolean.cpp
index 07562fd..bb4ece1 100644
--- a/src/xmlpatterns/data/qboolean.cpp
+++ b/src/xmlpatterns/data/qboolean.cpp
@@ -76,7 +76,7 @@ bool Boolean::evaluateEBV(const Item &first,
{
Q_ASSERT(context);
context->error(QtXmlPatterns::tr("Effective Boolean Value cannot be calculated for a sequence "
- "containing two or more atomic values."),
+ "containing two or more atomic values."),
ReportContext::FORG0006,
QSourceLocation());
return false;
diff --git a/src/xmlpatterns/data/qcomparisonfactory.cpp b/src/xmlpatterns/data/qcomparisonfactory.cpp
new file mode 100644
index 0000000..c22d9e7
--- /dev/null
+++ b/src/xmlpatterns/data/qcomparisonfactory.cpp
@@ -0,0 +1,154 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qatomiccomparators_p.h"
+#include "qatomicstring_p.h"
+#include "qcomparisonplatform_p.h"
+#include "qvaluefactory_p.h"
+
+#include "qcomparisonfactory_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+/**
+ * @short Helper class for ComparisonFactory::fromLexical() which exposes
+ * CastingPlatform appropriately.
+ *
+ * @relates ComparisonFactory
+ */
+class PerformComparison : public ComparisonPlatform<PerformComparison, true>
+ , public SourceLocationReflection
+{
+public:
+ PerformComparison(const SourceLocationReflection *const sourceLocationReflection,
+ const AtomicComparator::Operator op) : m_sourceReflection(sourceLocationReflection)
+ , m_operator(op)
+ {
+ Q_ASSERT(m_sourceReflection);
+ }
+
+ bool operator()(const AtomicValue::Ptr &operand1,
+ const AtomicValue::Ptr &operand2,
+ const SchemaType::Ptr &type,
+ const ReportContext::Ptr &context)
+ {
+ const ItemType::Ptr asItemType((AtomicType::Ptr(type)));
+
+ /* One area where the Query Transform world differs from the Schema
+ * world is that @c xs:duration is not considedered comparable, because
+ * it's according to Schema is partially comparable. This means
+ * ComparisonPlatform::fetchComparator() flags it as impossible, and
+ * hence we need to override that.
+ *
+ * SchemaType::wxsTypeMatches() will return true for sub-types of @c
+ * xs:duration as well, but that's ok since AbstractDurationComparator
+ * works for them too. */
+ if(BuiltinTypes::xsDuration->wxsTypeMatches(type))
+ prepareComparison(AtomicComparator::Ptr(new AbstractDurationComparator()));
+ else if (BuiltinTypes::xsGYear->wxsTypeMatches(type) ||
+ BuiltinTypes::xsGYearMonth->wxsTypeMatches(type) ||
+ BuiltinTypes::xsGMonth->wxsTypeMatches(type) ||
+ BuiltinTypes::xsGMonthDay->wxsTypeMatches(type) ||
+ BuiltinTypes::xsGDay->wxsTypeMatches(type))
+ prepareComparison(AtomicComparator::Ptr(new AbstractDateTimeComparator()));
+ else
+ prepareComparison(fetchComparator(asItemType, asItemType, context));
+
+ return flexibleCompare(operand1, operand2, context);
+ }
+
+ const SourceLocationReflection *actualReflection() const
+ {
+ return m_sourceReflection;
+ }
+
+ AtomicComparator::Operator operatorID() const
+ {
+ return m_operator;
+ }
+
+private:
+ const SourceLocationReflection *const m_sourceReflection;
+ const AtomicComparator::Operator m_operator;
+};
+
+bool ComparisonFactory::compare(const AtomicValue::Ptr &operand1,
+ const AtomicComparator::Operator op,
+ const AtomicValue::Ptr &operand2,
+ const SchemaType::Ptr &type,
+ const ReportContext::Ptr &context,
+ const SourceLocationReflection *const sourceLocationReflection)
+{
+ Q_ASSERT(operand1);
+ Q_ASSERT(operand2);
+ Q_ASSERT(context);
+ Q_ASSERT(sourceLocationReflection);
+ Q_ASSERT(type);
+ Q_ASSERT_X(type->category() == SchemaType::SimpleTypeAtomic, Q_FUNC_INFO,
+ "We can only compare atomic values.");
+
+ return PerformComparison(sourceLocationReflection, op)(operand1, operand2, type, context);
+}
+
+bool ComparisonFactory::constructAndCompare(const DerivedString<TypeString>::Ptr &operand1,
+ const AtomicComparator::Operator op,
+ const DerivedString<TypeString>::Ptr &operand2,
+ const SchemaType::Ptr &type,
+ const ReportContext::Ptr &context,
+ const SourceLocationReflection *const sourceLocationReflection)
+{
+ Q_ASSERT(operand1);
+ Q_ASSERT(operand2);
+ Q_ASSERT(context);
+ Q_ASSERT(sourceLocationReflection);
+ Q_ASSERT(type);
+ Q_ASSERT_X(type->category() == SchemaType::SimpleTypeAtomic, Q_FUNC_INFO,
+ "We can only compare atomic values.");
+
+ const AtomicValue::Ptr value1 = ValueFactory::fromLexical(operand1->stringValue(), type, context, sourceLocationReflection);
+ const AtomicValue::Ptr value2 = ValueFactory::fromLexical(operand2->stringValue(), type, context, sourceLocationReflection);
+
+ return compare(value1, op, value2, type, context, sourceLocationReflection);
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/data/qcomparisonfactory_p.h b/src/xmlpatterns/data/qcomparisonfactory_p.h
new file mode 100644
index 0000000..1234548
--- /dev/null
+++ b/src/xmlpatterns/data/qcomparisonfactory_p.h
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $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_ComparisonFactory_H
+#define Patternist_ComparisonFactory_H
+
+#include "qatomiccomparator_p.h"
+#include "qderivedstring_p.h"
+#include "qitem_p.h"
+#include "qreportcontext_p.h"
+#include "qschematype_p.h"
+
+QT_BEGIN_HEADER
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short Provides compare(), which is a high-level helper function for
+ * comparing atomic values.
+ *
+ * This class wraps the helper class ComparisonPlatform with a more specific,
+ * high-level API.
+ *
+ * @see ComparisonPlatform
+ * @author Frans Englich <fenglich@trolltech.com>
+ * @ingroup Patternist_schema
+ */
+ class ComparisonFactory
+ {
+ public:
+ /**
+ * @short Returns the result of evaluating operator @p op applied to the atomic
+ * values @p operand1 and @p operand2.
+ *
+ * The caller guarantees that both values are of type @p type.
+ *
+ * ComparisonFactory does not take ownership of @p sourceLocationReflection.
+ */
+ static bool compare(const AtomicValue::Ptr &operand1,
+ const AtomicComparator::Operator op,
+ const AtomicValue::Ptr &operand2,
+ const SchemaType::Ptr &type,
+ const ReportContext::Ptr &context,
+ const SourceLocationReflection *const sourceLocationReflection);
+
+ /**
+ * @short Returns the result of evaluating operator @p op applied to the atomic
+ * values @p operand1 and @p operand2.
+ *
+ * In opposite to compare() it converts the operands from string type
+ * to @p type and compares these constructed types.
+ *
+ * The caller guarantees that both values are of type @p type.
+ *
+ * ComparisonFactory does not take ownership of @p sourceLocationReflection.
+ */
+ static bool constructAndCompare(const DerivedString<TypeString>::Ptr &operand1,
+ const AtomicComparator::Operator op,
+ const DerivedString<TypeString>::Ptr &operand2,
+ const SchemaType::Ptr &type,
+ const ReportContext::Ptr &context,
+ const SourceLocationReflection *const sourceLocationReflection);
+
+ private:
+ Q_DISABLE_COPY(ComparisonFactory)
+ };
+}
+
+QT_END_NAMESPACE
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/data/qitem_p.h b/src/xmlpatterns/data/qitem_p.h
index 1f50072..60c8510 100644
--- a/src/xmlpatterns/data/qitem_p.h
+++ b/src/xmlpatterns/data/qitem_p.h
@@ -128,6 +128,11 @@ namespace QPatternist
typedef QExplicitlySharedDataPointer<AtomicValue> Ptr;
/**
+ * A list if smart pointers wrapping AtomicValue instances.
+ */
+ typedef QList<AtomicValue::Ptr> List;
+
+ /**
* Determines whether this atomic value has an error. This is used
* for implementing casting.
*
diff --git a/src/xmlpatterns/data/qresourceloader_p.h b/src/xmlpatterns/data/qresourceloader_p.h
index 8cb174d..0ebc885 100644
--- a/src/xmlpatterns/data/qresourceloader_p.h
+++ b/src/xmlpatterns/data/qresourceloader_p.h
@@ -114,7 +114,7 @@ namespace QPatternist
*
* Typically this hint is given when the URI is available at
* compile-time, but it is used inside a conditional statement
- * whose branching can't be determined at compile time.
+ * whose branching cannot be determined at compile time.
*/
MayUse,
diff --git a/src/xmlpatterns/data/qvaluefactory.cpp b/src/xmlpatterns/data/qvaluefactory.cpp
new file mode 100644
index 0000000..63307c2
--- /dev/null
+++ b/src/xmlpatterns/data/qvaluefactory.cpp
@@ -0,0 +1,106 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qatomiccaster_p.h"
+#include "qatomicstring_p.h"
+#include "qcastingplatform_p.h"
+#include "qvaluefactory_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+/**
+ * @short Helper class for ValueFactory::fromLexical() which exposes
+ * CastingPlatform appropriately.
+ *
+ * @relates ValueFactory
+ */
+class PerformValueConstruction : public CastingPlatform<PerformValueConstruction, false>
+ , public SourceLocationReflection
+{
+public:
+ PerformValueConstruction(const SourceLocationReflection *const sourceLocationReflection,
+ const SchemaType::Ptr &toType) : m_sourceReflection(sourceLocationReflection)
+ , m_targetType(AtomicType::Ptr(toType))
+ {
+ Q_ASSERT(m_sourceReflection);
+ }
+
+ AtomicValue::Ptr operator()(const AtomicValue::Ptr &lexicalValue,
+ const SchemaType::Ptr &type,
+ const ReportContext::Ptr &context)
+ {
+ prepareCasting(context, BuiltinTypes::xsString);
+ return AtomicValue::Ptr(const_cast<AtomicValue *>(cast(lexicalValue, context).asAtomicValue()));
+ }
+
+ const SourceLocationReflection *actualReflection() const
+ {
+ return m_sourceReflection;
+ }
+
+ ItemType::Ptr targetType() const
+ {
+ return m_targetType;
+ }
+
+private:
+ const SourceLocationReflection *const m_sourceReflection;
+ const ItemType::Ptr m_targetType;
+};
+
+AtomicValue::Ptr ValueFactory::fromLexical(const QString &lexicalValue,
+ const SchemaType::Ptr &type,
+ const ReportContext::Ptr &context,
+ const SourceLocationReflection *const sourceLocationReflection)
+{
+ Q_ASSERT(context);
+ Q_ASSERT(type);
+ Q_ASSERT_X(type->category() == SchemaType::SimpleTypeAtomic, Q_FUNC_INFO,
+ "We can only construct for atomic values.");
+
+ return PerformValueConstruction(sourceLocationReflection, type)(AtomicString::fromValue(lexicalValue),
+ type,
+ context);
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/data/qvaluefactory_p.h b/src/xmlpatterns/data/qvaluefactory_p.h
new file mode 100644
index 0000000..acc5733
--- /dev/null
+++ b/src/xmlpatterns/data/qvaluefactory_p.h
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtXmlPatterns 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $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_ValueFactory_H
+#define Patternist_ValueFactory_H
+
+#include "qitem_p.h"
+#include "qreportcontext_p.h"
+#include "qschematype_p.h"
+
+QT_BEGIN_HEADER
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short Provides fromLexical(), which allows instantiation of atomic
+ * values from arbitrary types.
+ *
+ * This class wraps the helper class CastingPlatform with a more specific,
+ * high-level API.
+ *
+ * @see CastingPlatform
+ * @author Frans Englich <fenglich@trolltech.com>
+ * @ingroup Patternist_schema
+ */
+ class ValueFactory
+ {
+ public:
+ /**
+ * @short Returns an AtomicValue of type @p type from the lexical space
+ * @p lexicalValue, and raise an error through @p context if that's
+ * impossible.
+ *
+ * ValueFactory does not take ownership of @p sourceLocationReflection.
+ */
+ static AtomicValue::Ptr fromLexical(const QString &lexicalValue,
+ const SchemaType::Ptr &type,
+ const ReportContext::Ptr &context,
+ const SourceLocationReflection *const sourceLocationReflection);
+
+ private:
+ Q_DISABLE_COPY(ValueFactory)
+ };
+}
+
+QT_END_NAMESPACE
+QT_END_HEADER
+
+#endif