summaryrefslogtreecommitdiffstats
path: root/src/xmlpatterns/environment
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2009-03-23 09:34:13 (GMT)
committerSimon Hausmann <simon.hausmann@nokia.com>2009-03-23 09:34:13 (GMT)
commit67ad0519fd165acee4a4d2a94fa502e9e4847bd0 (patch)
tree1dbf50b3dff8d5ca7e9344733968c72704eb15ff /src/xmlpatterns/environment
downloadQt-67ad0519fd165acee4a4d2a94fa502e9e4847bd0.zip
Qt-67ad0519fd165acee4a4d2a94fa502e9e4847bd0.tar.gz
Qt-67ad0519fd165acee4a4d2a94fa502e9e4847bd0.tar.bz2
Long live Qt!
Diffstat (limited to 'src/xmlpatterns/environment')
-rwxr-xr-xsrc/xmlpatterns/environment/createReportContext.sh12
-rw-r--r--src/xmlpatterns/environment/createReportContext.xsl554
-rw-r--r--src/xmlpatterns/environment/environment.pri32
-rw-r--r--src/xmlpatterns/environment/qcurrentitemcontext.cpp62
-rw-r--r--src/xmlpatterns/environment/qcurrentitemcontext_p.h93
-rw-r--r--src/xmlpatterns/environment/qdelegatingdynamiccontext.cpp212
-rw-r--r--src/xmlpatterns/environment/qdelegatingdynamiccontext_p.h130
-rw-r--r--src/xmlpatterns/environment/qdelegatingstaticcontext.cpp261
-rw-r--r--src/xmlpatterns/environment/qdelegatingstaticcontext_p.h147
-rw-r--r--src/xmlpatterns/environment/qdynamiccontext.cpp68
-rw-r--r--src/xmlpatterns/environment/qdynamiccontext_p.h231
-rw-r--r--src/xmlpatterns/environment/qfocus.cpp107
-rw-r--r--src/xmlpatterns/environment/qfocus_p.h103
-rw-r--r--src/xmlpatterns/environment/qgenericdynamiccontext.cpp205
-rw-r--r--src/xmlpatterns/environment/qgenericdynamiccontext_p.h155
-rw-r--r--src/xmlpatterns/environment/qgenericstaticcontext.cpp340
-rw-r--r--src/xmlpatterns/environment/qgenericstaticcontext_p.h199
-rw-r--r--src/xmlpatterns/environment/qreceiverdynamiccontext.cpp61
-rw-r--r--src/xmlpatterns/environment/qreceiverdynamiccontext_p.h89
-rw-r--r--src/xmlpatterns/environment/qreportcontext.cpp478
-rw-r--r--src/xmlpatterns/environment/qreportcontext_p.h2460
-rw-r--r--src/xmlpatterns/environment/qstackcontextbase.cpp153
-rw-r--r--src/xmlpatterns/environment/qstackcontextbase_p.h136
-rw-r--r--src/xmlpatterns/environment/qstaticbaseuricontext.cpp62
-rw-r--r--src/xmlpatterns/environment/qstaticbaseuricontext_p.h91
-rw-r--r--src/xmlpatterns/environment/qstaticcompatibilitycontext.cpp57
-rw-r--r--src/xmlpatterns/environment/qstaticcompatibilitycontext_p.h84
-rw-r--r--src/xmlpatterns/environment/qstaticcontext.cpp61
-rw-r--r--src/xmlpatterns/environment/qstaticcontext_p.h299
-rw-r--r--src/xmlpatterns/environment/qstaticcurrentcontext.cpp60
-rw-r--r--src/xmlpatterns/environment/qstaticcurrentcontext_p.h90
-rw-r--r--src/xmlpatterns/environment/qstaticfocuscontext.cpp59
-rw-r--r--src/xmlpatterns/environment/qstaticfocuscontext_p.h91
-rw-r--r--src/xmlpatterns/environment/qstaticnamespacecontext.cpp60
-rw-r--r--src/xmlpatterns/environment/qstaticnamespacecontext_p.h89
35 files changed, 7391 insertions, 0 deletions
diff --git a/src/xmlpatterns/environment/createReportContext.sh b/src/xmlpatterns/environment/createReportContext.sh
new file mode 100755
index 0000000..dcbf9ea
--- /dev/null
+++ b/src/xmlpatterns/environment/createReportContext.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+# Generate ReportContext.h by invoking createReportContext.xsl, which
+# in turns performs a transformation on the specs, fetched from http://www.w3.org/.
+
+target="qreportcontext_p.h"
+tmpFile=".reportContextInput.tmp.xml"
+echo "<dummy/>" > $tmpFile
+p4 revert $target
+p4 edit $target
+xsltproc createReportContext.xsl $tmpFile > $target
+p4 revert -a $target
+rm -f $tmpFile
diff --git a/src/xmlpatterns/environment/createReportContext.xsl b/src/xmlpatterns/environment/createReportContext.xsl
new file mode 100644
index 0000000..e648c56
--- /dev/null
+++ b/src/xmlpatterns/environment/createReportContext.xsl
@@ -0,0 +1,554 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the Patternist project on Trolltech Labs.
+**
+** $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 qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+***************************************************************************
+*/
+-->
+
+<xsl:stylesheet
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:h="http://www.w3.org/1999/xhtml"
+ version="1.0">
+
+ <xsl:output omit-xml-declaration="yes"/>
+
+<!--
+This code open the following specifications:
+
+ - XQuery 1.0 and XPath 2.0 Functions and Operators
+ - XML Path Language (XPath) 2.0
+ - XSL Transformations (XSLT) Version 2.0
+ - XQuery 1.0: An XML Query Language
+
+and extracts the error codes as well as their documentation and exports
+them as enum values into a C++ enumerator called ErrorCode.
+
+NOTE: Be aware of binary compatibility when using this stylesheet.
+-->
+
+<!--
+<xsl:variable name="xslt20" select="document('xslt20.html')"/>
+-->
+<xsl:variable name="xslt20" select="document('http://www.w3.org/TR/xslt20')"/>
+
+<!--
+<xsl:variable name="xqfo" select="document('xqfo.html')"/>
+-->
+<xsl:variable name="xqfo" select="document('http://www.w3.org/TR/xpath-functions/')"/>
+
+<!--
+<xsl:variable name="xq" select="document('xq.html')"/>
+-->
+<xsl:variable name="xq" select="document('http://www.w3.org/TR/xquery/')"/>
+
+<!--
+<xsl:variable name="ser" select="document('ser.html')"/>
+-->
+<xsl:variable name="ser" select="document('http://www.w3.org/TR/xslt-xquery-serialization/')"/>
+
+<!--
+*********************************************
+*********************************************
+-->
+<xsl:template match="/"><xsl:text disable-output-escaping="yes"
+><![CDATA[/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 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 qt-sales@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_ReportContext_H
+#define Patternist_ReportContext_H
+
+#include <QSharedData>
+#include <QAbstractUriResolver>
+#include <QSourceLocation>
+
+#include "qnamepool_p.h"
+#include "qxmlname.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+class QAbstractMessageHandler;
+class QSourceLocation;
+class QString;
+
+namespace QPatternist
+{
+ class SourceLocationReflection;
+
+ /**
+ * @short A callback for reporting errors.
+ *
+ * ReportContext receives messages of various severity and type via its
+ * functions warning() and error(). In turn, ReportContext create Message instances
+ * and submit them to the QAbstractMessageHandler instance returned by messageHandler().
+ *
+ * The Message attributes are set as follows:
+ *
+ * - Message::description() - A translated, human-readable description
+ * - Message::type() - Message::Error if a static, dynamic or type error was encountered
+ * that halted compilation or evaluation, or Message::Warning in case of a warning
+ * - Message::identifier() - This is a URI consisting of the error namespace with the
+ * error code as fragment. For example, a Message representing a syntax error
+ * would return the type "http://www.w3.org/2005/xqt-errors#XPST0003". The convenience
+ * function codeFromURI() can be used to extract the error code. The error namespace
+ * is typically the namespace for XPath and XQuery errors(as in the previous example), but
+ * can also be user defined.
+ *
+ * @see <a href="http://www.w3.org/TR/xpath20/#id-identifying-errors">XML Path Language
+ * (XPath) 2.0, 2.3.2 Identifying and Reporting Errors</a>
+ * @see <a href="http://www.w3.org/TR/xpath-functions/#func-error">XQuery 1.0 and
+ * XPath 2.0 Functions and Operators, 3 The Error Function</a>
+ * @author Frans Englich <fenglich@trolltech.com>
+ * @warning This file is auto-generated from extractErrorCodes.xsl. Any
+ * modifications done to this file are lost.
+ */
+ class Q_AUTOTEST_EXPORT ReportContext : public QSharedData
+ {
+ public:
+ typedef QHash<const SourceLocationReflection *, QSourceLocation> LocationHash;
+
+ /**
+ * A smart pointer wrapping ReportContext instances.
+ */
+ typedef QExplicitlySharedDataPointer<ReportContext> Ptr;
+
+ /**
+ * @short Default constructors.
+ *
+ * For some reason GCC fails to synthesize it, so we provide an empty
+ * one here.
+ */
+ inline ReportContext() {}
+
+ virtual ~ReportContext();
+
+ /**
+ * Error codes that corresponds to the error codes defined in the
+ * relevant specifications. They are used throughout the API for
+ * identifying error conditions.
+ *
+ * While strings could have been used for identifying errors, enums
+ * reduces bugs by providing type safety.
+ *
+ * @see <a href="http://www.w3.org/TR/xpath20/#errors">XML
+ * Path Language (XPath) 2.0, 2.3 Error Handling</a>
+ * @see <a href="http://www.w3.org/TR/xpath-functions/#d1e10985">XQuery 1.0
+ * and XPath 2.0 Functions and Operators, C Error Summary</a>
+ * @see <a href="http://www.w3.org/TR/xslt20/#error-summary">XSL Transformations
+ * (XSLT) Version 2.0, E Summary of Error Conditions (Non-Normative)</a>
+ * @note The enumerator values' Doxygen documentation is copied from the
+ * W3C documents
+ * <a href="http://www.w3.org/TR/xpath-functions">XQuery 1.0 and XPath
+ * 2.0 Functions and Operators</a>,
+ * <a href="http://www.w3.org/TR/xpath20">XML Path Language (XPath) 2.0</a>, and
+ * <a href="http://www.w3.org/TR/xslt20/">XSL Transformations (XSLT)
+ * Version 2.0</a>, respectively. The doxygen documentation is therefore covered
+ * by the following legal notice:
+ * "Copyright @ 2005 W3C&reg; (MIT, ERCIM, Keio), All Rights Reserved. W3C
+ * <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+ * <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and
+ * <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document
+ * use</a> rules apply."
+ * @warning This enumerator is auto-generated from the relevant specifications
+ * by the XSL-T stylesheet extractErrorCodes.xsl. Hence, any modifications
+ * done to this file, in contrary to the stylesheet, are therefore lost.
+ */]]></xsl:text>
+ enum ErrorCode
+ {
+<!-- The order of the calls is significant. The templates takes into account
+ to avoid the last comma(extractXSLT20 does this). -->
+<xsl:call-template name="extractXQuery10"/>
+<xsl:call-template name="extractXQueryFO"/>
+<xsl:call-template name="extractSerialization"/>
+<xsl:call-template name="extractXSLT20"/>
+ };
+<xsl:text disable-output-escaping="yes"><![CDATA[
+ /**
+ * Issues a warning, should not be used excessively. This can
+ * be used to communicate that a certain implementation defined
+ * feature is unsupported or that a certain expression most likely
+ * doesn't do what the users wants, to name a few examples.
+ *
+ * @see <a href="http://www.w3.org/TR/xpath20/#errors">XML Path Language (XPath) 2.0,
+ * 2.3 Error Handling</a>
+ * @param message the message to be read by the user.
+ * @param sourceLocation the location of where the warning originates from.
+ */
+ void warning(const QString &message, const QSourceLocation &sourceLocation = QSourceLocation());
+
+ /**
+ * Issues an error. May be used at the static analysis phase or
+ * the dynamic evaluation phase.
+ *
+ * For SourceLocationReflection instances, the overload taking an SouourceLocationReflection should be used.
+ *
+ * @see <a href="http://www.w3.org/TR/xpath20/#errors">XML Path Language (XPath) 2.0,
+ * 2.3 Error Handling</a>
+ * @param message the message to be read by the user.
+ * @param errorCode identifies the error condition, as described
+ * @param sourceLocation the location of where the error originates from
+ * in "XML Path Language (XPath) 2.0" section "G Error Conditions"
+ */
+ void error(const QString &message,
+ const ReportContext::ErrorCode errorCode,
+ const QSourceLocation &sourceLocation);
+
+ /**
+ * Overload.
+ *
+ * Same as the above, but passes the SourceLocationReflection as reference for error reporting.
+ */
+ void error(const QString &message,
+ const ReportContext::ErrorCode errorCode,
+ const SourceLocationReflection *reflection);
+
+ /**
+ * Issues an error which is not identified in the XPath specifications. This function
+ * is among other things used for implementing the <tt>fn:error()</tt> function.
+ */
+ void error(const QString &message,
+ const QXmlName qName,
+ const SourceLocationReflection *const r);
+
+ /**
+ * @return the QAbstractMessageHandler which functions such as warning() and
+ * error() should submit messages to. This function
+ * may never return @c null; a valid QAbstractMessageHandler pointer must always be returned.
+ */
+ virtual QAbstractMessageHandler *messageHandler() const = 0;
+
+ virtual NamePool::Ptr namePool() const = 0;
+
+ /**
+ * Returns a string representation of the error code @p code.
+ *
+ * @see ReportContext::ErrorCode
+ * @param errorCode identifies the error condition, as described
+ * in <a href="http://www.w3.org/TR/xpath20/#id-errors">XML Path
+ * Language (XPath) 2.0, G Error Conditions</a>
+ */
+ static QString codeToString(const ReportContext::ErrorCode errorCode);
+
+ /**
+ * @returns the error code part of @p typeURI and sets @p uri to the error namespace. Note
+ * that the error namespace not necessarily is the namespace for XPath and
+ * XQuery errors, http://www.w3.org/2005/xqt-errors, but can be user defined.
+ */
+ static QString codeFromURI(const QString &typeURI,
+ QString &uri);
+
+ /**
+ * @short Returns the source location applying for @p reflection.
+ */
+ virtual QSourceLocation locationFor(const SourceLocationReflection *const reflection) const = 0;
+
+ /**
+ * Resolves @p relative against @p baseURI, possibly using a URI resolver.
+ */
+ QUrl resolveURI(const QUrl &relative,
+ const QUrl &baseURI) const;
+
+ /**
+ * @short The URI resolver in use.
+ *
+ * If no URI resolver is in use, a @c null pointer is returned.
+ *
+ * @note You should probably use resolveURI(), which handles the case of
+ * when uriResolver() is @c null.
+ */
+ virtual QAbstractUriResolver *uriResolver() const = 0;
+
+ private:
+ void createError(const QString &description,
+ const QtMsgType type,
+ const QUrl &id,
+ const QSourceLocation &sourceLocation) const;
+ static inline QString finalizeDescription(const QString &desc);
+ QSourceLocation lookupSourceLocation(const SourceLocationReflection *const ref) const;
+
+ Q_DISABLE_COPY(ReportContext)
+ };
+
+ /**
+ * @short This is the class type that is being thrown when a query error occur.
+ *
+ * @relates ReportContext
+ */
+ typedef bool Exception;
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif]]></xsl:text>
+</xsl:template>
+<!--
+*********************************************
+*********************************************
+-->
+
+
+
+
+<!--
+*********************************************
+XQuery 1.0 and XPath 2.0 Functions and Operators
+*********************************************
+-->
+<xsl:template name="extractXQueryFO">
+ <xsl:apply-templates mode="xqfo" select="$xqfo/h:html/h:body/h:div[@class = 'back']//
+ h:div[h:h2/h:a/@id = 'error-summary']/h:dl/h:dt"/>
+</xsl:template>
+
+<xsl:template mode="xqfo" match="h:dt">
+ /**<xsl:call-template name="formatDocs">
+ <xsl:with-param name="content" select="substring(., 15)"/>
+ </xsl:call-template>
+ */
+ <xsl:value-of select="substring(h:a/@name, 4)"/>,
+</xsl:template>
+<!--
+*********************************************
+*********************************************
+-->
+
+
+
+
+<!--
+*********************************************
+XQuery 1.0: An XML Query Language
+*********************************************
+-->
+<xsl:template name="extractXQuery10">
+ <xsl:apply-templates mode="xquery10" select="$xq/h:html/h:body/h:div[@class = 'back']//
+ h:div[h:h2/h:a/@id = 'id-errors']/h:dl/h:dt"/>
+</xsl:template>
+
+<xsl:template mode="xquery10" match="h:dt">
+ /**<xsl:call-template name="formatDocs">
+ <xsl:with-param name="content" select="following-sibling::h:dd/h:p"/>
+ </xsl:call-template>
+ */
+ <xsl:value-of select="substring(., 5)"/>,
+</xsl:template>
+<!--
+*********************************************
+*********************************************
+-->
+
+
+
+<!--
+*********************************************
+XSL Transformations (XSLT) Version 2.0
+*********************************************
+-->
+<xsl:template name="extractXSLT20">
+ <xsl:apply-templates mode="xslt20" select="$xslt20/h:html/h:body/h:div[@class = 'back']//
+ h:div[@class = 'div1' and h:h2/h:a/@id = 'error-summary']/h:dl/h:dt"/>
+</xsl:template>
+
+<xsl:template mode="xslt20" match="h:dt">
+ /**<xsl:call-template name="formatDocs">
+ <xsl:with-param name="content" select="following-sibling::h:dd/h:p"/>
+ </xsl:call-template>
+ */
+ <xsl:value-of select="normalize-space(substring(h:a/h:span, 4))"/>
+
+ <xsl:if test="position() != last()">,</xsl:if>
+ <xsl:text>&#xa;</xsl:text>
+</xsl:template>
+<!--
+*********************************************
+*********************************************
+-->
+
+
+
+<!--
+*********************************************
+XSLT 2.0 and XQuery 1.0 Serialization
+*********************************************
+-->
+<xsl:template name="extractSerialization">
+ <xsl:apply-templates mode="ser" select="$ser/h:html/h:body/h:div[@class = 'back']//
+ h:div[@class = 'div1' and h:h2/h:a/@id = 'id-errors']/h:dl/h:dt"/>
+</xsl:template>
+
+<xsl:template mode="ser" match="h:dt">
+ /**<xsl:call-template name="formatDocs">
+ <xsl:with-param name="content" select="following-sibling::h:dd/h:p"/>
+ </xsl:call-template>
+ */
+ <xsl:value-of select="substring(., 5)"/>,
+</xsl:template>
+<!--
+*********************************************
+*********************************************
+-->
+
+
+
+
+<!-- Random stuff -->
+<xsl:template name="formatDocs">
+ <xsl:param name="content"/>
+
+ <xsl:call-template name="internalFormatDocs">
+ <xsl:with-param name="content">
+ <!-- Escape # in order to keep Doxygen happy. -->
+ <xsl:call-template name="replace-string">
+ <xsl:with-param name="text" select="translate(normalize-space($content), '&#xA0;', '')"/>
+ <xsl:with-param name="from" select="' #'"/>
+ <xsl:with-param name="to" select="' \#'"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+
+</xsl:template>
+
+<xsl:template name="internalFormatDocs">
+ <xsl:param name="content"/>
+
+ <xsl:variable name="nextText" select="substring($content, 61)"/>
+ <xsl:variable name="afterSpace" select="substring-after($nextText, ' ')"/>
+ * <xsl:value-of select="substring($content, 1, 60)"/>
+ <xsl:value-of select="substring-before($nextText, ' ')"/>
+ <xsl:choose>
+ <xsl:when test="string-length($afterSpace) = 0"><xsl:value-of select="$nextText"/>
+ </xsl:when>
+ <xsl:when test="string-length($afterSpace) &lt; 60">
+ * <xsl:value-of select="$afterSpace"/>
+ </xsl:when>
+ <xsl:when test="string-length($nextText)">
+ <xsl:call-template name="formatDocs">
+ <xsl:with-param name="content"
+ select="$afterSpace"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+</xsl:template>
+
+<!--
+ reusable replace-string function
+ http://aspn.activestate.com/ASPN/Cookbook/XSLT/Recipe/65426
+ -->
+ <xsl:template name="replace-string">
+ <xsl:param name="text"/>
+ <xsl:param name="from"/>
+ <xsl:param name="to"/>
+
+ <xsl:choose>
+ <xsl:when test="contains($text, $from)">
+
+ <xsl:variable name="before" select="substring-before($text, $from)"/>
+ <xsl:variable name="after" select="substring-after($text, $from)"/>
+
+ <xsl:value-of select="$before"/>
+ <xsl:value-of select="$to"/>
+
+ <xsl:call-template name="replace-string">
+ <xsl:with-param name="text" select="$after"/>
+ <xsl:with-param name="from" select="$from"/>
+ <xsl:with-param name="to" select="$to"/>
+ </xsl:call-template>
+
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$text"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+</xsl:stylesheet>
+<!-- vim: et:ts=4:sw=4:sts=4
+-->
diff --git a/src/xmlpatterns/environment/environment.pri b/src/xmlpatterns/environment/environment.pri
new file mode 100644
index 0000000..b8a2b65
--- /dev/null
+++ b/src/xmlpatterns/environment/environment.pri
@@ -0,0 +1,32 @@
+HEADERS += $$PWD/qcurrentitemcontext_p.h \
+ $$PWD/qdelegatingdynamiccontext_p.h \
+ $$PWD/qdelegatingstaticcontext_p.h \
+ $$PWD/qdynamiccontext_p.h \
+ $$PWD/qfocus_p.h \
+ $$PWD/qgenericdynamiccontext_p.h \
+ $$PWD/qgenericstaticcontext_p.h \
+ $$PWD/qreceiverdynamiccontext_p.h \
+ $$PWD/qreportcontext_p.h \
+ $$PWD/qstackcontextbase_p.h \
+ $$PWD/qstaticbaseuricontext_p.h \
+ $$PWD/qstaticcontext_p.h \
+ $$PWD/qstaticcurrentcontext_p.h \
+ $$PWD/qstaticfocuscontext_p.h \
+ $$PWD/qstaticcompatibilitycontext_p.h \
+ $$PWD/qstaticnamespacecontext_p.h
+
+SOURCES += $$PWD/qcurrentitemcontext.cpp \
+ $$PWD/qdelegatingdynamiccontext.cpp \
+ $$PWD/qdelegatingstaticcontext.cpp \
+ $$PWD/qdynamiccontext.cpp \
+ $$PWD/qfocus.cpp \
+ $$PWD/qgenericdynamiccontext.cpp \
+ $$PWD/qgenericstaticcontext.cpp \
+ $$PWD/qreceiverdynamiccontext.cpp \
+ $$PWD/qreportcontext.cpp \
+ $$PWD/qstaticbaseuricontext.cpp \
+ $$PWD/qstaticcontext.cpp \
+ $$PWD/qstaticcurrentcontext.cpp \
+ $$PWD/qstaticfocuscontext.cpp \
+ $$PWD/qstaticcompatibilitycontext.cpp \
+ $$PWD/qstaticnamespacecontext.cpp
diff --git a/src/xmlpatterns/environment/qcurrentitemcontext.cpp b/src/xmlpatterns/environment/qcurrentitemcontext.cpp
new file mode 100644
index 0000000..117988f
--- /dev/null
+++ b/src/xmlpatterns/environment/qcurrentitemcontext.cpp
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 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 qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qdaytimeduration_p.h"
+
+#include "qcurrentitemcontext_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+CurrentItemContext::CurrentItemContext(const Item &item,
+ const DynamicContext::Ptr &prevContext) : DelegatingDynamicContext(prevContext)
+ , m_currentItem(item)
+{
+ Q_ASSERT(prevContext);
+}
+
+Item CurrentItemContext::currentItem() const
+{
+ return m_currentItem;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/environment/qcurrentitemcontext_p.h b/src/xmlpatterns/environment/qcurrentitemcontext_p.h
new file mode 100644
index 0000000..44ad245
--- /dev/null
+++ b/src/xmlpatterns/environment/qcurrentitemcontext_p.h
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 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 qt-sales@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_CurrentItemContext_H
+#define Patternist_CurrentItemContext_H
+
+#include "qdelegatingdynamiccontext_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short A DynamicContext that maintains the focus, a sequence
+ * of items.
+ *
+ * CurrentItemContext implements both the outer and inner focus. The focus is one of
+ * the things that characterizes the XPath language. The focus is what's
+ * iterated over in a predicate, whose current item can be received
+ * via the context item expression, <tt>.</tt>(the dot),
+ * and whose size is retrievable via the function <tt>fn:last()</tt>.
+ *
+ * @since 4.5
+ * @author Frans Englich <fenglich@trolltech.com>
+ */
+ class CurrentItemContext : public DelegatingDynamicContext
+ {
+ public:
+ CurrentItemContext(const Item &item,
+ const DynamicContext::Ptr &prevContext);
+
+ virtual Item currentItem() const;
+
+ private:
+ const Item m_currentItem;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/environment/qdelegatingdynamiccontext.cpp b/src/xmlpatterns/environment/qdelegatingdynamiccontext.cpp
new file mode 100644
index 0000000..197dc0d
--- /dev/null
+++ b/src/xmlpatterns/environment/qdelegatingdynamiccontext.cpp
@@ -0,0 +1,212 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 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 qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QDateTime>
+
+#include "qdaytimeduration_p.h"
+#include "qtemplatemode_p.h"
+
+#include "qdelegatingdynamiccontext_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+DelegatingDynamicContext::DelegatingDynamicContext(const DynamicContext::Ptr &prevContext)
+ : m_prevContext(prevContext)
+{
+ Q_ASSERT(m_prevContext);
+}
+
+ItemCacheCell &DelegatingDynamicContext::itemCacheCell(const VariableSlotID slot)
+{
+ return m_prevContext->itemCacheCell(slot);
+}
+
+ItemSequenceCacheCell::Vector &DelegatingDynamicContext::itemSequenceCacheCells(const VariableSlotID slot)
+{
+ return m_prevContext->itemSequenceCacheCells(slot);
+}
+
+xsInteger DelegatingDynamicContext::contextPosition() const
+{
+ return m_prevContext->contextPosition();
+}
+
+Item DelegatingDynamicContext::contextItem() const
+{
+ return m_prevContext->contextItem();
+}
+
+xsInteger DelegatingDynamicContext::contextSize()
+{
+ return m_prevContext->contextSize();
+}
+
+void DelegatingDynamicContext::setFocusIterator(const Item::Iterator::Ptr &it)
+{
+ m_prevContext->setFocusIterator(it);
+}
+
+Item::Iterator::Ptr DelegatingDynamicContext::positionIterator(const VariableSlotID slot) const
+{
+ return m_prevContext->positionIterator(slot);
+}
+
+void DelegatingDynamicContext::setPositionIterator(const VariableSlotID slot,
+ const Item::Iterator::Ptr &newValue)
+{
+ m_prevContext->setPositionIterator(slot, newValue);
+}
+
+void DelegatingDynamicContext::setRangeVariable(const VariableSlotID slotNumber,
+ const Item &newValue)
+{
+ m_prevContext->setRangeVariable(slotNumber, newValue);
+}
+
+Item::Iterator::Ptr DelegatingDynamicContext::focusIterator() const
+{
+ return m_prevContext->focusIterator();
+}
+
+Item DelegatingDynamicContext::rangeVariable(const VariableSlotID slotNumber) const
+{
+ return m_prevContext->rangeVariable(slotNumber);
+}
+
+void DelegatingDynamicContext::setExpressionVariable(const VariableSlotID slotNumber,
+ const Expression::Ptr &newValue)
+{
+ m_prevContext->setExpressionVariable(slotNumber, newValue);
+}
+
+Expression::Ptr DelegatingDynamicContext::expressionVariable(const VariableSlotID slotNumber) const
+{
+ return m_prevContext->expressionVariable(slotNumber);
+}
+
+QAbstractMessageHandler * DelegatingDynamicContext::messageHandler() const
+{
+ return m_prevContext->messageHandler();
+}
+
+QExplicitlySharedDataPointer<DayTimeDuration> DelegatingDynamicContext::implicitTimezone() const
+{
+ return m_prevContext->implicitTimezone();
+}
+
+QDateTime DelegatingDynamicContext::currentDateTime() const
+{
+ return m_prevContext->currentDateTime();
+}
+
+QAbstractXmlReceiver *DelegatingDynamicContext::outputReceiver() const
+{
+ return m_prevContext->outputReceiver();
+}
+
+NodeBuilder::Ptr DelegatingDynamicContext::nodeBuilder(const QUrl &baseURI) const
+{
+ return m_prevContext->nodeBuilder(baseURI);
+}
+
+ResourceLoader::Ptr DelegatingDynamicContext::resourceLoader() const
+{
+ return m_prevContext->resourceLoader();
+}
+
+ExternalVariableLoader::Ptr DelegatingDynamicContext::externalVariableLoader() const
+{
+ return m_prevContext->externalVariableLoader();
+}
+
+NamePool::Ptr DelegatingDynamicContext::namePool() const
+{
+ return m_prevContext->namePool();
+}
+
+QSourceLocation DelegatingDynamicContext::locationFor(const SourceLocationReflection *const reflection) const
+{
+ return m_prevContext->locationFor(reflection);
+}
+
+void DelegatingDynamicContext::addNodeModel(const QAbstractXmlNodeModel::Ptr &nm)
+{
+ m_prevContext->addNodeModel(nm);
+}
+
+const QAbstractUriResolver *DelegatingDynamicContext::uriResolver() const
+{
+ return m_prevContext->uriResolver();
+}
+
+ItemCacheCell &DelegatingDynamicContext::globalItemCacheCell(const VariableSlotID slot)
+{
+ return m_prevContext->globalItemCacheCell(slot);
+}
+
+ItemSequenceCacheCell::Vector &DelegatingDynamicContext::globalItemSequenceCacheCells(const VariableSlotID slot)
+{
+ return m_prevContext->globalItemSequenceCacheCells(slot);
+}
+
+Item DelegatingDynamicContext::currentItem() const
+{
+ return m_prevContext->currentItem();
+}
+
+DynamicContext::TemplateParameterHash &DelegatingDynamicContext::templateParameterStore()
+{
+ return m_prevContext->templateParameterStore();
+}
+
+DynamicContext::Ptr DelegatingDynamicContext::previousContext() const
+{
+ return m_prevContext;
+}
+
+QExplicitlySharedDataPointer<TemplateMode> DelegatingDynamicContext::currentTemplateMode() const
+{
+ return m_prevContext->currentTemplateMode();
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/environment/qdelegatingdynamiccontext_p.h b/src/xmlpatterns/environment/qdelegatingdynamiccontext_p.h
new file mode 100644
index 0000000..c269a90
--- /dev/null
+++ b/src/xmlpatterns/environment/qdelegatingdynamiccontext_p.h
@@ -0,0 +1,130 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 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 qt-sales@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_DelegatingDynamicContext_H
+#define Patternist_DelegatingDynamicContext_H
+
+#include "qdynamiccontext_p.h"
+#include "qexpression_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short Base class for dynamic contexts that are
+ * created from an existing one.
+ *
+ * In some cases multiple DynamicContext instances must be used in
+ * order to maintain somekind of scope. This class delegates
+ * the DynamicContext interface onto another DynamicContext instance,
+ * allowing the sub-class to only implement what it needs to.
+ *
+ * @author Frans Englich <fenglich@trolltech.com>
+ */
+ class DelegatingDynamicContext : public DynamicContext
+ {
+ public:
+ virtual xsInteger contextPosition() const;
+ virtual Item contextItem() const;
+ virtual xsInteger contextSize();
+
+ virtual ItemCacheCell &itemCacheCell(const VariableSlotID slot);
+ virtual ItemSequenceCacheCell::Vector &itemSequenceCacheCells(const VariableSlotID slot);
+
+ virtual void setRangeVariable(const VariableSlotID slotNumber,
+ const Item &newValue);
+ virtual Item rangeVariable(const VariableSlotID slotNumber) const;
+
+ virtual void setExpressionVariable(const VariableSlotID slotNumber,
+ const Expression::Ptr &newValue);
+ virtual Expression::Ptr expressionVariable(const VariableSlotID slotNumber) const;
+
+ virtual void setFocusIterator(const Item::Iterator::Ptr &it);
+ virtual Item::Iterator::Ptr focusIterator() const;
+
+ virtual Item::Iterator::Ptr positionIterator(const VariableSlotID slot) const;
+ virtual void setPositionIterator(const VariableSlotID slot,
+ const Item::Iterator::Ptr &newValue);
+
+ virtual QAbstractMessageHandler * messageHandler() const;
+ virtual QExplicitlySharedDataPointer<DayTimeDuration> implicitTimezone() const;
+ virtual QDateTime currentDateTime() const;
+ virtual QAbstractXmlReceiver *outputReceiver() const;
+ virtual NodeBuilder::Ptr nodeBuilder(const QUrl &baseURI) const;
+ virtual ResourceLoader::Ptr resourceLoader() const;
+ virtual ExternalVariableLoader::Ptr externalVariableLoader() const;
+ virtual NamePool::Ptr namePool() const;
+ virtual QSourceLocation locationFor(const SourceLocationReflection *const reflection) const;
+ virtual void addNodeModel(const QAbstractXmlNodeModel::Ptr &nm);
+ virtual const QAbstractUriResolver *uriResolver() const;
+ virtual ItemCacheCell &globalItemCacheCell(const VariableSlotID slot);
+ virtual ItemSequenceCacheCell::Vector &globalItemSequenceCacheCells(const VariableSlotID slot);
+ virtual Item currentItem() const;
+ virtual TemplateParameterHash &templateParameterStore();
+
+ virtual DynamicContext::Ptr previousContext() const;
+ virtual QExplicitlySharedDataPointer<TemplateMode> currentTemplateMode() const;
+
+ protected:
+ DelegatingDynamicContext(const DynamicContext::Ptr &prevContext);
+
+ const DynamicContext::Ptr m_prevContext;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/environment/qdelegatingstaticcontext.cpp b/src/xmlpatterns/environment/qdelegatingstaticcontext.cpp
new file mode 100644
index 0000000..51aeee8
--- /dev/null
+++ b/src/xmlpatterns/environment/qdelegatingstaticcontext.cpp
@@ -0,0 +1,261 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 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 qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/* Patternist */
+#include "qbasictypesfactory_p.h"
+#include "qfunctionfactorycollection_p.h"
+#include "qgenericnamespaceresolver_p.h"
+#include "qcommonnamespaces_p.h"
+#include "qgenericdynamiccontext_p.h"
+
+#include "qstaticfocuscontext_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+DelegatingStaticContext::DelegatingStaticContext(const StaticContext::Ptr &context) : m_context(context)
+{
+ Q_ASSERT(context);
+}
+
+NamespaceResolver::Ptr DelegatingStaticContext::namespaceBindings() const
+{
+ return m_context->namespaceBindings();
+}
+
+FunctionFactory::Ptr DelegatingStaticContext::functionSignatures() const
+{
+ return m_context->functionSignatures();
+}
+
+DynamicContext::Ptr DelegatingStaticContext::dynamicContext() const
+{
+ return m_context->dynamicContext();
+}
+
+SchemaTypeFactory::Ptr DelegatingStaticContext::schemaDefinitions() const
+{
+ return m_context->schemaDefinitions();
+}
+
+QUrl DelegatingStaticContext::baseURI() const
+{
+ return m_context->baseURI();
+}
+
+void DelegatingStaticContext::setBaseURI(const QUrl &uri)
+{
+ m_context->setBaseURI(uri);
+}
+
+bool DelegatingStaticContext::compatModeEnabled() const
+{
+ return m_context->compatModeEnabled();
+}
+
+QUrl DelegatingStaticContext::defaultCollation() const
+{
+ return m_context->defaultCollation();
+}
+
+QAbstractMessageHandler * DelegatingStaticContext::messageHandler() const
+{
+ return m_context->messageHandler();
+}
+
+void DelegatingStaticContext::setDefaultCollation(const QUrl &uri)
+{
+ m_context->setDefaultCollation(uri);
+}
+
+void DelegatingStaticContext::setNamespaceBindings(const NamespaceResolver::Ptr &resolver)
+{
+ m_context->setNamespaceBindings(resolver);
+}
+
+StaticContext::BoundarySpacePolicy DelegatingStaticContext::boundarySpacePolicy() const
+{
+ return m_context->boundarySpacePolicy();
+}
+
+void DelegatingStaticContext::setBoundarySpacePolicy(const BoundarySpacePolicy policy)
+{
+ m_context->setBoundarySpacePolicy(policy);
+}
+
+StaticContext::ConstructionMode DelegatingStaticContext::constructionMode() const
+{
+ return m_context->constructionMode();
+}
+
+void DelegatingStaticContext::setConstructionMode(const ConstructionMode mode)
+{
+ m_context->setConstructionMode(mode);
+}
+
+StaticContext::OrderingMode DelegatingStaticContext::orderingMode() const
+{
+ return m_context->orderingMode();
+}
+
+void DelegatingStaticContext::setOrderingMode(const OrderingMode mode)
+{
+ m_context->setOrderingMode(mode);
+}
+
+StaticContext::OrderingEmptySequence DelegatingStaticContext::orderingEmptySequence() const
+{
+ return m_context->orderingEmptySequence();
+}
+
+void DelegatingStaticContext::setOrderingEmptySequence(const OrderingEmptySequence ordering)
+{
+ m_context->setOrderingEmptySequence(ordering);
+}
+
+QString DelegatingStaticContext::defaultFunctionNamespace() const
+{
+ return m_context->defaultFunctionNamespace();
+}
+
+void DelegatingStaticContext::setDefaultFunctionNamespace(const QString &ns)
+{
+ m_context->setDefaultFunctionNamespace(ns);
+}
+
+QString DelegatingStaticContext::defaultElementNamespace() const
+{
+ return m_context->defaultElementNamespace();
+}
+
+void DelegatingStaticContext::setDefaultElementNamespace(const QString &ns)
+{
+ m_context->setDefaultElementNamespace(ns);
+}
+
+StaticContext::InheritMode DelegatingStaticContext::inheritMode() const
+{
+ return m_context->inheritMode();
+}
+
+void DelegatingStaticContext::setInheritMode(const InheritMode mode)
+{
+ m_context->setInheritMode(mode);
+}
+
+StaticContext::PreserveMode DelegatingStaticContext::preserveMode() const
+{
+ return m_context->preserveMode();
+}
+
+void DelegatingStaticContext::setPreserveMode(const PreserveMode mode)
+{
+ m_context->setPreserveMode(mode);
+}
+
+ItemType::Ptr DelegatingStaticContext::contextItemType() const
+{
+ return m_context->contextItemType();
+}
+
+ItemType::Ptr DelegatingStaticContext::currentItemType() const
+{
+ return m_context->currentItemType();
+}
+
+ExternalVariableLoader::Ptr DelegatingStaticContext::externalVariableLoader() const
+{
+ return m_context->externalVariableLoader();
+}
+
+StaticContext::Ptr DelegatingStaticContext::copy() const
+{
+ return StaticContext::Ptr(new DelegatingStaticContext(m_context->copy()));
+}
+
+ResourceLoader::Ptr DelegatingStaticContext::resourceLoader() const
+{
+ return m_context->resourceLoader();
+}
+
+NamePool::Ptr DelegatingStaticContext::namePool() const
+{
+ return m_context->namePool();
+}
+
+void DelegatingStaticContext::addLocation(const SourceLocationReflection *const reflection,
+ const QSourceLocation &location)
+{
+ m_context->addLocation(reflection, location);
+}
+
+StaticContext::LocationHash DelegatingStaticContext::sourceLocations() const
+{
+ return m_context->sourceLocations();
+}
+
+QSourceLocation DelegatingStaticContext::locationFor(const SourceLocationReflection *const reflection) const
+{
+ return m_context->locationFor(reflection);
+}
+
+const QAbstractUriResolver *DelegatingStaticContext::uriResolver() const
+{
+ return m_context->uriResolver();
+}
+
+VariableSlotID DelegatingStaticContext::currentRangeSlot() const
+{
+ return m_context->currentRangeSlot();
+}
+
+VariableSlotID DelegatingStaticContext::allocateRangeSlot()
+{
+ return m_context->allocateRangeSlot();
+}
+
+void DelegatingStaticContext::setCompatModeEnabled(const bool newVal)
+{
+ m_context->setCompatModeEnabled(newVal);
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/environment/qdelegatingstaticcontext_p.h b/src/xmlpatterns/environment/qdelegatingstaticcontext_p.h
new file mode 100644
index 0000000..527cda2
--- /dev/null
+++ b/src/xmlpatterns/environment/qdelegatingstaticcontext_p.h
@@ -0,0 +1,147 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 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 qt-sales@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_DelegatingStaticContext_H
+#define Patternist_DelegatingStaticContext_H
+
+#include <QUrl>
+
+#include "qstaticcontext_p.h"
+#include "qfunctionfactory_p.h"
+#include "qschematypefactory_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short Delegates all members to a second instance. Used for
+ * sub-classing.
+ *
+ * @author Frans Englich <fenglich@trolltech.com>
+ */
+ class Q_AUTOTEST_EXPORT DelegatingStaticContext : public StaticContext
+ {
+ public:
+ virtual NamespaceResolver::Ptr namespaceBindings() const;
+ virtual void setNamespaceBindings(const NamespaceResolver::Ptr &);
+
+ virtual FunctionFactory::Ptr functionSignatures() const;
+ virtual SchemaTypeFactory::Ptr schemaDefinitions() const;
+ virtual DynamicContext::Ptr dynamicContext() const;
+
+ virtual QUrl baseURI() const;
+ virtual void setBaseURI(const QUrl &uri);
+
+ virtual bool compatModeEnabled() const;
+ virtual void setCompatModeEnabled(const bool newVal);
+
+ virtual QUrl defaultCollation() const;
+
+ virtual QAbstractMessageHandler * messageHandler() const;
+
+ virtual void setDefaultCollation(const QUrl &uri);
+
+ virtual BoundarySpacePolicy boundarySpacePolicy() const;
+ virtual void setBoundarySpacePolicy(const BoundarySpacePolicy policy);
+
+ virtual ConstructionMode constructionMode() const;
+ virtual void setConstructionMode(const ConstructionMode mode);
+
+ virtual OrderingMode orderingMode() const;
+ virtual void setOrderingMode(const OrderingMode mode);
+ virtual OrderingEmptySequence orderingEmptySequence() const;
+ virtual void setOrderingEmptySequence(const OrderingEmptySequence ordering);
+
+ virtual QString defaultFunctionNamespace() const;
+ virtual void setDefaultFunctionNamespace(const QString &ns);
+
+ virtual QString defaultElementNamespace() const;
+ virtual void setDefaultElementNamespace(const QString &ns);
+
+ virtual InheritMode inheritMode() const;
+ virtual void setInheritMode(const InheritMode mode);
+
+ virtual PreserveMode preserveMode() const;
+ virtual void setPreserveMode(const PreserveMode mode);
+
+ virtual ItemType::Ptr contextItemType() const;
+ virtual ItemType::Ptr currentItemType() const;
+
+ virtual StaticContext::Ptr copy() const;
+
+ virtual ExternalVariableLoader::Ptr externalVariableLoader() const;
+ virtual ResourceLoader::Ptr resourceLoader() const;
+ virtual NamePool::Ptr namePool() const;
+ virtual void addLocation(const SourceLocationReflection *const reflection,
+ const QSourceLocation &location);
+ virtual LocationHash sourceLocations() const;
+ virtual QSourceLocation locationFor(const SourceLocationReflection *const reflection) const;
+ virtual const QAbstractUriResolver *uriResolver() const;
+
+ virtual VariableSlotID currentRangeSlot() const;
+ virtual VariableSlotID allocateRangeSlot();
+
+ protected:
+ DelegatingStaticContext(const StaticContext::Ptr &context);
+
+ private:
+ const StaticContext::Ptr m_context;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/environment/qdynamiccontext.cpp b/src/xmlpatterns/environment/qdynamiccontext.cpp
new file mode 100644
index 0000000..8276b77
--- /dev/null
+++ b/src/xmlpatterns/environment/qdynamiccontext.cpp
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 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 qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qfocus_p.h"
+#include "qreceiverdynamiccontext_p.h"
+#include "qstackcontextbase_p.h"
+
+#include "qdynamiccontext_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+DynamicContext::Ptr DynamicContext::createFocus()
+{
+ return Ptr(new Focus(Ptr(this)));
+}
+
+DynamicContext::Ptr DynamicContext::createStack()
+{
+ return Ptr(new StackContext(Ptr(this)));
+}
+
+DynamicContext::Ptr DynamicContext::createReceiverContext(QAbstractXmlReceiver *const receiver)
+{
+ Q_ASSERT(receiver);
+ return Ptr(new ReceiverDynamicContext(Ptr(this), receiver));
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/environment/qdynamiccontext_p.h b/src/xmlpatterns/environment/qdynamiccontext_p.h
new file mode 100644
index 0000000..61b0f56
--- /dev/null
+++ b/src/xmlpatterns/environment/qdynamiccontext_p.h
@@ -0,0 +1,231 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 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 qt-sales@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_DynamicContext_H
+#define Patternist_DynamicContext_H
+
+#include "qautoptr_p.h"
+#include "qcachecells_p.h"
+#include "qexternalvariableloader_p.h"
+#include "qitem_p.h"
+#include "qnamepool_p.h"
+#include "qnodebuilder_p.h"
+#include "qprimitives_p.h"
+#include "qreportcontext_p.h"
+#include "qresourceloader_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+class QDateTime;
+template<typename T> class QVector;
+
+namespace QPatternist
+{
+ class DayTimeDuration;
+ class Expression;
+ class TemplateMode;
+
+ /**
+ * @short Carries information and facilities used at runtime, and hence
+ * provides a state for that stage in a thread-safe manner.
+ *
+ * @see <a href="http://www.w3.org/TR/xquery/#eval_context">XQuery
+ * 1.0: An XML Query Language, 2.1.2 Dynamic Context</a>
+ * @see <a href="http://www.w3.org/TR/xquery/#id-dynamic-evaluation">XQuery
+ * 1.0: An XML Query Language, 2.2.3.2 Dynamic Evaluation Phase</a>
+ * @author Frans Englich <fenglich@trolltech.com>
+ */
+ class DynamicContext : public ReportContext
+ {
+ public:
+ /**
+ * @short Carries template parameters at runtime.
+ *
+ * The key is the name of the parameter, and the value the Expression
+ * which supplies the value.
+ */
+ typedef QHash<QXmlName, QExplicitlySharedDataPointer<Expression> > TemplateParameterHash;
+ typedef QExplicitlySharedDataPointer<DynamicContext> Ptr;
+
+ virtual ~DynamicContext()
+ {
+ }
+
+ /**
+ * This function intentionally returns by reference.
+ *
+ * @see globalItemCacheCell()
+ */
+ virtual ItemCacheCell &itemCacheCell(const VariableSlotID slot) = 0;
+
+ /**
+ * This function intentionally returns by reference.
+ *
+ * @see globalItemSequenceCacheCells
+ */
+ virtual ItemSequenceCacheCell::Vector &itemSequenceCacheCells(const VariableSlotID slot) = 0;
+
+ virtual xsInteger contextPosition() const = 0;
+ virtual Item contextItem() const = 0;
+ virtual xsInteger contextSize() = 0;
+
+ virtual void setRangeVariable(const VariableSlotID slot,
+ const Item &newValue) = 0;
+ virtual Item rangeVariable(const VariableSlotID slot) const = 0;
+ virtual void setExpressionVariable(const VariableSlotID slot,
+ const QExplicitlySharedDataPointer<Expression> &newValue) = 0;
+ virtual QExplicitlySharedDataPointer<Expression>
+ expressionVariable(const VariableSlotID slot) const = 0;
+
+ virtual Item::Iterator::Ptr positionIterator(const VariableSlotID slot) const = 0;
+ virtual void setPositionIterator(const VariableSlotID slot,
+ const Item::Iterator::Ptr &newValue) = 0;
+
+ virtual void setFocusIterator(const Item::Iterator::Ptr &it) = 0;
+ virtual Item::Iterator::Ptr focusIterator() const = 0;
+
+ virtual QExplicitlySharedDataPointer<DayTimeDuration> implicitTimezone() const = 0;
+ virtual QDateTime currentDateTime() const = 0;
+
+ virtual QAbstractXmlReceiver *outputReceiver() const = 0;
+ virtual NodeBuilder::Ptr nodeBuilder(const QUrl &baseURI) const = 0;
+ virtual ResourceLoader::Ptr resourceLoader() const = 0;
+ virtual ExternalVariableLoader::Ptr externalVariableLoader() const = 0;
+ virtual NamePool::Ptr namePool() const = 0;
+
+ /**
+ * @short Returns the item that @c fn:current() returns.
+ *
+ * Hence, this is not the focus, and very different from the focus.
+ *
+ * @see CurrentItemStore
+ * @see CurrentFN
+ */
+ virtual Item currentItem() const = 0;
+
+ DynamicContext::Ptr createFocus();
+ DynamicContext::Ptr createStack();
+ DynamicContext::Ptr createReceiverContext(QAbstractXmlReceiver *const receiver);
+
+ /**
+ * Whenever a tree gets built, this function is called. DynamicContext
+ * has the responsibility of keeping a copy of @p nm, such that it
+ * doesn't go out of scope, since no one else will reference @p nm.
+ *
+ * I think this is currently only used for temporary node trees. In
+ * other cases they are stored in the ExternalResourceLoader.
+ *
+ * The caller guarantees that @p nm is not @c null.
+ */
+ virtual void addNodeModel(const QAbstractXmlNodeModel::Ptr &nm) = 0;
+
+ /**
+ * Same as itemCacheCell(), but is only used for global varibles. This
+ * is needed because sometimes stack frames needs to be created for
+ * other kinds of variables(such as in the case of user function
+ * calls), while the global variable(s) needs to continue to use the
+ * same cache, instead of one for each new stack frame, typically an
+ * instance of StackContextBase.
+ *
+ * This has two effects:
+ *
+ * - It's an optimization. Instead of that a global variable gets evaluated each
+ * time a user function is called, think recursive functions, it's done
+ * only once.
+ * - Query stability, hence affects things like node identity and
+ * therefore conformance. Hence affects for instance what nodes a query
+ * returns, since node identity affect node deduplication.
+ */
+ virtual ItemCacheCell &globalItemCacheCell(const VariableSlotID slot) = 0;
+
+ /**
+ * @short When a template is called, this member carries the template
+ * parameters.
+ *
+ * Hence this is similar to the other variable stack functions such as
+ * rangeVariable() and expressionVariable(), the difference being that
+ * the order of template parameters as well as its arguments can appear
+ * in arbitrary order. Hence the name is used to make the order
+ * insignificant.
+ */
+ virtual TemplateParameterHash &templateParameterStore() = 0;
+
+ /**
+ * Same as itemSequenceCacheCells() but applies only for global
+ * variables.
+ *
+ * @see globalItemCacheCell()
+ */
+ virtual ItemSequenceCacheCell::Vector &globalItemSequenceCacheCells(const VariableSlotID slot) = 0;
+
+ /**
+ * @short Returns the previous DynamicContext. If this context is the
+ * top-level one, @c null is returned.
+ */
+ virtual DynamicContext::Ptr previousContext() const = 0;
+
+ /**
+ * @short Returns the current template mode that is in effect.
+ *
+ * If @c null is returned, it means that the default mode should be
+ * used as the current mode.
+ */
+ virtual QExplicitlySharedDataPointer<TemplateMode> currentTemplateMode() const = 0;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/environment/qfocus.cpp b/src/xmlpatterns/environment/qfocus.cpp
new file mode 100644
index 0000000..1ce3e0f
--- /dev/null
+++ b/src/xmlpatterns/environment/qfocus.cpp
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 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 qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qdaytimeduration_p.h"
+
+#include "qfocus_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+Focus::Focus(const DynamicContext::Ptr &prevContext) : DelegatingDynamicContext(prevContext),
+ m_contextSizeCached(-1)
+{
+ Q_ASSERT(prevContext);
+ Q_ASSERT(prevContext != this);
+}
+
+xsInteger Focus::contextPosition() const
+{
+ Q_ASSERT(m_focusIterator);
+ return m_focusIterator->position();
+}
+
+Item Focus::contextItem() const
+{
+ Q_ASSERT(m_focusIterator);
+ return m_focusIterator->current();
+}
+
+xsInteger Focus::contextSize()
+{
+ Q_ASSERT(m_focusIterator);
+ if(m_contextSizeCached == -1)
+ m_contextSizeCached = m_focusIterator->copy()->count();
+
+ Q_ASSERT_X(m_contextSizeCached == m_focusIterator->copy()->count(), Q_FUNC_INFO,
+ "If our cache is not the same as the real count, something is wrong.");
+
+ return m_contextSizeCached;
+}
+
+void Focus::setFocusIterator(const Item::Iterator::Ptr &it)
+{
+ Q_ASSERT(it);
+ m_focusIterator = it;
+}
+
+Item::Iterator::Ptr Focus::focusIterator() const
+{
+ return m_focusIterator;
+}
+
+Item Focus::currentItem() const
+{
+ /* In the case that there is no top level expression that creates a focus,
+ * fn:current() should return the focus. This logic achieves this.
+ * Effectively we traverse up our "context stack" through recursion, and
+ * start returning when we've found the top most focus. */
+
+ const Item current(m_prevContext->currentItem());
+
+ if(current.isNull())
+ return m_focusIterator->current();
+ else
+ return current;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/environment/qfocus_p.h b/src/xmlpatterns/environment/qfocus_p.h
new file mode 100644
index 0000000..08b9d26
--- /dev/null
+++ b/src/xmlpatterns/environment/qfocus_p.h
@@ -0,0 +1,103 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 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 qt-sales@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_Focus_H
+#define Patternist_Focus_H
+
+#include "qdelegatingdynamiccontext_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short A DynamicContext that maintains the focus, a sequence
+ * of items.
+ *
+ * Focus implements both the outer and inner focus. The focus is one of
+ * the things that characterizes the XPath language. The focus is what's
+ * iterated over in a predicate, whose current item can be received
+ * via the context item expression, <tt>.</tt>(the dot),
+ * and whose size is retrievable via the function <tt>fn:last()</tt>.
+ *
+ * @author Frans Englich <fenglich@trolltech.com>
+ */
+ class Focus : public DelegatingDynamicContext
+ {
+ public:
+ Focus(const DynamicContext::Ptr &prevContext);
+
+ virtual xsInteger contextPosition() const;
+ virtual Item contextItem() const;
+ virtual xsInteger contextSize();
+
+ virtual void setFocusIterator(const Item::Iterator::Ptr &it);
+ virtual Item::Iterator::Ptr focusIterator() const;
+
+ /**
+ * If there is no top level expression that sets the current item,
+ * the focus should be used. This implementation ensures that.
+ */
+ virtual Item currentItem() const;
+
+ private:
+ Item::Iterator::Ptr m_focusIterator;
+ xsInteger m_contextSizeCached;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/environment/qgenericdynamiccontext.cpp b/src/xmlpatterns/environment/qgenericdynamiccontext.cpp
new file mode 100644
index 0000000..86db046
--- /dev/null
+++ b/src/xmlpatterns/environment/qgenericdynamiccontext.cpp
@@ -0,0 +1,205 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 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 qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qcommonvalues_p.h"
+#include "qfocus_p.h"
+#include "qtemplatemode_p.h"
+
+#include "qgenericdynamiccontext_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+GenericDynamicContext::GenericDynamicContext(const NamePool::Ptr &np,
+ QAbstractMessageHandler *const errHandler,
+ const LocationHash &locations) : m_messageHandler(errHandler)
+ , m_currentDateTime(QDateTime::currentDateTime().toTimeSpec(Qt::UTC))
+ , m_outputReceiver(0)
+ , m_namePool(np)
+ , m_locations(locations)
+ , m_uriResolver(0)
+{
+ Q_ASSERT(m_messageHandler);
+ Q_ASSERT(m_namePool);
+}
+
+QExplicitlySharedDataPointer<DayTimeDuration> GenericDynamicContext::implicitTimezone() const
+{
+ /* Or what do you prefer, sir? */
+ return CommonValues::DayTimeDurationZero;
+}
+
+QAbstractMessageHandler * GenericDynamicContext::messageHandler() const
+{
+ return m_messageHandler;
+}
+
+QDateTime GenericDynamicContext::currentDateTime() const
+{
+ return m_currentDateTime;
+}
+
+xsInteger GenericDynamicContext::contextPosition() const
+{
+ Q_ASSERT_X(false, Q_FUNC_INFO, "That this function is called makes no sense. A Focus should be used.");
+ return 0;
+}
+
+Item GenericDynamicContext::contextItem() const
+{
+ return Item();
+}
+
+xsInteger GenericDynamicContext::contextSize()
+{
+ Q_ASSERT_X(false, Q_FUNC_INFO, "That this function is called makes no sense. A Focus should be used.");
+ return 0;
+}
+
+void GenericDynamicContext::setFocusIterator(const Item::Iterator::Ptr &)
+{
+ Q_ASSERT_X(false, Q_FUNC_INFO, "That this function is called makes no sense. A Focus should be used.");
+}
+
+Item::Iterator::Ptr GenericDynamicContext::focusIterator() const
+{
+ return Item::Iterator::Ptr();
+}
+
+QAbstractXmlReceiver *GenericDynamicContext::outputReceiver() const
+{
+ return m_outputReceiver;
+}
+
+void GenericDynamicContext::setOutputReceiver(QAbstractXmlReceiver *const receiver)
+{
+ m_outputReceiver = receiver;
+}
+
+void GenericDynamicContext::setNodeBuilder(NodeBuilder::Ptr &builder)
+{
+ m_nodeBuilder = builder;
+}
+
+NodeBuilder::Ptr GenericDynamicContext::nodeBuilder(const QUrl &baseURI) const
+{
+ return m_nodeBuilder->create(baseURI);
+}
+
+ResourceLoader::Ptr GenericDynamicContext::resourceLoader() const
+{
+ return m_resourceLoader;
+}
+
+void GenericDynamicContext::setResourceLoader(const ResourceLoader::Ptr &loader)
+{
+ m_resourceLoader = loader;
+}
+
+ExternalVariableLoader::Ptr GenericDynamicContext::externalVariableLoader() const
+{
+ return m_externalVariableLoader;
+}
+
+void GenericDynamicContext::setExternalVariableLoader(const ExternalVariableLoader::Ptr &loader)
+{
+ m_externalVariableLoader = loader;
+}
+
+NamePool::Ptr GenericDynamicContext::namePool() const
+{
+ return m_namePool;
+}
+
+QSourceLocation GenericDynamicContext::locationFor(const SourceLocationReflection *const reflection) const
+{
+
+ return m_locations.value(reflection->actualReflection());
+}
+
+void GenericDynamicContext::addNodeModel(const QAbstractXmlNodeModel::Ptr &nm)
+{
+ m_nodeModels.append(nm);
+}
+
+const QAbstractUriResolver *GenericDynamicContext::uriResolver() const
+{
+ return m_uriResolver;
+}
+
+ItemCacheCell &GenericDynamicContext::globalItemCacheCell(const VariableSlotID slot)
+{
+ if(slot >= m_globalItemCacheCells.size())
+ m_globalItemCacheCells.resize(qMax(slot + 1, m_globalItemCacheCells.size()));
+
+ return m_globalItemCacheCells[slot];
+}
+
+ItemSequenceCacheCell::Vector &GenericDynamicContext::globalItemSequenceCacheCells(const VariableSlotID slot)
+{
+ if(slot >= m_globalItemSequenceCacheCells.size())
+ m_globalItemSequenceCacheCells.resize(qMax(slot + 1, m_globalItemSequenceCacheCells.size()));
+
+ return m_globalItemSequenceCacheCells;
+}
+
+void GenericDynamicContext::setUriResolver(const QAbstractUriResolver *const resolver)
+{
+ m_uriResolver = resolver;
+}
+
+Item GenericDynamicContext::currentItem() const
+{
+ return Item();
+}
+
+DynamicContext::Ptr GenericDynamicContext::previousContext() const
+{
+ return DynamicContext::Ptr();
+}
+
+QExplicitlySharedDataPointer<TemplateMode> GenericDynamicContext::currentTemplateMode() const
+{
+ return QExplicitlySharedDataPointer<TemplateMode>();
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/environment/qgenericdynamiccontext_p.h b/src/xmlpatterns/environment/qgenericdynamiccontext_p.h
new file mode 100644
index 0000000..619c54f
--- /dev/null
+++ b/src/xmlpatterns/environment/qgenericdynamiccontext_p.h
@@ -0,0 +1,155 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 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 qt-sales@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_GenericDynamicContext_H
+#define Patternist_GenericDynamicContext_H
+
+#include <QDateTime>
+#include <QVector>
+
+#include "qdaytimeduration_p.h"
+#include "qstackcontextbase_p.h"
+#include "qexpression_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short A DynamicContext supplying basic information that always is used.
+ *
+ * This DynamicContext is the first DynamicContext used during
+ * a run and is always used. In addition, more contexts, such as
+ * a Focus can be created.
+ *
+ * @author Frans Englich <fenglich@trolltech.com>
+ */
+ class GenericDynamicContext : public StackContextBase<DynamicContext>
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<GenericDynamicContext> Ptr;
+
+ GenericDynamicContext(const NamePool::Ptr &np,
+ QAbstractMessageHandler *const messageHandler,
+ const LocationHash &locations);
+
+ virtual xsInteger contextPosition() const;
+ /**
+ * @returns always @c null, the focus is always undefined when an GenericDynamicContext
+ * is used.
+ */
+ virtual Item contextItem() const;
+ virtual xsInteger contextSize();
+
+ virtual void setFocusIterator(const Item::Iterator::Ptr &it);
+ virtual Item::Iterator::Ptr focusIterator() const;
+
+ virtual QAbstractMessageHandler * messageHandler() const;
+ virtual QExplicitlySharedDataPointer<DayTimeDuration> implicitTimezone() const;
+ virtual QDateTime currentDateTime() const;
+
+ virtual QAbstractXmlReceiver *outputReceiver() const;
+ void setOutputReceiver(QAbstractXmlReceiver *const receiver);
+
+ virtual NodeBuilder::Ptr nodeBuilder(const QUrl &baseURI) const;
+ void setNodeBuilder(NodeBuilder::Ptr &builder);
+
+ virtual ResourceLoader::Ptr resourceLoader() const;
+ void setResourceLoader(const ResourceLoader::Ptr &loader);
+
+ virtual ExternalVariableLoader::Ptr externalVariableLoader() const;
+ void setExternalVariableLoader(const ExternalVariableLoader::Ptr &loader);
+ virtual NamePool::Ptr namePool() const;
+ virtual QSourceLocation locationFor(const SourceLocationReflection *const reflection) const;
+ virtual void addNodeModel(const QAbstractXmlNodeModel::Ptr &nm);
+ virtual const QAbstractUriResolver *uriResolver() const;
+ virtual ItemCacheCell &globalItemCacheCell(const VariableSlotID slot);
+ virtual ItemSequenceCacheCell::Vector &globalItemSequenceCacheCells(const VariableSlotID slot);
+
+ void setUriResolver(const QAbstractUriResolver *const resolver);
+
+ /**
+ * We return a null item, we have no focus.
+ */
+ virtual Item currentItem() const;
+
+ /**
+ * @short Returns always @c null, since we're always
+ * a top-level context.
+ */
+ virtual DynamicContext::Ptr previousContext() const;
+
+ virtual QExplicitlySharedDataPointer<TemplateMode> currentTemplateMode() const;
+
+ private:
+ QAbstractMessageHandler * m_messageHandler;
+ const QDateTime m_currentDateTime;
+ const DayTimeDuration::Ptr m_zoneOffset;
+ QAbstractXmlReceiver * m_outputReceiver;
+ mutable NodeBuilder::Ptr m_nodeBuilder;
+ ExternalVariableLoader::Ptr m_externalVariableLoader;
+ ResourceLoader::Ptr m_resourceLoader;
+ NamePool::Ptr m_namePool;
+ const LocationHash m_locations;
+ QAbstractXmlNodeModel::List m_nodeModels;
+ const QAbstractUriResolver * m_uriResolver;
+ ItemCacheCell::Vector m_globalItemCacheCells;
+ ItemSequenceCacheCell::Vector m_globalItemSequenceCacheCells;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/environment/qgenericstaticcontext.cpp b/src/xmlpatterns/environment/qgenericstaticcontext.cpp
new file mode 100644
index 0000000..61a979f
--- /dev/null
+++ b/src/xmlpatterns/environment/qgenericstaticcontext.cpp
@@ -0,0 +1,340 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 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 qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QCoreApplication>
+
+/* Patternist */
+#include "qbasictypesfactory_p.h"
+#include "qcommonnamespaces_p.h"
+#include "qgenericdynamiccontext_p.h"
+#include "qfunctionfactorycollection_p.h"
+#include "qgenericnamespaceresolver_p.h"
+
+#include "qgenericstaticcontext_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+GenericStaticContext::GenericStaticContext(const NamePool::Ptr &np,
+ QAbstractMessageHandler *const handler,
+ const QUrl &aBaseURI,
+ const FunctionFactory::Ptr &factory,
+ const QXmlQuery::QueryLanguage lang) : m_boundarySpacePolicy(BSPStrip)
+ , m_constructionMode(CMPreserve)
+ , m_functionFactory(factory)
+ , m_defaultFunctionNamespace(CommonNamespaces::XFN)
+ , m_orderingEmptySequence(Greatest)
+ , m_orderingMode(Ordered)
+ , m_defaultCollation(QUrl::fromEncoded(CommonNamespaces::UNICODE_COLLATION))
+ , m_baseURI(aBaseURI)
+ , m_messageHandler(handler)
+ , m_preserveMode(Preserve)
+ , m_inheritMode(Inherit)
+ , m_namespaceResolver(lang == QXmlQuery::XQuery10
+ ? GenericNamespaceResolver::defaultXQueryBindings()
+ : GenericNamespaceResolver::defaultXSLTBindings())
+ , m_namePool(np)
+ , m_uriResolver(0)
+ , m_queryLanguage(lang)
+ , m_rangeSlot(-1)
+ , m_compatModeEnabled(false)
+{
+ /* We'll easily have at least this many AST nodes, that we need
+ * to track locations for. */
+ m_locations.reserve(30);
+
+ Q_ASSERT(np);
+ Q_ASSERT(!m_baseURI.isRelative());
+}
+
+NamespaceResolver::Ptr GenericStaticContext::namespaceBindings() const
+{
+ return m_namespaceResolver;
+}
+
+FunctionFactory::Ptr GenericStaticContext::functionSignatures() const
+{
+ return m_functionFactory;
+}
+
+DynamicContext::Ptr GenericStaticContext::dynamicContext() const
+{
+ GenericDynamicContext::Ptr context(new GenericDynamicContext(m_namePool, m_messageHandler, sourceLocations()));
+ // TODO we have many bugs here..
+ context->setResourceLoader(m_resourceLoader);
+ return context;
+}
+
+SchemaTypeFactory::Ptr GenericStaticContext::schemaDefinitions() const
+{
+ return BasicTypesFactory::self(m_namePool);
+}
+
+QUrl GenericStaticContext::baseURI() const
+{
+ Q_ASSERT_X(!m_baseURI.isRelative(), Q_FUNC_INFO,
+ "The static base-uri must be absolute. This error is most likely caused by misuing the API.");
+ return m_baseURI;
+}
+
+void GenericStaticContext::setBaseURI(const QUrl &uri)
+{
+ Q_ASSERT(!uri.isRelative());
+ m_baseURI = uri;
+}
+
+bool GenericStaticContext::compatModeEnabled() const
+{
+ return m_compatModeEnabled;
+}
+
+void GenericStaticContext::setCompatModeEnabled(const bool newVal)
+{
+ m_compatModeEnabled = newVal;
+}
+
+QUrl GenericStaticContext::defaultCollation() const
+{
+ return m_defaultCollation;
+}
+
+QAbstractMessageHandler * GenericStaticContext::messageHandler() const
+{
+ return m_messageHandler;
+}
+
+void GenericStaticContext::setDefaultCollation(const QUrl &uri)
+{
+ m_defaultCollation = uri;
+}
+
+void GenericStaticContext::setNamespaceBindings(const NamespaceResolver::Ptr &resolver)
+{
+ Q_ASSERT(resolver);
+ m_namespaceResolver = resolver;
+}
+
+StaticContext::BoundarySpacePolicy GenericStaticContext::boundarySpacePolicy() const
+{
+ return m_boundarySpacePolicy;
+}
+
+void GenericStaticContext::setBoundarySpacePolicy(const BoundarySpacePolicy policy)
+{
+ Q_ASSERT(policy == BSPPreserve || policy == BSPStrip);
+ m_boundarySpacePolicy = policy;
+}
+
+StaticContext::ConstructionMode GenericStaticContext::constructionMode() const
+{
+ return m_constructionMode;
+}
+
+void GenericStaticContext::setConstructionMode(const ConstructionMode mode)
+{
+ Q_ASSERT(mode == CMPreserve || mode == CMStrip);
+ m_constructionMode = mode;
+}
+
+StaticContext::OrderingMode GenericStaticContext::orderingMode() const
+{
+ return m_orderingMode;
+}
+
+void GenericStaticContext::setOrderingMode(const OrderingMode mode)
+{
+ Q_ASSERT(mode == Ordered || mode == Unordered);
+ m_orderingMode = mode;
+}
+
+StaticContext::OrderingEmptySequence GenericStaticContext::orderingEmptySequence() const
+{
+ return m_orderingEmptySequence;
+}
+
+void GenericStaticContext::setOrderingEmptySequence(const OrderingEmptySequence ordering)
+{
+ Q_ASSERT(ordering == Greatest || ordering == Least);
+ m_orderingEmptySequence = ordering;
+}
+
+QString GenericStaticContext::defaultFunctionNamespace() const
+{
+ return m_defaultFunctionNamespace;
+}
+
+void GenericStaticContext::setDefaultFunctionNamespace(const QString &ns)
+{
+ m_defaultFunctionNamespace = ns;
+}
+
+
+QString GenericStaticContext::defaultElementNamespace() const
+{
+ return m_defaultElementNamespace;
+}
+
+void GenericStaticContext::setDefaultElementNamespace(const QString &ns)
+{
+ m_defaultElementNamespace = ns;
+}
+
+StaticContext::InheritMode GenericStaticContext::inheritMode() const
+{
+ return m_inheritMode;
+}
+
+void GenericStaticContext::setInheritMode(const InheritMode mode)
+{
+ Q_ASSERT(mode == Inherit || mode == NoInherit);
+ m_inheritMode = mode;
+}
+
+StaticContext::PreserveMode GenericStaticContext::preserveMode() const
+{
+ return m_preserveMode;
+}
+
+void GenericStaticContext::setPreserveMode(const PreserveMode mode)
+{
+ Q_ASSERT(mode == Preserve || mode == NoPreserve);
+ m_preserveMode = mode;
+}
+
+ItemType::Ptr GenericStaticContext::contextItemType() const
+{
+ return m_contextItemType;
+}
+
+ItemType::Ptr GenericStaticContext::currentItemType() const
+{
+ return contextItemType();
+}
+
+void GenericStaticContext::setContextItemType(const ItemType::Ptr &type)
+{
+ m_contextItemType = type;
+}
+
+StaticContext::Ptr GenericStaticContext::copy() const
+{
+ GenericStaticContext *const retval = new GenericStaticContext(m_namePool, m_messageHandler, m_baseURI, m_functionFactory, m_queryLanguage);
+ const NamespaceResolver::Ptr newSolver(new GenericNamespaceResolver(m_namespaceResolver->bindings()));
+
+ retval->setNamespaceBindings(newSolver);
+ retval->setDefaultCollation(m_defaultCollation);
+ retval->setBoundarySpacePolicy(m_boundarySpacePolicy);
+ retval->setConstructionMode(m_constructionMode);
+ retval->setOrderingMode(m_orderingMode);
+ retval->setOrderingEmptySequence(m_orderingEmptySequence);
+ retval->setDefaultFunctionNamespace(m_defaultFunctionNamespace);
+ retval->setInheritMode(m_inheritMode);
+ retval->setPreserveMode(m_preserveMode);
+ retval->setExternalVariableLoader(m_externalVariableLoader);
+ retval->setResourceLoader(m_resourceLoader);
+ retval->setContextItemType(m_contextItemType);
+ retval->m_locations = m_locations;
+
+ return StaticContext::Ptr(retval);
+}
+
+ResourceLoader::Ptr GenericStaticContext::resourceLoader() const
+{
+ return m_resourceLoader;
+}
+
+void GenericStaticContext::setResourceLoader(const ResourceLoader::Ptr &loader)
+{
+ m_resourceLoader = loader;
+}
+
+ExternalVariableLoader::Ptr GenericStaticContext::externalVariableLoader() const
+{
+ return m_externalVariableLoader;
+}
+
+void GenericStaticContext::setExternalVariableLoader(const ExternalVariableLoader::Ptr &loader)
+{
+ m_externalVariableLoader = loader;
+}
+
+NamePool::Ptr GenericStaticContext::namePool() const
+{
+ return m_namePool;
+}
+
+void GenericStaticContext::addLocation(const SourceLocationReflection *const reflection,
+ const QSourceLocation &location)
+{
+ Q_ASSERT(!location.isNull());
+ Q_ASSERT_X(reflection, Q_FUNC_INFO,
+ "The reflection cannot be zero.");
+ m_locations.insert(reflection, location);
+}
+
+StaticContext::LocationHash GenericStaticContext::sourceLocations() const
+{
+ return m_locations;
+}
+
+QSourceLocation GenericStaticContext::locationFor(const SourceLocationReflection *const reflection) const
+{
+ return m_locations.value(reflection->actualReflection());
+}
+
+QAbstractUriResolver *GenericStaticContext::uriResolver() const
+{
+ return m_uriResolver;
+}
+
+VariableSlotID GenericStaticContext::currentRangeSlot() const
+{
+ return m_rangeSlot;
+}
+
+VariableSlotID GenericStaticContext::allocateRangeSlot()
+{
+ ++m_rangeSlot;
+ return m_rangeSlot;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/environment/qgenericstaticcontext_p.h b/src/xmlpatterns/environment/qgenericstaticcontext_p.h
new file mode 100644
index 0000000..42204ea
--- /dev/null
+++ b/src/xmlpatterns/environment/qgenericstaticcontext_p.h
@@ -0,0 +1,199 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 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 qt-sales@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_GenericStaticContext_H
+#define Patternist_GenericStaticContext_H
+
+#include <QUrl>
+#include <QXmlQuery>
+
+#include "qstaticcontext_p.h"
+#include "qfunctionfactory_p.h"
+#include "qschematypefactory_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short Provides setters and getters for the properties defined in StaticContext.
+ *
+ * @author Frans Englich <fenglich@trolltech.com>
+ */
+ class GenericStaticContext : public StaticContext
+ {
+ public:
+ typedef QExplicitlySharedDataPointer<GenericStaticContext> Ptr;
+ /**
+ * Constructs a GenericStaticContext. The components are initialized as per
+ * the recommended default values in XQuery 1.0. <tt>Default order for empty sequences</tt>,
+ * orderingEmptySequence(), is initialized to Greatest.
+ *
+ * @see <a href="http://www.w3.org/TR/xquery/#id-xq-static-context-components">XQuery
+ * 1.0: An XML Query Language, C.1 Static Context Components</a>
+ * @param errorHandler the error handler. May be null.
+ * @param np the NamePool. May not be null.
+ * @param aBaseURI the base URI in the static context. Must be absolute
+ * and valid.
+ */
+ GenericStaticContext(const NamePool::Ptr &np,
+ QAbstractMessageHandler *const errorHandler,
+ const QUrl &aBaseURI,
+ const FunctionFactory::Ptr &factory,
+ const QXmlQuery::QueryLanguage lang);
+
+ virtual NamespaceResolver::Ptr namespaceBindings() const;
+ virtual void setNamespaceBindings(const NamespaceResolver::Ptr &);
+
+ virtual FunctionFactory::Ptr functionSignatures() const;
+ virtual SchemaTypeFactory::Ptr schemaDefinitions() const;
+
+ /**
+ * Returns a DynamicContext used for evaluation at compile time.
+ *
+ * @bug The DynamicContext isn't stable. It should be cached privately.
+ */
+ virtual DynamicContext::Ptr dynamicContext() const;
+
+ virtual QUrl baseURI() const;
+ virtual void setBaseURI(const QUrl &uri);
+
+ virtual bool compatModeEnabled() const;
+ virtual void setCompatModeEnabled(const bool newVal);
+
+ /**
+ * @returns always the Unicode codepoint collation URI
+ */
+ virtual QUrl defaultCollation() const;
+
+ virtual QAbstractMessageHandler * messageHandler() const;
+
+ virtual void setDefaultCollation(const QUrl &uri);
+
+ virtual BoundarySpacePolicy boundarySpacePolicy() const;
+ virtual void setBoundarySpacePolicy(const BoundarySpacePolicy policy);
+
+ virtual ConstructionMode constructionMode() const;
+ virtual void setConstructionMode(const ConstructionMode mode);
+
+ virtual OrderingMode orderingMode() const;
+ virtual void setOrderingMode(const OrderingMode mode);
+ virtual OrderingEmptySequence orderingEmptySequence() const;
+ virtual void setOrderingEmptySequence(const OrderingEmptySequence ordering);
+
+ virtual QString defaultFunctionNamespace() const;
+ virtual void setDefaultFunctionNamespace(const QString &ns);
+
+ virtual QString defaultElementNamespace() const;
+ virtual void setDefaultElementNamespace(const QString &ns);
+
+ virtual InheritMode inheritMode() const;
+ virtual void setInheritMode(const InheritMode mode);
+
+ virtual PreserveMode preserveMode() const;
+ virtual void setPreserveMode(const PreserveMode mode);
+
+ virtual ItemType::Ptr contextItemType() const;
+ void setContextItemType(const ItemType::Ptr &type);
+ virtual ItemType::Ptr currentItemType() const;
+
+ virtual StaticContext::Ptr copy() const;
+
+ virtual ResourceLoader::Ptr resourceLoader() const;
+ void setResourceLoader(const ResourceLoader::Ptr &loader);
+
+ virtual ExternalVariableLoader::Ptr externalVariableLoader() const;
+ void setExternalVariableLoader(const ExternalVariableLoader::Ptr &loader);
+ virtual NamePool::Ptr namePool() const;
+
+ virtual void addLocation(const SourceLocationReflection *const reflection,
+ const QSourceLocation &location);
+ virtual QSourceLocation locationFor(const SourceLocationReflection *const reflection) const;
+
+ virtual LocationHash sourceLocations() const;
+ virtual QAbstractUriResolver *uriResolver() const;
+
+ virtual VariableSlotID currentRangeSlot() const;
+ virtual VariableSlotID allocateRangeSlot();
+
+ private:
+ BoundarySpacePolicy m_boundarySpacePolicy;
+ ConstructionMode m_constructionMode;
+ FunctionFactory::Ptr m_functionFactory;
+ QString m_defaultElementNamespace;
+ QString m_defaultFunctionNamespace;
+ OrderingEmptySequence m_orderingEmptySequence;
+ OrderingMode m_orderingMode;
+ QUrl m_defaultCollation;
+ QUrl m_baseURI;
+ QAbstractMessageHandler * m_messageHandler;
+ PreserveMode m_preserveMode;
+ InheritMode m_inheritMode;
+ NamespaceResolver::Ptr m_namespaceResolver;
+ ExternalVariableLoader::Ptr m_externalVariableLoader;
+ ResourceLoader::Ptr m_resourceLoader;
+ const NamePool::Ptr m_namePool;
+ ItemType::Ptr m_contextItemType;
+ LocationHash m_locations;
+ QAbstractUriResolver * m_uriResolver;
+ QXmlQuery::QueryLanguage m_queryLanguage;
+ VariableSlotID m_rangeSlot;
+ bool m_compatModeEnabled;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/environment/qreceiverdynamiccontext.cpp b/src/xmlpatterns/environment/qreceiverdynamiccontext.cpp
new file mode 100644
index 0000000..909b471
--- /dev/null
+++ b/src/xmlpatterns/environment/qreceiverdynamiccontext.cpp
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 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 qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qreceiverdynamiccontext_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+ReceiverDynamicContext::
+ReceiverDynamicContext(const DynamicContext::Ptr &prevContext,
+ QAbstractXmlReceiver *const receiver) : DelegatingDynamicContext(prevContext)
+ , m_receiver(receiver)
+{
+ Q_ASSERT(receiver);
+}
+
+QAbstractXmlReceiver *ReceiverDynamicContext::outputReceiver() const
+{
+ return m_receiver;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/environment/qreceiverdynamiccontext_p.h b/src/xmlpatterns/environment/qreceiverdynamiccontext_p.h
new file mode 100644
index 0000000..b4bb9c1
--- /dev/null
+++ b/src/xmlpatterns/environment/qreceiverdynamiccontext_p.h
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 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 qt-sales@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_ReceiverDynamicContext_H
+#define Patternist_ReceiverDynamicContext_H
+
+#include "qdelegatingdynamiccontext_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short A DynamicContext that has a specialized QAbstractXmlReceiver.
+ *
+ * @author Frans Englich <fenglich@trolltech.com>
+ */
+ class ReceiverDynamicContext : public DelegatingDynamicContext
+ {
+ public:
+ /**
+ * Construct a ReceiverDynamicContext and passes @p prevContext to its super class. This
+ * constructor is typically used when the super class is DelegatingDynamicContext.
+ */
+ ReceiverDynamicContext(const DynamicContext::Ptr &prevContext,
+ QAbstractXmlReceiver *const receiver);
+
+ virtual QAbstractXmlReceiver *outputReceiver() const;
+
+ private:
+ QAbstractXmlReceiver *const m_receiver;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/environment/qreportcontext.cpp b/src/xmlpatterns/environment/qreportcontext.cpp
new file mode 100644
index 0000000..9704a54
--- /dev/null
+++ b/src/xmlpatterns/environment/qreportcontext.cpp
@@ -0,0 +1,478 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 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 qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QUrl>
+
+#include "qabstractmessagehandler.h"
+
+#include "qcommonnamespaces_p.h"
+#include "qexpression_p.h"
+
+#include "qreportcontext_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+ReportContext::~ReportContext()
+{
+}
+
+QString ReportContext::finalizeDescription(const QString &desc)
+{
+ return QLatin1String("<html xmlns='http://www.w3.org/1999/xhtml/'><body><p>")
+ + desc
+ + QLatin1String("</p></body></html>");
+}
+
+void ReportContext::warning(const QString &description,
+ const QSourceLocation &sourceLocation)
+{
+ messageHandler()->message(QtWarningMsg, finalizeDescription(description), QUrl(), sourceLocation);
+}
+
+void ReportContext::createError(const QString &description,
+ const QtMsgType type,
+ const QUrl &id,
+ const QSourceLocation &sourceLocation) const
+{
+ messageHandler()->message(type, finalizeDescription(description), id, sourceLocation);
+ throw Exception(true);
+}
+
+void ReportContext::error(const QString &msg,
+ const ErrorCode code,
+ const QSourceLocation &sourceLocation)
+{
+ createError(msg, QtFatalMsg,
+ QUrl(CommonNamespaces::XPERR + QLatin1Char('#') + codeToString(code)),
+ sourceLocation);
+}
+
+QSourceLocation ReportContext::lookupSourceLocation(const SourceLocationReflection *const r) const
+{
+ Q_ASSERT(r);
+ const SourceLocationReflection *const actual = r->actualReflection();
+ Q_ASSERT(actual);
+
+ const QSourceLocation &sl = actual->sourceLocation();
+
+ if(sl.isNull())
+ {
+ Q_ASSERT_X(!locationFor(actual).isNull(), Q_FUNC_INFO,
+ qPrintable(QString::fromLatin1("No location is available for: %1").arg(actual->description())));
+ return locationFor(actual);
+ }
+ else
+ return sl;
+}
+
+void ReportContext::error(const QString &message,
+ const ReportContext::ErrorCode errorCode,
+ const SourceLocationReflection *const reflection)
+{
+ Q_ASSERT(reflection);
+ error(message, errorCode, lookupSourceLocation(reflection));
+}
+
+void ReportContext::error(const QString &msg,
+ const QXmlName qname,
+ const SourceLocationReflection *const reflection)
+{
+ Q_ASSERT(!qname.isNull());
+ createError(msg, QtFatalMsg,
+ QUrl(namePool()->stringForNamespace(qname.namespaceURI()) + QLatin1Char('#') + namePool()->stringForLocalName(qname.localName())),
+ lookupSourceLocation(reflection));
+}
+
+QString ReportContext::codeFromURI(const QString &typeURI,
+ QString &uri)
+{
+ /* Wouldn't surprise me if this can be done more efficiently. */
+ QUrl source(typeURI);
+
+ const QString code(source.fragment());
+ source.setFragment(QString());
+ uri = source.toString();
+ return code;
+}
+
+QString ReportContext::codeToString(const ReportContext::ErrorCode code)
+{
+ const char *result = 0;
+
+ switch(code)
+ {
+ /* Alphabetically. */
+ case FOAR0001: result = "FOAR0001"; break;
+ case FOAR0002: result = "FOAR0002"; break;
+ case FOCA0001: result = "FOCA0001"; break;
+ case FOCA0002: result = "FOCA0002"; break;
+ case FOCA0003: result = "FOCA0003"; break;
+ case FOCA0005: result = "FOCA0005"; break;
+ case FOCA0006: result = "FOCA0006"; break;
+ case FOCH0001: result = "FOCH0001"; break;
+ case FOCH0002: result = "FOCH0002"; break;
+ case FOCH0003: result = "FOCH0003"; break;
+ case FOCH0004: result = "FOCH0004"; break;
+ case FODC0001: result = "FODC0001"; break;
+ case FODC0002: result = "FODC0002"; break;
+ case FODC0003: result = "FODC0003"; break;
+ case FODC0004: result = "FODC0004"; break;
+ case FODC0005: result = "FODC0005"; break;
+ case FODT0001: result = "FODT0001"; break;
+ case FODT0002: result = "FODT0002"; break;
+ case FODT0003: result = "FODT0003"; break;
+ case FOER0000: result = "FOER0000"; break;
+ case FONS0004: result = "FONS0004"; break;
+ case FONS0005: result = "FONS0005"; break;
+ case FORG0001: result = "FORG0001"; break;
+ case FORG0002: result = "FORG0002"; break;
+ case FORG0003: result = "FORG0003"; break;
+ case FORG0004: result = "FORG0004"; break;
+ case FORG0005: result = "FORG0005"; break;
+ case FORG0006: result = "FORG0006"; break;
+ case FORG0008: result = "FORG0008"; break;
+ case FORG0009: result = "FORG0009"; break;
+ case FORX0001: result = "FORX0001"; break;
+ case FORX0002: result = "FORX0002"; break;
+ case FORX0003: result = "FORX0003"; break;
+ case FORX0004: result = "FORX0004"; break;
+ case FOTY0012: result = "FOTY0012"; break;
+ case SENR0001: result = "SENR0001"; break;
+ case SEPM0004: result = "SEPM0004"; break;
+ case SEPM0009: result = "SEPM0009"; break;
+ case SEPM0010: result = "SEPM0010"; break;
+ case SEPM0016: result = "SEPM0016"; break;
+ case SERE0003: result = "SERE0003"; break;
+ case SERE0005: result = "SERE0005"; break;
+ case SERE0006: result = "SERE0006"; break;
+ case SERE0008: result = "SERE0008"; break;
+ case SERE0012: result = "SERE0012"; break;
+ case SERE0014: result = "SERE0014"; break;
+ case SERE0015: result = "SERE0015"; break;
+ case SESU0007: result = "SESU0007"; break;
+ case SESU0011: result = "SESU0011"; break;
+ case SESU0013: result = "SESU0013"; break;
+ case XPDY0002: result = "XPDY0002"; break;
+ case XPDY0021: result = "XPDY0021"; break;
+ case XPDY0050: result = "XPDY0050"; break;
+ case XPST0001: result = "XPST0001"; break;
+ case XPST0003: result = "XPST0003"; break;
+ case XPST0005: result = "XPST0005"; break;
+ case XPST0008: result = "XPST0008"; break;
+ case XPST0010: result = "XPST0010"; break;
+ case XPST0017: result = "XPST0017"; break;
+ case XPST0051: result = "XPST0051"; break;
+ case XPST0080: result = "XPST0080"; break;
+ case XPST0081: result = "XPST0081"; break;
+ case XPST0083: result = "XPST0083"; break;
+ case XPTY0004: result = "XPTY0004"; break;
+ case XPTY0006: result = "XPTY0006"; break;
+ case XPTY0007: result = "XPTY0007"; break;
+ case XPTY0018: result = "XPTY0018"; break;
+ case XPTY0019: result = "XPTY0019"; break;
+ case XPTY0020: result = "XPTY0020"; break;
+ case XQDY0025: result = "XQDY0025"; break;
+ case XQDY0026: result = "XQDY0026"; break;
+ case XQDY0027: result = "XQDY0027"; break;
+ case XQDY0029: result = "XQDY0029"; break;
+ case XQDY0041: result = "XQDY0041"; break;
+ case XQDY0044: result = "XQDY0044"; break;
+ case XQDY0052: result = "XQDY0052"; break;
+ case XQDY0061: result = "XQDY0061"; break;
+ case XQDY0062: result = "XQDY0062"; break;
+ case XQDY0064: result = "XQDY0064"; break;
+ case XQDY0072: result = "XQDY0072"; break;
+ case XQDY0074: result = "XQDY0074"; break;
+ case XQDY0084: result = "XQDY0084"; break;
+ case XQDY0091: result = "XQDY0091"; break;
+ case XQDY0092: result = "XQDY0092"; break;
+ case XQST0009: result = "XQST0009"; break;
+ case XQST0012: result = "XQST0012"; break;
+ case XQST0013: result = "XQST0013"; break;
+ case XQST0014: result = "XQST0014"; break;
+ case XQST0015: result = "XQST0015"; break;
+ case XQST0016: result = "XQST0016"; break;
+ case XQST0022: result = "XQST0022"; break;
+ case XQST0031: result = "XQST0031"; break;
+ case XQST0032: result = "XQST0032"; break;
+ case XQST0033: result = "XQST0033"; break;
+ case XQST0034: result = "XQST0034"; break;
+ case XQST0035: result = "XQST0035"; break;
+ case XQST0036: result = "XQST0036"; break;
+ case XQST0037: result = "XQST0037"; break;
+ case XQST0038: result = "XQST0038"; break;
+ case XQST0039: result = "XQST0039"; break;
+ case XQST0040: result = "XQST0040"; break;
+ case XQST0042: result = "XQST0042"; break;
+ case XQST0043: result = "XQST0043"; break;
+ case XQST0045: result = "XQST0045"; break;
+ case XQST0046: result = "XQST0046"; break;
+ case XQST0047: result = "XQST0047"; break;
+ case XQST0048: result = "XQST0048"; break;
+ case XQST0049: result = "XQST0049"; break;
+ case XQST0053: result = "XQST0053"; break;
+ case XQST0054: result = "XQST0054"; break;
+ case XQST0055: result = "XQST0055"; break;
+ case XQST0056: result = "XQST0056"; break;
+ case XQST0057: result = "XQST0057"; break;
+ case XQST0058: result = "XQST0058"; break;
+ case XQST0059: result = "XQST0059"; break;
+ case XQST0060: result = "XQST0060"; break;
+ case XQST0063: result = "XQST0063"; break;
+ case XQST0065: result = "XQST0065"; break;
+ case XQST0066: result = "XQST0066"; break;
+ case XQST0067: result = "XQST0067"; break;
+ case XQST0068: result = "XQST0068"; break;
+ case XQST0069: result = "XQST0069"; break;
+ case XQST0070: result = "XQST0070"; break;
+ case XQST0071: result = "XQST0071"; break;
+ case XQST0073: result = "XQST0073"; break;
+ case XQST0075: result = "XQST0075"; break;
+ case XQST0076: result = "XQST0076"; break;
+ case XQST0077: result = "XQST0077"; break;
+ case XQST0078: result = "XQST0078"; break;
+ case XQST0079: result = "XQST0079"; break;
+ case XQST0082: result = "XQST0082"; break;
+ case XQST0085: result = "XQST0085"; break;
+ case XQST0087: result = "XQST0087"; break;
+ case XQST0088: result = "XQST0088"; break;
+ case XQST0089: result = "XQST0089"; break;
+ case XQST0090: result = "XQST0090"; break;
+ case XQST0093: result = "XQST0093"; break;
+ case XQTY0023: result = "XQTY0023"; break;
+ case XQTY0024: result = "XQTY0024"; break;
+ case XQTY0028: result = "XQTY0028"; break;
+ case XQTY0030: result = "XQTY0030"; break;
+ case XQTY0086: result = "XQTY0086"; break;
+ case XTDE0030: result = "XTDE0030"; break;
+ case XTDE0040: result = "XTDE0040"; break;
+ case XTDE0045: result = "XTDE0045"; break;
+ case XTDE0047: result = "XTDE0047"; break;
+ case XTDE0050: result = "XTDE0050"; break;
+ case XTDE0060: result = "XTDE0060"; break;
+ case XTDE0160: result = "XTDE0160"; break;
+ case XTDE0290: result = "XTDE0290"; break;
+ case XTDE0410: result = "XTDE0410"; break;
+ case XTDE0420: result = "XTDE0420"; break;
+ case XTDE0430: result = "XTDE0430"; break;
+ case XTDE0440: result = "XTDE0440"; break;
+ case XTDE0485: result = "XTDE0485"; break;
+ case XTDE0560: result = "XTDE0560"; break;
+ case XTDE0610: result = "XTDE0610"; break;
+ case XTDE0640: result = "XTDE0640"; break;
+ case XTDE0700: result = "XTDE0700"; break;
+ case XTDE0820: result = "XTDE0820"; break;
+ case XTDE0830: result = "XTDE0830"; break;
+ case XTDE0835: result = "XTDE0835"; break;
+ case XTDE0850: result = "XTDE0850"; break;
+ case XTDE0855: result = "XTDE0855"; break;
+ case XTDE0860: result = "XTDE0860"; break;
+ case XTDE0865: result = "XTDE0865"; break;
+ case XTDE0890: result = "XTDE0890"; break;
+ case XTDE0905: result = "XTDE0905"; break;
+ case XTDE0920: result = "XTDE0920"; break;
+ case XTDE0925: result = "XTDE0925"; break;
+ case XTDE0930: result = "XTDE0930"; break;
+ case XTDE0980: result = "XTDE0980"; break;
+ case XTDE1030: result = "XTDE1030"; break;
+ case XTDE1035: result = "XTDE1035"; break;
+ case XTDE1110: result = "XTDE1110"; break;
+ case XTDE1140: result = "XTDE1140"; break;
+ case XTDE1145: result = "XTDE1145"; break;
+ case XTDE1150: result = "XTDE1150"; break;
+ case XTDE1170: result = "XTDE1170"; break;
+ case XTDE1190: result = "XTDE1190"; break;
+ case XTDE1200: result = "XTDE1200"; break;
+ case XTDE1260: result = "XTDE1260"; break;
+ case XTDE1270: result = "XTDE1270"; break;
+ case XTDE1280: result = "XTDE1280"; break;
+ case XTDE1310: result = "XTDE1310"; break;
+ case XTDE1340: result = "XTDE1340"; break;
+ case XTDE1350: result = "XTDE1350"; break;
+ case XTDE1360: result = "XTDE1360"; break;
+ case XTDE1370: result = "XTDE1370"; break;
+ case XTDE1380: result = "XTDE1380"; break;
+ case XTDE1390: result = "XTDE1390"; break;
+ case XTDE1400: result = "XTDE1400"; break;
+ case XTDE1420: result = "XTDE1420"; break;
+ case XTDE1425: result = "XTDE1425"; break;
+ case XTDE1428: result = "XTDE1428"; break;
+ case XTDE1440: result = "XTDE1440"; break;
+ case XTDE1450: result = "XTDE1450"; break;
+ case XTDE1460: result = "XTDE1460"; break;
+ case XTDE1480: result = "XTDE1480"; break;
+ case XTDE1490: result = "XTDE1490"; break;
+ case XTDE1665: result = "XTDE1665"; break;
+ case XTMM9000: result = "XTMM9000"; break;
+ case XTRE0270: result = "XTRE0270"; break;
+ case XTRE0540: result = "XTRE0540"; break;
+ case XTRE0795: result = "XTRE0795"; break;
+ case XTRE1160: result = "XTRE1160"; break;
+ case XTRE1495: result = "XTRE1495"; break;
+ case XTRE1500: result = "XTRE1500"; break;
+ case XTRE1620: result = "XTRE1620"; break;
+ case XTRE1630: result = "XTRE1630"; break;
+ case XTSE0010: result = "XTSE0010"; break;
+ case XTSE0020: result = "XTSE0020"; break;
+ case XTSE0080: result = "XTSE0080"; break;
+ case XTSE0090: result = "XTSE0090"; break;
+ case XTSE0110: result = "XTSE0110"; break;
+ case XTSE0120: result = "XTSE0120"; break;
+ case XTSE0125: result = "XTSE0125"; break;
+ case XTSE0130: result = "XTSE0130"; break;
+ case XTSE0150: result = "XTSE0150"; break;
+ case XTSE0165: result = "XTSE0165"; break;
+ case XTSE0170: result = "XTSE0170"; break;
+ case XTSE0180: result = "XTSE0180"; break;
+ case XTSE0190: result = "XTSE0190"; break;
+ case XTSE0200: result = "XTSE0200"; break;
+ case XTSE0210: result = "XTSE0210"; break;
+ case XTSE0215: result = "XTSE0215"; break;
+ case XTSE0220: result = "XTSE0220"; break;
+ case XTSE0260: result = "XTSE0260"; break;
+ case XTSE0265: result = "XTSE0265"; break;
+ case XTSE0280: result = "XTSE0280"; break;
+ case XTSE0340: result = "XTSE0340"; break;
+ case XTSE0350: result = "XTSE0350"; break;
+ case XTSE0370: result = "XTSE0370"; break;
+ case XTSE0500: result = "XTSE0500"; break;
+ case XTSE0530: result = "XTSE0530"; break;
+ case XTSE0550: result = "XTSE0550"; break;
+ case XTSE0580: result = "XTSE0580"; break;
+ case XTSE0620: result = "XTSE0620"; break;
+ case XTSE0630: result = "XTSE0630"; break;
+ case XTSE0650: result = "XTSE0650"; break;
+ case XTSE0660: result = "XTSE0660"; break;
+ case XTSE0670: result = "XTSE0670"; break;
+ case XTSE0680: result = "XTSE0680"; break;
+ case XTSE0690: result = "XTSE0690"; break;
+ case XTSE0710: result = "XTSE0710"; break;
+ case XTSE0720: result = "XTSE0720"; break;
+ case XTSE0740: result = "XTSE0740"; break;
+ case XTSE0760: result = "XTSE0760"; break;
+ case XTSE0770: result = "XTSE0770"; break;
+ case XTSE0805: result = "XTSE0805"; break;
+ case XTSE0808: result = "XTSE0808"; break;
+ case XTSE0809: result = "XTSE0809"; break;
+ case XTSE0810: result = "XTSE0810"; break;
+ case XTSE0812: result = "XTSE0812"; break;
+ case XTSE0840: result = "XTSE0840"; break;
+ case XTSE0870: result = "XTSE0870"; break;
+ case XTSE0880: result = "XTSE0880"; break;
+ case XTSE0910: result = "XTSE0910"; break;
+ case XTSE0940: result = "XTSE0940"; break;
+ case XTSE0975: result = "XTSE0975"; break;
+ case XTSE1015: result = "XTSE1015"; break;
+ case XTSE1017: result = "XTSE1017"; break;
+ case XTSE1040: result = "XTSE1040"; break;
+ case XTSE1060: result = "XTSE1060"; break;
+ case XTSE1070: result = "XTSE1070"; break;
+ case XTSE1080: result = "XTSE1080"; break;
+ case XTSE1090: result = "XTSE1090"; break;
+ case XTSE1130: result = "XTSE1130"; break;
+ case XTSE1205: result = "XTSE1205"; break;
+ case XTSE1210: result = "XTSE1210"; break;
+ case XTSE1220: result = "XTSE1220"; break;
+ case XTSE1290: result = "XTSE1290"; break;
+ case XTSE1295: result = "XTSE1295"; break;
+ case XTSE1300: result = "XTSE1300"; break;
+ case XTSE1430: result = "XTSE1430"; break;
+ case XTSE1505: result = "XTSE1505"; break;
+ case XTSE1520: result = "XTSE1520"; break;
+ case XTSE1530: result = "XTSE1530"; break;
+ case XTSE1560: result = "XTSE1560"; break;
+ case XTSE1570: result = "XTSE1570"; break;
+ case XTSE1580: result = "XTSE1580"; break;
+ case XTSE1590: result = "XTSE1590"; break;
+ case XTSE1600: result = "XTSE1600"; break;
+ case XTSE1650: result = "XTSE1650"; break;
+ case XTSE1660: result = "XTSE1660"; break;
+ case XTTE0505: result = "XTTE0505"; break;
+ case XTTE0510: result = "XTTE0510"; break;
+ case XTTE0520: result = "XTTE0520"; break;
+ case XTTE0570: result = "XTTE0570"; break;
+ case XTTE0590: result = "XTTE0590"; break;
+ case XTTE0600: result = "XTTE0600"; break;
+ case XTTE0780: result = "XTTE0780"; break;
+ case XTTE0790: result = "XTTE0790"; break;
+ case XTTE0950: result = "XTTE0950"; break;
+ case XTTE0990: result = "XTTE0990"; break;
+ case XTTE1000: result = "XTTE1000"; break;
+ case XTTE1020: result = "XTTE1020"; break;
+ case XTTE1100: result = "XTTE1100"; break;
+ case XTTE1120: result = "XTTE1120"; break;
+ case XTTE1510: result = "XTTE1510"; break;
+ case XTTE1512: result = "XTTE1512"; break;
+ case XTTE1515: result = "XTTE1515"; break;
+ case XTTE1540: result = "XTTE1540"; break;
+ case XTTE1545: result = "XTTE1545"; break;
+ case XTTE1550: result = "XTTE1550"; break;
+ case XTTE1555: result = "XTTE1555"; break;
+ }
+
+ Q_ASSERT_X(result, Q_FUNC_INFO, "Unknown enum value.");
+ return QLatin1String(result);
+}
+
+QUrl ReportContext::resolveURI(const QUrl &relative,
+ const QUrl &baseURI) const
+{
+ Q_ASSERT_X(!baseURI.isRelative(), Q_FUNC_INFO,
+ "The base URI passed from the engine wasn't absolute.");
+
+ const QAbstractUriResolver *const resolver(uriResolver());
+
+ if(resolver)
+ {
+ const QUrl final(resolver->resolve(relative, baseURI));
+ Q_ASSERT_X(final.isValid() || final.isEmpty(), Q_FUNC_INFO,
+ "The QAbstractUriResolver must return a valid URI.");
+ Q_ASSERT_X(!final.isRelative(), Q_FUNC_INFO,
+ "The QAbstractUriResolver must return an absolute URI.");
+ return final;
+ }
+ else
+ return baseURI.resolved(relative);
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/environment/qreportcontext_p.h b/src/xmlpatterns/environment/qreportcontext_p.h
new file mode 100644
index 0000000..bea2a97
--- /dev/null
+++ b/src/xmlpatterns/environment/qreportcontext_p.h
@@ -0,0 +1,2460 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 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 qt-sales@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_ReportContext_H
+#define Patternist_ReportContext_H
+
+#include <QSharedData>
+#include <QAbstractUriResolver>
+#include <QSourceLocation>
+
+#include "qnamepool_p.h"
+#include "qxmlname.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+class QAbstractMessageHandler;
+class QSourceLocation;
+class QString;
+
+namespace QPatternist
+{
+ class SourceLocationReflection;
+
+ /**
+ * @short A callback for reporting errors.
+ *
+ * ReportContext receives messages of various severity and type via its
+ * functions warning() and error(). In turn, ReportContext create Message instances
+ * and submit them to the QAbstractMessageHandler instance returned by messageHandler().
+ *
+ * The Message attributes are set as follows:
+ *
+ * - Message::description() - A translated, human-readable description
+ * - Message::type() - Message::Error if a static, dynamic or type error was encountered
+ * that halted compilation or evaluation, or Message::Warning in case of a warning
+ * - Message::identifier() - This is a URI consisting of the error namespace with the
+ * error code as fragment. For example, a Message representing a syntax error
+ * would return the type "http://www.w3.org/2005/xqt-errors#XPST0003". The convenience
+ * function codeFromURI() can be used to extract the error code. The error namespace
+ * is typically the namespace for XPath and XQuery errors(as in the previous example), but
+ * can also be user defined.
+ *
+ * @see <a href="http://www.w3.org/TR/xpath20/#id-identifying-errors">XML Path Language
+ * (XPath) 2.0, 2.3.2 Identifying and Reporting Errors</a>
+ * @see <a href="http://www.w3.org/TR/xpath-functions/#func-error">XQuery 1.0 and
+ * XPath 2.0 Functions and Operators, 3 The Error Function</a>
+ * @author Frans Englich <fenglich@trolltech.com>
+ * @warning This file is auto-generated from extractErrorCodes.xsl. Any
+ * modifications done to this file are lost.
+ */
+ class Q_AUTOTEST_EXPORT ReportContext : public QSharedData
+ {
+ public:
+ typedef QHash<const SourceLocationReflection *, QSourceLocation> LocationHash;
+
+ /**
+ * A smart pointer wrapping ReportContext instances.
+ */
+ typedef QExplicitlySharedDataPointer<ReportContext> Ptr;
+
+ /**
+ * @short Default constructors.
+ *
+ * For some reason GCC fails to synthesize it, so we provide an empty
+ * one here.
+ */
+ inline ReportContext() {}
+
+ virtual ~ReportContext();
+
+ /**
+ * Error codes that corresponds to the error codes defined in the
+ * relevant specifications. They are used throughout the API for
+ * identifying error conditions.
+ *
+ * While strings could have been used for identifying errors, enums
+ * reduces bugs by providing type safety.
+ *
+ * @see <a href="http://www.w3.org/TR/xpath20/#errors">XML
+ * Path Language (XPath) 2.0, 2.3 Error Handling</a>
+ * @see <a href="http://www.w3.org/TR/xpath-functions/#d1e10985">XQuery 1.0
+ * and XPath 2.0 Functions and Operators, C Error Summary</a>
+ * @see <a href="http://www.w3.org/TR/xslt20/#error-summary">XSL Transformations
+ * (XSLT) Version 2.0, E Summary of Error Conditions (Non-Normative)</a>
+ * @note The enumerator values' Doxygen documentation is copied from the
+ * W3C documents
+ * <a href="http://www.w3.org/TR/xpath-functions">XQuery 1.0 and XPath
+ * 2.0 Functions and Operators</a>,
+ * <a href="http://www.w3.org/TR/xpath20">XML Path Language (XPath) 2.0</a>, and
+ * <a href="http://www.w3.org/TR/xslt20/">XSL Transformations (XSLT)
+ * Version 2.0</a>, respectively. The doxygen documentation is therefore covered
+ * by the following legal notice:
+ * "Copyright @ 2005 W3C&reg; (MIT, ERCIM, Keio), All Rights Reserved. W3C
+ * <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+ * <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and
+ * <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document
+ * use</a> rules apply."
+ * @warning This enumerator is auto-generated from the relevant specifications
+ * by the XSL-T stylesheet extractErrorCodes.xsl. Hence, any modifications
+ * done to this file, in contrary to the stylesheet, are therefore lost.
+ */
+ enum ErrorCode
+ {
+
+ /**
+ * It is a static error if analysis of an expression relies on some
+ * component of the static context that has not been assigned a
+ * value.
+ */
+ XPST0001,
+
+ /**
+ * It is a dynamic error if evaluation of an expression relies on
+ * some part of the dynamic context that has not been assigned a
+ * value.
+ */
+ XPDY0002,
+
+ /**
+ * It is a static error if an expression is not a valid instance
+ * of the grammar defined in A.1 EBNF.
+ */
+ XPST0003,
+
+ /**
+ * It is a type error if, during the static analysis phase, an expression
+ * is found to have a static type that is not appropriate for the
+ * context in which the expression occurs, or during the dynamic
+ * evaluation phase, the dynamic type of a value does not match
+ * a required type as specified by the matching rules in 2.5.4 SequenceType
+ * Matching.
+ */
+ XPTY0004,
+
+ /**
+ * During the analysis phase, it is a static error if the static
+ * type assigned to an expression other than the expression () or
+ * data(()) is empty-sequence().
+ */
+ XPST0005,
+
+ /**
+ * (Not currently used.)
+ */
+ XPTY0006,
+
+ /**
+ * (Not currently used.)
+ */
+ XPTY0007,
+
+ /**
+ * It is a static error if an expression refers to an element name,
+ * attribute name, schema type name, namespace prefix, or variable
+ * name that is not defined in the static context, except for an
+ * ElementName in an ElementTest or an AttributeName in an AttributeTest.
+ */
+ XPST0008,
+
+ /**
+ * An implementation that does not support the Schema Import Feature
+ * must raise a static error if a Prolog contains a schema import.
+ */
+ XQST0009,
+
+ /**
+ * An implementation must raise a static error if it encounters
+ * a reference to an axis that it does not support.
+ */
+ XPST0010,
+
+ /**
+ * It is a static error if the set of definitions contained in all
+ * schemas imported by a Prolog do not satisfy the conditions for
+ * schema validity specified in Sections 3 and 5 of [XML Schema]
+ * Part 1--i.e., each definition must be valid, complete, and unique.
+ */
+ XQST0012,
+
+ /**
+ * It is a static error if an implementation recognizes a pragma
+ * but determines that its content is invalid.
+ */
+ XQST0013,
+
+ /**
+ * (Not currently used.)
+ */
+ XQST0014,
+
+ /**
+ * (Not currently used.)
+ */
+ XQST0015,
+
+ /**
+ * An implementation that does not support the Module Feature raises
+ * a static error if it encounters a module declaration or a module
+ * import.
+ */
+ XQST0016,
+
+ /**
+ * It is a static error if the expanded QName and number of arguments
+ * in a function call do not match the name and arity of a function
+ * signature in the static context.
+ */
+ XPST0017,
+
+ /**
+ * It is a type error if the result of the last step in a path expression
+ * contains both nodes and atomic values.
+ */
+ XPTY0018,
+
+ /**
+ * It is a type error if the result of a step (other than the last
+ * step) in a path expression contains an atomic value.
+ */
+ XPTY0019,
+
+ /**
+ * It is a type error if, in an axis step, the context item is not
+ * a node.
+ */
+ XPTY0020,
+
+ /**
+ * (Not currently used.)
+ */
+ XPDY0021,
+
+ /**
+ * It is a static error if the value of a namespace declaration
+ * attribute is not a URILiteral.
+ */
+ XQST0022,
+
+ /**
+ * (Not currently used.)
+ */
+ XQTY0023,
+
+ /**
+ * It is a type error if the content sequence in an element constructor
+ * contains an attribute node following a node that is not an attribute
+ * node.
+ */
+ XQTY0024,
+
+ /**
+ * It is a dynamic error if any attribute of a constructed element
+ * does not have a name that is distinct from the names of all other
+ * attributes of the constructed element.
+ */
+ XQDY0025,
+
+ /**
+ * It is a dynamic error if the result of the content expression
+ * of a computed processing instruction constructor contains the
+ * string "?&gt;".
+ */
+ XQDY0026,
+
+ /**
+ * In a validate expression, it is a dynamic error if the root element
+ * information item in the PSVI resulting from validation does not
+ * have the expected validity property: valid if validation mode
+ * is strict, or either valid or notKnown if validation mode is
+ * lax.
+ */
+ XQDY0027,
+
+ /**
+ * (Not currently used.)
+ */
+ XQTY0028,
+
+ /**
+ * (Not currently used.)
+ */
+ XQDY0029,
+
+ /**
+ * It is a type error if the argument of a validate expression does
+ * not evaluate to exactly one document or element node.
+ */
+ XQTY0030,
+
+ /**
+ * It is a static error if the version number specified in a version
+ * declaration is not supported by the implementation.
+ */
+ XQST0031,
+
+ /**
+ * A static error is raised if a Prolog contains more than one base
+ * URI declaration.
+ */
+ XQST0032,
+
+ /**
+ * It is a static error if a module contains multiple bindings for
+ * the same namespace prefix.
+ */
+ XQST0033,
+
+ /**
+ * It is a static error if multiple functions declared or imported
+ * by a module have the number of arguments and their expanded QNames
+ * are equal (as defined by the eq operator).
+ */
+ XQST0034,
+
+ /**
+ * It is a static error to import two schema components that both
+ * define the same name in the same symbol space and in the same
+ * scope.
+ */
+ XQST0035,
+
+ /**
+ * It is a static error to import a module if the importing module's
+ * in-scope schema types do not include definitions for the schema
+ * type names that appear in the declarations of variables and functions
+ * (whether in an argument type or return type) that are present
+ * in the imported module and are referenced in the importing module.
+ */
+ XQST0036,
+
+ /**
+ * (Not currently used.)
+ */
+ XQST0037,
+
+ /**
+ * It is a static error if a Prolog contains more than one default
+ * collation declaration, or the value specified by a default collation
+ * declaration is not present in statically known collations.
+ */
+ XQST0038,
+
+ /**
+ * It is a static error for a function declaration to have more
+ * than one parameter with the same name.
+ */
+ XQST0039,
+
+ /**
+ * It is a static error if the attributes specified by a direct
+ * element constructor do not have distinct expanded QNames.
+ */
+ XQST0040,
+
+ /**
+ * It is a dynamic error if the value of the name expression in
+ * a computed processing instruction constructor cannot be cast
+ * to the type xs:NCName.
+ */
+ XQDY0041,
+
+ /**
+ * (Not currently used.)
+ */
+ XQST0042,
+
+ /**
+ * (Not currently used.)
+ */
+ XQST0043,
+
+ /**
+ * It is a dynamic error if the node-name property of the node constructed
+ * by a computed attribute constructor is in the namespace http://www.w3.org/2000/xmlns/
+ * (corresponding to namespace prefix xmlns), or is in no namespace
+ * and has local name xmlns.
+ */
+ XQDY0044,
+
+ /**
+ * It is a static error if the function name in a function declaration
+ * is in one of the following namespaces: http://www.w3.org/XML/1998/namespace,
+ * http://www.w3.org/2001/XMLSchema, http://www.w3.org/2001/XMLSchema-instance,
+ * http://www.w3.org/2005/xpath-functions.
+ */
+ XQST0045,
+
+ /**
+ * An implementation MAY raise a static error if the value of a
+ * URILiteral is of nonzero length and is not in the lexical space
+ * of xs:anyURI.
+ */
+ XQST0046,
+
+ /**
+ * It is a static error if multiple module imports in the same Prolog
+ * specify the same target namespace.
+ */
+ XQST0047,
+
+ /**
+ * It is a static error if a function or variable declared in a
+ * library module is not in the target namespace of the library
+ * module.
+ */
+ XQST0048,
+
+ /**
+ * It is a static error if two or more variables declared or imported
+ * by a module have equal expanded QNames (as defined by the eq
+ * operator.)
+ */
+ XQST0049,
+
+ /**
+ * It is a dynamic error if the dynamic type of the operand of a
+ * treat expression does not match the sequence type specified by
+ * the treat expression. This error might also be raised by a path
+ * expression beginning with "/" or "//" if the context node is
+ * not in a tree that is rooted at a document node. This is because
+ * a leading "/" or "//" in a path expression is an abbreviation
+ * for an initial step that includes the clause treat as document-node().
+ */
+ XPDY0050,
+
+ /**
+ * It is a static error if a QName that is used as an AtomicType
+ * in a SequenceType is not defined in the in-scope schema types
+ * as an atomic type.
+ */
+ XPST0051,
+
+ /**
+ * (Not currently used.)
+ */
+ XQDY0052,
+
+ /**
+ * (Not currently used.)
+ */
+ XQST0053,
+
+ /**
+ * It is a static error if a variable depends on itself.
+ */
+ XQST0054,
+
+ /**
+ * It is a static error if a Prolog contains more than one copy-namespaces
+ * declaration.
+ */
+ XQST0055,
+
+ /**
+ * (Not currently used.)
+ */
+ XQST0056,
+
+ /**
+ * It is a static error if a schema import binds a namespace prefix
+ * but does not specify a target namespace other than a zero-length
+ * string.
+ */
+ XQST0057,
+
+ /**
+ * It is a static error if multiple schema imports specify the same
+ * target namespace.
+ */
+ XQST0058,
+
+ /**
+ * It is a static error if an implementation is unable to process
+ * a schema or module import by finding a schema or module with
+ * the specified target namespace.
+ */
+ XQST0059,
+
+ /**
+ * It is a static error if the name of a function in a function
+ * declaration is not in a namespace (expanded QName has a null
+ * namespace URI).
+ */
+ XQST0060,
+
+ /**
+ * It is a dynamic error if the operand of a validate expression
+ * is a document node whose children do not consist of exactly one
+ * element node and zero or more comment and processing instruction
+ * nodes, in any order.
+ */
+ XQDY0061,
+
+ /**
+ * (Not currently used.)
+ */
+ XQDY0062,
+
+ /**
+ * (Not currently used.)
+ */
+ XQST0063,
+
+ /**
+ * It is a dynamic error if the value of the name expression in
+ * a computed processing instruction constructor is equal to "XML"
+ * (in any combination of upper and lower case).
+ */
+ XQDY0064,
+
+ /**
+ * A static error is raised if a Prolog contains more than one ordering
+ * mode declaration.
+ */
+ XQST0065,
+
+ /**
+ * A static error is raised if a Prolog contains more than one default
+ * element/type namespace declaration, or more than one default
+ * function namespace declaration.
+ */
+ XQST0066,
+
+ /**
+ * A static error is raised if a Prolog contains more than one construction
+ * declaration.
+ */
+ XQST0067,
+
+ /**
+ * A static error is raised if a Prolog contains more than one boundary-space
+ * declaration.
+ */
+ XQST0068,
+
+ /**
+ * A static error is raised if a Prolog contains more than one empty
+ * order declaration.
+ */
+ XQST0069,
+
+ /**
+ * A static error is raised if a namespace URI is bound to the predefined
+ * prefix xmlns, or if a namespace URI other than http://www.w3.org/XML/1998/namespace
+ * is bound to the prefix xml, or if the prefix xml is bound to
+ * a namespace URI other than http://www.w3.org/XML/1998/namespace.
+ */
+ XQST0070,
+
+ /**
+ * A static error is raised if the namespace declaration attributes
+ * of a direct element constructor do not have distinct names.
+ */
+ XQST0071,
+
+ /**
+ * It is a dynamic error if the result of the content expression
+ * of a computed comment constructor contains two adjacent hyphens
+ * or ends with a hyphen.
+ */
+ XQDY0072,
+
+ /**
+ * It is a static error if the graph of module imports contains
+ * a cycle (that is, if there exists a sequence of modules M1 ...
+ * Mn such that each Mi imports Mi+1 and Mn imports M1), unless
+ * all the modules in the cycle share a common namespace.
+ */
+ XQST0073,
+
+ /**
+ * It is a dynamic error if the value of the name expression in
+ * a computed element or attribute constructor cannot be converted
+ * to an expanded QName (for example, because it contains a namespace
+ * prefix not found in statically known namespaces.)
+ */
+ XQDY0074,
+
+ /**
+ * An implementation that does not support the Validation Feature
+ * must raise a static error if it encounters a validate expression.
+ */
+ XQST0075,
+
+ /**
+ * It is a static error if a collation subclause in an order by
+ * clause of a FLWOR expression does not identify a collation that
+ * is present in statically known collations.
+ */
+ XQST0076,
+
+ /**
+ * (Not currently used.)
+ */
+ XQST0077,
+
+ /**
+ * (Not currently used.)
+ */
+ XQST0078,
+
+ /**
+ * It is a static error if an extension expression contains neither
+ * a pragma that is recognized by the implementation nor an expression
+ * enclosed in curly braces.
+ */
+ XQST0079,
+
+ /**
+ * It is a static error if the target type of a cast or castable
+ * expression is xs:NOTATION or xs:anyAtomicType.
+ */
+ XPST0080,
+
+ /**
+ * It is a static error if a QName used in a query contains a namespace
+ * prefix that cannot be expanded into a namespace URI by using
+ * the statically known namespaces.
+ */
+ XPST0081,
+
+ /**
+ * (Not currently used.)
+ */
+ XQST0082,
+
+ /**
+ * (Not currently used.)
+ */
+ XPST0083,
+
+ /**
+ * It is a dynamic error if the element validated by a validate
+ * statement does not have a top-level element declaration in the
+ * in-scope element declarations, if validation mode is strict.
+ */
+ XQDY0084,
+
+ /**
+ * It is a static error if the namespace URI in a namespace declaration
+ * attribute is a zero-length string, and the implementation does
+ * not support [XML Names 1.1].
+ */
+ XQST0085,
+
+ /**
+ * It is a type error if the typed value of a copied element or
+ * attribute node is namespace-sensitive when construction mode
+ * is preserve and copy-namespaces mode is no-preserve.
+ */
+ XQTY0086,
+
+ /**
+ * It is a static error if the encoding specified in a Version Declaration
+ * does not conform to the definition of EncName specified in [XML
+ * 1.0].
+ */
+ XQST0087,
+
+ /**
+ * It is a static error if the literal that specifies the target
+ * namespace in a module import or a module declaration is of zero
+ * length.
+ */
+ XQST0088,
+
+ /**
+ * It is a static error if a variable bound in a for clause of a
+ * FLWOR expression, and its associated positional variable, do
+ * not have distinct names (expanded QNames).
+ */
+ XQST0089,
+
+ /**
+ * It is a static error if a character reference does not identify
+ * a valid character in the version of XML that is in use.
+ */
+ XQST0090,
+
+ /**
+ * An implementation MAY raise a dynamic error if an xml:id error,
+ * as defined in [XML ID], is encountered during construction of
+ * an attribute named xml:id.
+ */
+ XQDY0091,
+
+ /**
+ * An implementation MAY raise a dynamic error if a constructed
+ * attribute named xml:space has a value other than preserve or
+ * default.
+ */
+ XQDY0092,
+
+ /**
+ * It is a static error to import a module M1 if there exists a
+ * sequence of modules M1 ... Mi ... M1 such that each module directly
+ * depends on the next module in the sequence (informally, if M1
+ * depends on itself through some chain of module dependencies.)
+ */
+ XQST0093,
+
+ /**
+ * Unidentified error.
+ */
+ FOER0000,
+
+ /**
+ * Division by zero.
+ */
+ FOAR0001,
+
+ /**
+ * Numeric operation overflow/underflow.
+ */
+ FOAR0002,
+
+ /**
+ * Input value too large for decimal.
+ */
+ FOCA0001,
+
+ /**
+ * Invalid lexical value.
+ */
+ FOCA0002,
+
+ /**
+ * Input value too large for integer.
+ */
+ FOCA0003,
+
+ /**
+ * NaN supplied as float/double value.
+ */
+ FOCA0005,
+
+ /**
+ * String to be cast to decimal has too many digits of precision.
+ */
+ FOCA0006,
+
+ /**
+ * Code point not valid.
+ */
+ FOCH0001,
+
+ /**
+ * Unsupported collation.
+ */
+ FOCH0002,
+
+ /**
+ * Unsupported normalization form.
+ */
+ FOCH0003,
+
+ /**
+ * Collation does not support collation units.
+ */
+ FOCH0004,
+
+ /**
+ * No context document.
+ */
+ FODC0001,
+
+ /**
+ * Error retrieving resource.
+ */
+ FODC0002,
+
+ /**
+ * Function stability not defined.
+ */
+ FODC0003,
+
+ /**
+ * Invalid argument to fn:collection.
+ */
+ FODC0004,
+
+ /**
+ * Invalid argument to fn:doc or fn:doc-available.
+ */
+ FODC0005,
+
+ /**
+ * Overflow/underflow in date/time operation.
+ */
+ FODT0001,
+
+ /**
+ * Overflow/underflow in duration operation.
+ */
+ FODT0002,
+
+ /**
+ * Invalid timezone value.
+ */
+ FODT0003,
+
+ /**
+ * No namespace found for prefix.
+ */
+ FONS0004,
+
+ /**
+ * Base-uri not defined in the static context.
+ */
+ FONS0005,
+
+ /**
+ * Invalid value for cast/constructor.
+ */
+ FORG0001,
+
+ /**
+ * Invalid argument to fn:resolve-uri().
+ */
+ FORG0002,
+
+ /**
+ * fn:zero-or-one called with a sequence containing more than one
+ * item.
+ */
+ FORG0003,
+
+ /**
+ * fn:one-or-more called with a sequence containing no items.
+ */
+ FORG0004,
+
+ /**
+ * fn:exactly-one called with a sequence containing zero or more
+ * than one item.
+ */
+ FORG0005,
+
+ /**
+ * Invalid argument type.
+ */
+ FORG0006,
+
+ /**
+ * Both arguments to fn:dateTime have a specified timezone.
+ */
+ FORG0008,
+
+ /**
+ * Error in resolving a relative URI against a base URI in fn:resolve-uri.
+ */
+ FORG0009,
+
+ /**
+ * Invalid regular expression. flags
+ */
+ FORX0001,
+
+ /**
+ * Invalid regular expression.
+ */
+ FORX0002,
+
+ /**
+ * Regular expression matches zero-length string.
+ */
+ FORX0003,
+
+ /**
+ * Invalid replacement string.
+ */
+ FORX0004,
+
+ /**
+ * Argument node does not have a typed value.
+ */
+ FOTY0012,
+
+ /**
+ * It is an error if an item in S6 in sequence normalization is
+ * an attribute node or a namespace node.
+ */
+ SENR0001,
+
+ /**
+ * It is an error if the serializer is unable to satisfy the rules
+ * for either a well-formed XML document entity or a well-formed
+ * XML external general parsed entity, or both, except for content
+ * modified by the character expansion phase of serialization.
+ */
+ SERE0003,
+
+ /**
+ * It is an error to specify the doctype-system parameter, or to
+ * specify the standalone parameter with a value other than omit,
+ * if the instance of the data model contains text nodes or multiple
+ * element nodes as children of the root node.
+ */
+ SEPM0004,
+
+ /**
+ * It is an error if the serialized result would contain an NCName
+ * Names that contains a character that is not permitted by the
+ * version of Namespaces in XML specified by the version parameter.
+ */
+ SERE0005,
+
+ /**
+ * It is an error if the serialized result would contain a character
+ * that is not permitted by the version of XML specified by the
+ * version parameter.
+ */
+ SERE0006,
+
+ /**
+ * It is an error if an output encoding other than UTF-8 or UTF-16
+ * is requested and the serializer does not support that encoding.
+ */
+ SESU0007,
+
+ /**
+ * It is an error if a character that cannot be represented in the
+ * encoding that the serializer is using for output appears in a
+ * context where character references are not allowed (for example
+ * if the character occurs in the name of an element).
+ */
+ SERE0008,
+
+ /**
+ * It is an error if the omit-xml-declaration parameter has the
+ * value yes, and the standalone attribute has a value other than
+ * omit; or the version parameter has a value other than 1.0 and
+ * the doctype-system parameter is specified.
+ */
+ SEPM0009,
+
+ /**
+ * It is an error if the output method is xml, the value of the
+ * undeclare-prefixes parameter is yes, and the value of the version
+ * parameter is 1.0.
+ */
+ SEPM0010,
+
+ /**
+ * It is an error if the value of the normalization-form parameter
+ * specifies a normalization form that is not supported by the serializer.
+ */
+ SESU0011,
+
+ /**
+ * It is an error if the value of the normalization-form parameter
+ * is fully-normalized and any relevant construct of the result
+ * begins with a combining character.
+ */
+ SERE0012,
+
+ /**
+ * It is an error if the serializer does not support the version
+ * of XML or HTML specified by the version parameter.
+ */
+ SESU0013,
+
+ /**
+ * It is an error to use the HTML output method when characters
+ * which are legal in XML but not in HTML, specifically the control
+ * characters \#x7F-#x9F, appear in the instance of the data model.
+ */
+ SERE0014,
+
+ /**
+ * It is an error to use the HTML output method when &gt; appears within
+ * a processing instruction in the data model instance being serialized.
+ */
+ SERE0015,
+
+ /**
+ * It is a an error if a parameter value is invalid for the defined
+ * domain.
+ */
+ SEPM0016,
+
+ /**
+ * A static error is signaled if an XSLT-defined element is used
+ * in a context where it is not permitted, if a required attribute
+ * is omitted, or if the content of the element does not correspond
+ * to the content that is allowed for the element.
+ */
+ XTSE0010,
+
+ /**
+ * It is a static error if an attribute (other than an attribute
+ * written using curly brackets in a position where an attribute
+ * value template is permitted) contains a value that is not one
+ * of the permitted values for that attribute.
+ */
+ XTSE0020,
+
+ /**
+ * It is a static error to use a reserved namespace in the name
+ * of a named template, a mode, an attribute set, a key, a decimal-format,
+ * a variable or parameter, a stylesheet function, a named output
+ * definition, or a character map.
+ */
+ XTSE0080,
+
+ /**
+ * It is a static error for an element from the XSLT namespace to
+ * have an attribute whose namespace is either null (that is, an
+ * attribute with an unprefixed name) or the XSLT namespace, other
+ * than attributes defined for the element in this document.
+ */
+ XTSE0090,
+
+ /**
+ * The value of the version attribute must be a number: specifically,
+ * it must be a a valid instance of the type xs:decimal as defined
+ * in [XML Schema Part 2].
+ */
+ XTSE0110,
+
+ /**
+ * An xsl:stylesheet element must not have any text node children.
+ */
+ XTSE0120,
+
+ /**
+ * It is a static error if the value of an [xsl:]default-collation
+ * attribute, after resolving against the base URI, contains no
+ * URI that the implementation recognizes as a collation URI.
+ */
+ XTSE0125,
+
+ /**
+ * It is a static error if the xsl:stylesheet element has a child
+ * element whose name has a null namespace URI.
+ */
+ XTSE0130,
+
+ /**
+ * A literal result element that is used as the outermost element
+ * of a simplified stylesheet module must have an xsl:version attribute.
+ */
+ XTSE0150,
+
+ /**
+ * It is a static error if the processor is not able to retrieve
+ * the resource identified by the URI reference [ in the href attribute
+ * of xsl:include or xsl:import] , or if the resource that is retrieved
+ * does not contain a stylesheet module conforming to this specification.
+ */
+ XTSE0165,
+
+ /**
+ * An xsl:include element must be a top-level element.
+ */
+ XTSE0170,
+
+ /**
+ * It is a static error if a stylesheet module directly or indirectly
+ * includes itself.
+ */
+ XTSE0180,
+
+ /**
+ * An xsl:import element must be a top-level element.
+ */
+ XTSE0190,
+
+ /**
+ * The xsl:import element children must precede all other element
+ * children of an xsl:stylesheet element, including any xsl:include
+ * element children and any user-defined data elements.
+ */
+ XTSE0200,
+
+ /**
+ * It is a static error if a stylesheet module directly or indirectly
+ * imports itself.
+ */
+ XTSE0210,
+
+ /**
+ * It is a static error if an xsl:import-schema element that contains
+ * an xs:schema element has a schema-location attribute, or if it
+ * has a namespace attribute that conflicts with the target namespace
+ * of the contained schema.
+ */
+ XTSE0215,
+
+ /**
+ * It is a static error if the synthetic schema document does not
+ * satisfy the constraints described in [XML Schema Part 1] (section
+ * 5.1, Errors in Schema Construction and Structure). This includes,
+ * without loss of generality, conflicts such as multiple definitions
+ * of the same name.
+ */
+ XTSE0220,
+
+ /**
+ * Within an XSLT element that is required to be empty, any content
+ * other than comments or processing instructions, including any
+ * whitespace text node preserved using the xml:space="preserve"
+ * attribute, is a static error.
+ */
+ XTSE0260,
+
+ /**
+ * It is a static error if there is a stylesheet module in the stylesheet
+ * that specifies input-type-annotations="strip" and another stylesheet
+ * module that specifies input-type-annotations="preserve".
+ */
+ XTSE0265,
+
+ /**
+ * In the case of a prefixed QName used as the value of an attribute
+ * in the stylesheet, or appearing within an XPath expression in
+ * the stylesheet, it is a static error if the defining element
+ * has no namespace node whose name matches the prefix of the QName.
+ */
+ XTSE0280,
+
+ /**
+ * Where an attribute is defined to contain a pattern, it is a static
+ * error if the pattern does not match the production Pattern.
+ */
+ XTSE0340,
+
+ /**
+ * It is a static error if an unescaped left curly bracket appears
+ * in a fixed part of an attribute value template without a matching
+ * right curly bracket.
+ */
+ XTSE0350,
+
+ /**
+ * It is a static error if an unescaped right curly bracket occurs
+ * in a fixed part of an attribute value template.
+ */
+ XTSE0370,
+
+ /**
+ * An xsl:template element must have either a match attribute or
+ * a name attribute, or both. An xsl:template element that has no
+ * match attribute must have no mode attribute and no priority attribute.
+ */
+ XTSE0500,
+
+ /**
+ * The value of this attribute [the priority attribute of the xsl:template
+ * element] must conform to the rules for the xs:decimal type defined
+ * in [XML Schema Part 2]. Negative values are permitted..
+ */
+ XTSE0530,
+
+ /**
+ * It is a static error if the list [of modes in the mode attribute
+ * of xsl:template] is empty, if the same token is included more
+ * than once in the list, if the list contains an invalid token,
+ * or if the token \#all appears together with any other value.
+ */
+ XTSE0550,
+
+ /**
+ * It is a static error if two parameters of a template or of a
+ * stylesheet function have the same name.
+ */
+ XTSE0580,
+
+ /**
+ * It is a static error if a variable-binding element has a select
+ * attribute and has non-empty content.
+ */
+ XTSE0620,
+
+ /**
+ * It is a static error if a stylesheet contains more than one binding
+ * of a global variable with the same name and same import precedence,
+ * unless it also contains another binding with the same name and
+ * higher import precedence.
+ */
+ XTSE0630,
+
+ /**
+ * It is a static error if a stylesheet contains an xsl:call-template
+ * instruction whose name attribute does not match the name attribute
+ * of any xsl:template in the stylesheet.
+ */
+ XTSE0650,
+
+ /**
+ * It is a static error if a stylesheet contains more than one template
+ * with the same name and the same import precedence, unless it
+ * also contains a template with the same name and higher import
+ * precedence.
+ */
+ XTSE0660,
+
+ /**
+ * It is a static error if a single xsl:call-template, xsl:apply-templates,
+ * xsl:apply-imports, or xsl:next-match element contains two or
+ * more xsl:with-param elements with matching name attributes.
+ */
+ XTSE0670,
+
+ /**
+ * In the case of xsl:call-template, it is a static error to pass
+ * a non-tunnel parameter named x to a template that does not have
+ * a template parameter named x, unless backwards compatible behavior
+ * is enabled for the xsl:call-template instruction.
+ */
+ XTSE0680,
+
+ /**
+ * It is a static error if a template that is invoked using xsl:call-template
+ * declares a template parameter specifying required="yes" and not
+ * specifying tunnel="yes", if no value for this parameter is supplied
+ * by the calling instruction.
+ */
+ XTSE0690,
+
+ /**
+ * It is a static error if the value of the use-attribute-sets attribute
+ * of an xsl:copy, xsl:element, or xsl:attribute-set element, or
+ * the xsl:use-attribute-sets attribute of a literal result element,
+ * is not a whitespace-separated sequence of QNames, or if it contains
+ * a QName that does not match the name attribute of any xsl:attribute-set
+ * declaration in the stylesheet.
+ */
+ XTSE0710,
+
+ /**
+ * It is a static error if an xsl:attribute-set element directly
+ * or indirectly references itself via the names contained in the
+ * use-attribute-sets attribute.
+ */
+ XTSE0720,
+
+ /**
+ * A stylesheet function must have a prefixed name, to remove any
+ * risk of a clash with a function in the default function namespace.
+ * It is a static error if the name has no prefix.
+ */
+ XTSE0740,
+
+ /**
+ * Because arguments to a stylesheet function call must all be specified,
+ * the xsl:param elements within an xsl:function element must not
+ * specify a default value: this means they must be empty, and must
+ * not have a select attribute.
+ */
+ XTSE0760,
+
+ /**
+ * It is a static error for a stylesheet to contain two or more
+ * functions with the same expanded-QName, the same arity, and the
+ * same import precedence, unless there is another function with
+ * the same expanded-QName and arity, and a higher import precedence.
+ */
+ XTSE0770,
+
+ /**
+ * It is a static error if an attribute on a literal result element
+ * is in the XSLT namespace, unless it is one of the attributes
+ * explicitly defined in this specification.
+ */
+ XTSE0805,
+
+ /**
+ * It is a static error if a namespace prefix is used within the
+ * [xsl:]exclude-result-prefixes attribute and there is no namespace
+ * binding in scope for that prefix.
+ */
+ XTSE0808,
+
+ /**
+ * It is a static error if the value \#default is used within the
+ * [xsl:]exclude-result-prefixes attribute and the parent element
+ * of the [xsl:]exclude-result-prefixes attribute has no default
+ * namespace.
+ */
+ XTSE0809,
+
+ /**
+ * It is a static error if there is more than one such declaration
+ * [more than one xsl:namespace-alias declaration] with the same
+ * literal namespace URI and the same import precedence and different
+ * values for the target namespace URI, unless there is also an
+ * xsl:namespace-alias declaration with the same literal namespace
+ * URI and a higher import precedence.
+ */
+ XTSE0810,
+
+ /**
+ * It is a static error if a value other than \#default is specified
+ * for either the stylesheet-prefix or the result-prefix attributes
+ * of the xsl:namespace-alias element when there is no in-scope
+ * binding for that namespace prefix.
+ */
+ XTSE0812,
+
+ /**
+ * It is a static error if the select attribute of the xsl:attribute
+ * element is present unless the element has empty content.
+ */
+ XTSE0840,
+
+ /**
+ * It is a static error if the select attribute of the xsl:value-of
+ * element is present when the content of the element is non-empty,
+ * or if the select attribute is absent when the content is empty.
+ */
+ XTSE0870,
+
+ /**
+ * It is a static error if the select attribute of the xsl:processing-instruction
+ * element is present unless the element has empty content.
+ */
+ XTSE0880,
+
+ /**
+ * It is a static error if the select attribute of the xsl:namespace
+ * element is present when the element has content other than one
+ * or more xsl:fallback instructions, or if the select attribute
+ * is absent when the element has empty content.
+ */
+ XTSE0910,
+
+ /**
+ * It is a static error if the select attribute of the xsl:comment
+ * element is present unless the element has empty content.
+ */
+ XTSE0940,
+
+ /**
+ * It is a type error to use the xsl:copy or xsl:copy-of instruction
+ * to copy a node that has namespace-sensitive content if the copy-namespaces
+ * attribute has the value no and its explicit or implicit validation
+ * attribute has the value preserve. It is also a type error if
+ * either of these instructions (with validation="preserve") is
+ * used to copy an attribute having namespace-sensitive content,
+ * unless the parent element is also copied. A node has namespace-sensitive
+ * content if its typed value contains an item of type xs:QName
+ * or xs:NOTATION or a type derived therefrom. The reason this is
+ * an error is because the validity of the content depends on the
+ * namespace context being preserved.
+ */
+ XTTE0950,
+
+ /**
+ * It is a static error if the value attribute of xsl:number is
+ * present unless the select, level, count, and from attributes
+ * are all absent.
+ */
+ XTSE0975,
+
+ /**
+ * It is a static error if an xsl:sort element with a select attribute
+ * has non-empty content.
+ */
+ XTSE1015,
+
+ /**
+ * It is a static error if an xsl:sort element other than the first
+ * in a sequence of sibling xsl:sort elements has a stable attribute.
+ */
+ XTSE1017,
+
+ /**
+ * It is a static error if an xsl:perform-sort instruction with
+ * a select attribute has any content other than xsl:sort and xsl:fallback
+ * instructions.
+ */
+ XTSE1040,
+
+ /**
+ * It is a static error if the current-group function is used within
+ * a pattern.
+ */
+ XTSE1060,
+
+ /**
+ * It is a static error if the current-grouping-key function is
+ * used within a pattern.
+ */
+ XTSE1070,
+
+ /**
+ * These four attributes [the group-by, group-adjacent, group-starting-with,
+ * and group-ending-with attributes of xsl:for-each-group ] are
+ * mutually exclusive: it is a static error if none of these four
+ * attributes is present, or if more than one of them is present.
+ */
+ XTSE1080,
+
+ /**
+ * It is an error to specify the collation attribute if neither
+ * the group-by attribute nor group-adjacent attribute is specified.
+ */
+ XTSE1090,
+
+ /**
+ * It is a static error if the xsl:analyze-string instruction contains
+ * neither an xsl:matching-substring nor an xsl:non-matching-substring
+ * element.
+ */
+ XTSE1130,
+
+ /**
+ * It is a static error if an xsl:key declaration has a use attribute
+ * and has non-empty content, or if it has empty content and no
+ * use attribute.
+ */
+ XTSE1205,
+
+ /**
+ * It is a static error if the xsl:key declaration has a collation
+ * attribute whose value (after resolving against the base URI)
+ * is not a URI recognized by the implementation as referring to
+ * a collation.
+ */
+ XTSE1210,
+
+ /**
+ * It is a static error if there are several xsl:key declarations
+ * in the stylesheet with the same key name and different effective
+ * collations. Two collations are the same if their URIs are equal
+ * under the rules for comparing xs:anyURI values, or if the implementation
+ * can determine that they are different URIs referring to the same
+ * collation.
+ */
+ XTSE1220,
+
+ /**
+ * It is a static error if a named or unnamed decimal format contains
+ * two conflicting values for the same attribute in different xsl:decimal-format
+ * declarations having the same import precedence, unless there
+ * is another definition of the same attribute with higher import
+ * precedence.
+ */
+ XTSE1290,
+
+ /**
+ * It is a static error if the character specified in the zero-digit
+ * attribute is not a digit or is a digit that does not have the
+ * numeric value zero.
+ */
+ XTSE1295,
+
+ /**
+ * It is a static error if, for any named or unnamed decimal format,
+ * the variables representing characters used in a picture string
+ * do not each have distinct values. These variables are decimal-separator-sign,
+ * grouping-sign, percent-sign, per-mille-sign, digit-zero-sign,
+ * digit-sign, and pattern-separator-sign.
+ */
+ XTSE1300,
+
+ /**
+ * It is a static error if there is no namespace bound to the prefix
+ * on the element bearing the [xsl:]extension-element-prefixes attribute
+ * or, when \#default is specified, if there is no default namespace.
+ */
+ XTSE1430,
+
+ /**
+ * It is a static error if both the [xsl:]type and [xsl:]validation
+ * attributes are present on the xsl:element, xsl:attribute, xsl:copy,
+ * xsl:copy-of, xsl:document, or xsl:result-document instructions,
+ * or on a literal result element.
+ */
+ XTSE1505,
+
+ /**
+ * It is a static error if the value of the type attribute of an
+ * xsl:element, xsl:attribute, xsl:copy, xsl:copy-of, xsl:document,
+ * or xsl:result-document instruction, or the xsl:type attribute
+ * of a literal result element, is not a valid QName, or if it uses
+ * a prefix that is not defined in an in-scope namespace declaration,
+ * or if the QName is not the name of a type definition included
+ * in the in-scope schema components for the stylesheet.
+ */
+ XTSE1520,
+
+ /**
+ * It is a static error if the value of the type attribute of an
+ * xsl:attribute instruction refers to a complex type definition
+ */
+ XTSE1530,
+
+ /**
+ * It is a static error if two xsl:output declarations within an
+ * output definition specify explicit values for the same attribute
+ * (other than cdata-section-elements and use-character-maps), with
+ * the values of the attributes being not equal, unless there is
+ * another xsl:output declaration within the same output definition
+ * that has higher import precedence and that specifies an explicit
+ * value for the same attribute.
+ */
+ XTSE1560,
+
+ /**
+ * The value [of the method attribute on xsl:output ] must (if present)
+ * be a valid QName. If the QName does not have a prefix, then it
+ * identifies a method specified in [XSLT and XQuery Serialization]
+ * and must be one of xml, html, xhtml, or text.
+ */
+ XTSE1570,
+
+ /**
+ * It is a static error if the stylesheet contains two or more character
+ * maps with the same name and the same import precedence, unless
+ * it also contains another character map with the same name and
+ * higher import precedence.
+ */
+ XTSE1580,
+
+ /**
+ * It is a static error if a name in the use-character-maps attribute
+ * of the xsl:output or xsl:character-map elements does not match
+ * the name attribute of any xsl:character-map in the stylesheet.
+ */
+ XTSE1590,
+
+ /**
+ * It is a static error if a character map references itself, directly
+ * or indirectly, via a name in the use-character-maps attribute.
+ */
+ XTSE1600,
+
+ /**
+ * A basic XSLT processor must signal a static error if the stylesheet
+ * includes an xsl:import-schema declaration.
+ */
+ XTSE1650,
+
+ /**
+ * A basic XSLT processor must signal a static error if the stylesheet
+ * includes an [xsl:]type attribute, or an [xsl:]validation or default-validation
+ * attribute with a value other than strip.
+ */
+ XTSE1660,
+
+ /**
+ * It is a type error if the result of evaluating the sequence constructor
+ * cannot be converted to the required type.
+ */
+ XTTE0505,
+
+ /**
+ * It is a type error if an xsl:apply-templates instruction with
+ * no select attribute is evaluated when the context item is not
+ * a node.
+ */
+ XTTE0510,
+
+ /**
+ * It is a type error if the sequence returned by the select expression
+ * [of xsl:apply-templates] contains an item that is not a node.
+ */
+ XTTE0520,
+
+ /**
+ * It is a type error if the supplied value of a variable cannot
+ * be converted to the required type.
+ */
+ XTTE0570,
+
+ /**
+ * It is a type error if the conversion of the supplied value of
+ * a parameter to its required type fails.
+ */
+ XTTE0590,
+
+ /**
+ * If a default value is given explicitly, that is, if there is
+ * either a select attribute or a non-empty sequence constructor,
+ * then it is a type error if the default value cannot be converted
+ * to the required type, using the function conversion rules.
+ */
+ XTTE0600,
+
+ /**
+ * If the as attribute [of xsl:function ] is specified, then the
+ * result evaluated by the sequence constructor (see 5.7 Sequence
+ * Constructors) is converted to the required type, using the function
+ * conversion rules. It is a type error if this conversion fails.
+ */
+ XTTE0780,
+
+ /**
+ * If the value of a parameter to a stylesheet function cannot be
+ * converted to the required type, a type error is signaled.
+ */
+ XTTE0790,
+
+ /**
+ * It is a type error if the xsl:number instruction is evaluated,
+ * with no value or select attribute, when the context item is not
+ * a node.
+ */
+ XTTE0990,
+
+ /**
+ * It is a type error if the result of evaluating the select attribute
+ * of the xsl:number instruction is anything other than a single
+ * node.
+ */
+ XTTE1000,
+
+ /**
+ * If any sort key value, after atomization and any type conversion
+ * required by the data-type attribute, is a sequence containing
+ * more than one item, then the effect depends on whether the xsl:sort
+ * element is evaluated with backwards compatible behavior. With
+ * backwards compatible behavior, the effective sort key value is
+ * the first item in the sequence. In other cases, this is a type
+ * error.
+ */
+ XTTE1020,
+
+ /**
+ * It is a type error if the grouping key evaluated using the group-adjacent
+ * attribute is an empty sequence, or a sequence containing more
+ * than one item.
+ */
+ XTTE1100,
+
+ /**
+ * When the group-starting-with or group-ending-with attribute [of
+ * the xsl:for-each-group instruction] is used, it is a type error
+ * if the result of evaluating the select expression contains an
+ * item that is not a node.
+ */
+ XTTE1120,
+
+ /**
+ * If the validation attribute of an xsl:element, xsl:attribute,
+ * xsl:copy, xsl:copy-of, or xsl:result-document instruction, or
+ * the xsl:validation attribute of a literal result element, has
+ * the effective value strict, and schema validity assessment concludes
+ * that the validity of the element or attribute is invalid or unknown,
+ * a type error occurs. As with other type errors, the error may
+ * be signaled statically if it can be detected statically.
+ */
+ XTTE1510,
+
+ /**
+ * If the validation attribute of an xsl:element, xsl:attribute,
+ * xsl:copy, xsl:copy-of, or xsl:result-document instruction, or
+ * the xsl:validation attribute of a literal result element, has
+ * the effective value strict, and there is no matching top-level
+ * declaration in the schema, then a type error occurs. As with
+ * other type errors, the error may be signaled statically if it
+ * can be detected statically.
+ */
+ XTTE1512,
+
+ /**
+ * If the validation attribute of an xsl:element, xsl:attribute,
+ * xsl:copy, xsl:copy-of, or xsl:result-document instruction, or
+ * the xsl:validation attribute of a literal result element, has
+ * the effective value lax, and schema validity assessment concludes
+ * that the element or attribute is invalid, a type error occurs.
+ * As with other type errors, the error may be signaled statically
+ * if it can be detected statically.
+ */
+ XTTE1515,
+
+ /**
+ * It is a type error if an [xsl:]type attribute is defined for
+ * a constructed element or attribute, and the outcome of schema
+ * validity assessment against that type is that the validity property
+ * of that element or attribute information item is other than valid.
+ */
+ XTTE1540,
+
+ /**
+ * A type error occurs if a type or validation attribute is defined
+ * (explicitly or implicitly) for an instruction that constructs
+ * a new attribute node, if the effect of this is to cause the attribute
+ * value to be validated against a type that is derived from, or
+ * constructed by list or union from, the primitive types xs:QName
+ * or xs:NOTATION.
+ */
+ XTTE1545,
+
+ /**
+ * A type error occurs [when a document node is validated] unless
+ * the children of the document node comprise exactly one element
+ * node, no text nodes, and zero or more comment and processing
+ * instruction nodes, in any order.
+ */
+ XTTE1550,
+
+ /**
+ * It is a type error if, when validating a document node, document-level
+ * constraints are not satisfied. These constraints include identity
+ * constraints (xs:unique, xs:key, and xs:keyref) and ID/IDREF constraints.
+ */
+ XTTE1555,
+
+ /**
+ * It is a non-recoverable dynamic error if the effective value
+ * of an attribute written using curly brackets, in a position where
+ * an attribute value template is permitted, is a value that is
+ * not one of the permitted values for that attribute. If the processor
+ * is able to detect the error statically (for example, when any
+ * XPath expressions within the curly brackets can be evaluated
+ * statically), then the processor may optionally signal this as
+ * a static error.
+ */
+ XTDE0030,
+
+ /**
+ * It is a non-recoverable dynamic error if the invocation of the
+ * stylesheet specifies a template name that does not match the
+ * expanded-QName of a named template defined in the stylesheet.
+ */
+ XTDE0040,
+
+ /**
+ * It is a non-recoverable dynamic error if the invocation of the
+ * stylesheet specifies an initial mode (other than the default
+ * mode) that does not match the expanded-QName in the mode attribute
+ * of any template defined in the stylesheet.
+ */
+ XTDE0045,
+
+ /**
+ * It is a non-recoverable dynamic error if the invocation of the
+ * stylesheet specifies both an initial mode and an initial template.
+ */
+ XTDE0047,
+
+ /**
+ * It is a non-recoverable dynamic error if the stylesheet that
+ * is invoked declares a visible stylesheet parameter with required="yes"
+ * and no value for this parameter is supplied during the invocation
+ * of the stylesheet. A stylesheet parameter is visible if it is
+ * not masked by another global variable or parameter with the same
+ * name and higher import precedence.
+ */
+ XTDE0050,
+
+ /**
+ * It is a non-recoverable dynamic error if the initial template
+ * defines a template parameter that specifies required="yes".
+ */
+ XTDE0060,
+
+ /**
+ * If an implementation does not support backwards-compatible behavior,
+ * then it is a non-recoverable dynamic error if any element is
+ * evaluated that enables backwards-compatible behavior.
+ */
+ XTDE0160,
+
+ /**
+ * It is a recoverable dynamic error if this [the process of finding
+ * an xsl:strip-space or xsl:preserve-space declaration to match
+ * an element in the source document] leaves more than one match,
+ * unless all the matched declarations are equivalent (that is,
+ * they are all xsl:strip-space or they are all xsl:preserve-space).
+ * Action: The optional recovery action is to select, from the matches
+ * that are left, the one that occurs last in declaration order.
+ */
+ XTRE0270,
+
+ /**
+ * Where the result of evaluating an XPath expression (or an attribute
+ * value template) is required to be a lexical QName, then unless
+ * otherwise specified it is a non-recoverable dynamic error if
+ * the defining element has no namespace node whose name matches
+ * the prefix of the lexical QName. This error may be signaled as
+ * a static error if the value of the expression can be determined
+ * statically.
+ */
+ XTDE0290,
+
+ /**
+ * It is a non-recoverable dynamic error if the result sequence
+ * used to construct the content of an element node contains a namespace
+ * node or attribute node that is preceded in the sequence by a
+ * node that is neither a namespace node nor an attribute node.
+ */
+ XTDE0410,
+
+ /**
+ * It is a non-recoverable dynamic error if the result sequence
+ * used to construct the content of a document node contains a namespace
+ * node or attribute node.
+ */
+ XTDE0420,
+
+ /**
+ * It is a non-recoverable dynamic error if the result sequence
+ * contains two or more namespace nodes having the same name but
+ * different string values (that is, namespace nodes that map the
+ * same prefix to different namespace URIs).
+ */
+ XTDE0430,
+
+ /**
+ * It is a non-recoverable dynamic error if the result sequence
+ * contains a namespace node with no name and the element node being
+ * constructed has a null namespace URI (that is, it is an error
+ * to define a default namespace when the element is in no namespace).
+ */
+ XTDE0440,
+
+ /**
+ * It is a non-recoverable dynamic error if namespace fixup is performed
+ * on an element that contains among the typed values of the element
+ * and its attributes two values of type xs:QName or xs:NOTATION
+ * containing conflicting namespace prefixes, that is, two values
+ * that use the same prefix to refer to different namespace URIs.
+ */
+ XTDE0485,
+
+ /**
+ * It is a recoverable dynamic error if the conflict resolution
+ * algorithm for template rules leaves more than one matching template
+ * rule. Action: The optional recovery action is to select, from
+ * the matching template rules that are left, the one that occurs
+ * last in declaration order.
+ */
+ XTRE0540,
+
+ /**
+ * It is a non-recoverable dynamic error if xsl:apply-imports or
+ * xsl:next-match is evaluated when the current template rule is
+ * null.
+ */
+ XTDE0560,
+
+ /**
+ * If an optional parameter has no select attribute and has an empty
+ * sequence constructor, and if there is an as attribute, then the
+ * default value of the parameter is an empty sequence. If the empty
+ * sequence is not a valid instance of the required type defined
+ * in the as attribute, then the parameter is treated as a required
+ * parameter, which means that it is a non-recoverable dynamic error
+ * if the caller supplies no value for the parameter.
+ */
+ XTDE0610,
+
+ /**
+ * In general, a circularity in a stylesheet is a non-recoverable
+ * dynamic error.
+ */
+ XTDE0640,
+
+ /**
+ * In other cases, [with xsl:apply-templates, xsl:apply-imports,
+ * and xsl:next-match, or xsl:call-template with tunnel parameters]
+ * it is a non-recoverable dynamic error if the template that is
+ * invoked declares a template parameter with required="yes" and
+ * no value for this parameter is supplied by the calling instruction.
+ */
+ XTDE0700,
+
+ /**
+ * It is a recoverable dynamic error if the name of a constructed
+ * attribute is xml:space and the value is not either default or
+ * preserve. Action: The optional recovery action is to construct
+ * the attribute with the value as requested.
+ */
+ XTRE0795,
+
+ /**
+ * It is a non-recoverable dynamic error if the effective value
+ * of the name attribute [of the xsl:element instruction] is not
+ * a lexical QName.
+ */
+ XTDE0820,
+
+ /**
+ * In the case of an xsl:element instruction with no namespace attribute,
+ * it is a non-recoverable dynamic error if the effective value
+ * of the name attribute is a QName whose prefix is not declared
+ * in an in-scope namespace declaration for the xsl:element instruction.
+ */
+ XTDE0830,
+
+ /**
+ * It is a non-recoverable dynamic error if the effective value
+ * of the namespace attribute [of the xsl:element instruction] is
+ * not in the lexical space of the xs:anyURI data type.
+ */
+ XTDE0835,
+
+ /**
+ * It is a non-recoverable dynamic error if the effective value
+ * of the name attribute [of an xsl:attribute instruction] is not
+ * a lexical QName.
+ */
+ XTDE0850,
+
+ /**
+ * In the case of an xsl:attribute instruction with no namespace
+ * attribute, it is a non-recoverable dynamic error if the effective
+ * value of the name attribute is the string xmlns.
+ */
+ XTDE0855,
+
+ /**
+ * In the case of an xsl:attribute instruction with no namespace
+ * attribute, it is a non-recoverable dynamic error if the effective
+ * value of the name attribute is a lexical QName whose prefix is
+ * not declared in an in-scope namespace declaration for the xsl:attribute
+ * instruction.
+ */
+ XTDE0860,
+
+ /**
+ * It is a non-recoverable dynamic error if the effective value
+ * of the namespace attribute [of the xsl:attribute instruction]
+ * is not in the lexical space of the xs:anyURI data type.
+ */
+ XTDE0865,
+
+ /**
+ * It is a non-recoverable dynamic error if the effective value
+ * of the name attribute [of the xsl:processing-instruction instruction]
+ * is not both an NCName Names and a PITarget XML.
+ */
+ XTDE0890,
+
+ /**
+ * It is a non-recoverable dynamic error if the string value of
+ * the new namespace node [created using xsl:namespace] is not valid
+ * in the lexical space of the data type xs:anyURI. [see ERR XTDE0835]
+ */
+ XTDE0905,
+
+ /**
+ * It is a non-recoverable dynamic error if the effective value
+ * of the name attribute [of the xsl:namespace instruction] is neither
+ * a zero-length string nor an NCName Names, or if it is xmlns.
+ */
+ XTDE0920,
+
+ /**
+ * It is a non-recoverable dynamic error if the xsl:namespace instruction
+ * generates a namespace node whose name is xml and whose string
+ * value is not http://www.w3.org/XML/1998/namespace, or a namespace
+ * node whose string value is http://www.w3.org/XML/1998/namespace
+ * and whose name is not xml.
+ */
+ XTDE0925,
+
+ /**
+ * It is a non-recoverable dynamic error if evaluating the select
+ * attribute or the contained sequence constructor of an xsl:namespace
+ * instruction results in a zero-length string.
+ */
+ XTDE0930,
+
+ /**
+ * It is a non-recoverable dynamic error if any undiscarded item
+ * in the atomized sequence supplied as the value of the value attribute
+ * of xsl:number cannot be converted to an integer, or if the resulting
+ * integer is less than 0 (zero).
+ */
+ XTDE0980,
+
+ /**
+ * It is a non-recoverable dynamic error if, for any sort key component,
+ * the set of sort key values evaluated for all the items in the
+ * initial sequence, after any type conversion requested, contains
+ * a pair of ordinary values for which the result of the XPath lt
+ * operator is an error.
+ */
+ XTDE1030,
+
+ /**
+ * It is a non-recoverable dynamic error if the collation attribute
+ * of xsl:sort (after resolving against the base URI) is not a URI
+ * that is recognized by the implementation as referring to a collation.
+ */
+ XTDE1035,
+
+ /**
+ * It is a non-recoverable dynamic error if the collation URI specified
+ * to xsl:for-each-group (after resolving against the base URI)
+ * is a collation that is not recognized by the implementation.
+ * (For notes, [see ERR XTDE1035].)
+ */
+ XTDE1110,
+
+ /**
+ * It is a non-recoverable dynamic error if the effective value
+ * of the regex attribute [of the xsl:analyze-string instruction]
+ * does not conform to the required syntax for regular expressions,
+ * as specified in [Functions and Operators]. If the regular expression
+ * is known statically (for example, if the attribute does not contain
+ * any expressions enclosed in curly brackets) then the processor
+ * may signal the error as a static error.
+ */
+ XTDE1140,
+
+ /**
+ * It is a non-recoverable dynamic error if the effective value
+ * of the flags attribute [of the xsl:analyze-string instruction]
+ * has a value other than the values defined in [Functions and Operators].
+ * If the value of the attribute is known statically (for example,
+ * if the attribute does not contain any expressions enclosed in
+ * curly brackets) then the processor may signal the error as a
+ * static error.
+ */
+ XTDE1145,
+
+ /**
+ * It is a non-recoverable dynamic error if the effective value
+ * of the regex attribute [of the xsl:analyze-string instruction]
+ * is a regular expression that matches a zero-length string: or
+ * more specifically, if the regular expression $r and flags $f
+ * are such that matches("", $r, $f) returns true. If the regular
+ * expression is known statically (for example, if the attribute
+ * does not contain any expressions enclosed in curly brackets)
+ * then the processor may signal the error as a static error.
+ */
+ XTDE1150,
+
+ /**
+ * When a URI reference [supplied to the document function] contains
+ * a fragment identifier, it is a recoverable dynamic error if the
+ * media type is not one that is recognized by the processor, or
+ * if the fragment identifier does not conform to the rules for
+ * fragment identifiers for that media type, or if the fragment
+ * identifier selects something other than a sequence of nodes (for
+ * example, if it selects a range of characters within a text node).
+ * Action: The optional recovery action is to ignore the fragment
+ * identifier and return the document node.
+ */
+ XTRE1160,
+
+ /**
+ * It is a non-recoverable dynamic error if a URI [supplied in the
+ * first argument to the unparsed-text function] contains a fragment
+ * identifier, or if it cannot be used to retrieve a resource containing
+ * text.
+ */
+ XTDE1170,
+
+ /**
+ * It is a non-recoverable dynamic error if a resource [retrieved
+ * using the unparsed-text function] contains octets that cannot
+ * be decoded into Unicode characters using the specified encoding,
+ * or if the resulting characters are not permitted XML characters.
+ * This includes the case where the processor does not support the
+ * requested encoding.
+ */
+ XTDE1190,
+
+ /**
+ * It is a non-recoverable dynamic error if the second argument
+ * of the unparsed-text function is omitted and the processor cannot
+ * infer the encoding using external information and the encoding
+ * is not UTF-8.
+ */
+ XTDE1200,
+
+ /**
+ * It is a non-recoverable dynamic error if the value [of the first
+ * argument to the key function] is not a valid QName, or if there
+ * is no namespace declaration in scope for the prefix of the QName,
+ * or if the name obtained by expanding the QName is not the same
+ * as the expanded name of any xsl:key declaration in the stylesheet.
+ * If the processor is able to detect the error statically (for
+ * example, when the argument is supplied as a string literal),
+ * then the processor may optionally signal this as a static error.
+ */
+ XTDE1260,
+
+ /**
+ * It is a non-recoverable dynamic error to call the key function
+ * with two arguments if there is no context node, or if the root
+ * of the tree containing the context node is not a document node;
+ * or to call the function with three arguments if the root of the
+ * tree containing the node supplied in the third argument is not
+ * a document node.
+ */
+ XTDE1270,
+
+ /**
+ * It is a non-recoverable dynamic error if the name specified as
+ * the $decimal-format-name argument [ to the format-number function]
+ * is not a valid QName, or if its prefix has not been declared
+ * in an in-scope namespace declaration, or if the stylesheet does
+ * not contain a declaration of a decimal-format with a matching
+ * expanded-QName. If the processor is able to detect the error
+ * statically (for example, when the argument is supplied as a string
+ * literal), then the processor may optionally signal this as a
+ * static error.
+ */
+ XTDE1280,
+
+ /**
+ * The picture string [supplied to the format-number function] must
+ * conform to the following rules. [ See full specification.] It
+ * is a non-recoverable dynamic error if the picture string does
+ * not satisfy these rules.
+ */
+ XTDE1310,
+
+ /**
+ * It is a non-recoverable dynamic error if the syntax of the picture
+ * [used for date/time formatting] is incorrect.
+ */
+ XTDE1340,
+
+ /**
+ * It is a non-recoverable dynamic error if a component specifier
+ * within the picture [used for date/time formatting] refers to
+ * components that are not available in the given type of $value,
+ * for example if the picture supplied to the format-time refers
+ * to the year, month, or day component.
+ */
+ XTDE1350,
+
+ /**
+ * If the current function is evaluated within an expression that
+ * is evaluated when the context item is undefined, a non-recoverable
+ * dynamic error occurs.
+ */
+ XTDE1360,
+
+ /**
+ * It is a non-recoverable dynamic error if the unparsed-entity-uri
+ * function is called when there is no context node, or when the
+ * root of the tree containing the context node is not a document
+ * node.
+ */
+ XTDE1370,
+
+ /**
+ * It is a non-recoverable dynamic error if the unparsed-entity-public-id
+ * function is called when there is no context node, or when the
+ * root of the tree containing the context node is not a document
+ * node.
+ */
+ XTDE1380,
+
+ /**
+ * It is a non-recoverable dynamic error if the value [supplied
+ * as the $property-name argument to the system-property function]
+ * is not a valid QName, or if there is no namespace declaration
+ * in scope for the prefix of the QName. If the processor is able
+ * to detect the error statically (for example, when the argument
+ * is supplied as a string literal), then the processor may optionally
+ * signal this as a static error.
+ */
+ XTDE1390,
+
+ /**
+ * When a transformation is terminated by use of xsl:message terminate="yes",
+ * the effect is the same as when a non-recoverable dynamic error
+ * occurs during the transformation.
+ */
+ XTMM9000,
+
+ /**
+ * It is a non-recoverable dynamic error if the argument [passed
+ * to the function-available function] does not evaluate to a string
+ * that is a valid QName, or if there is no namespace declaration
+ * in scope for the prefix of the QName. If the processor is able
+ * to detect the error statically (for example, when the argument
+ * is supplied as a string literal), then the processor may optionally
+ * signal this as a static error.
+ */
+ XTDE1400,
+
+ /**
+ * It is a non-recoverable dynamic error if the arguments supplied
+ * to a call on an extension function do not satisfy the rules defined
+ * for that particular extension function, or if the extension function
+ * reports an error, or if the result of the extension function
+ * cannot be converted to an XPath value.
+ */
+ XTDE1420,
+
+ /**
+ * When backwards compatible behavior is enabled, it is a non-recoverable
+ * dynamic error to evaluate an extension function call if no implementation
+ * of the extension function is available.
+ */
+ XTDE1425,
+
+ /**
+ * It is a non-recoverable dynamic error if the argument [passed
+ * to the type-available function] does not evaluate to a string
+ * that is a valid QName, or if there is no namespace declaration
+ * in scope for the prefix of the QName. If the processor is able
+ * to detect the error statically (for example, when the argument
+ * is supplied as a string literal), then the processor may optionally
+ * signal this as a static error.
+ */
+ XTDE1428,
+
+ /**
+ * It is a non-recoverable dynamic error if the argument [passed
+ * to the element-available function] does not evaluate to a string
+ * that is a valid QName, or if there is no namespace declaration
+ * in scope for the prefix of the QName. If the processor is able
+ * to detect the error statically (for example, when the argument
+ * is supplied as a string literal), then the processor may optionally
+ * signal this as a static error.
+ */
+ XTDE1440,
+
+ /**
+ * When a processor performs fallback for an extension instruction
+ * that is not recognized, if the instruction element has one or
+ * more xsl:fallback children, then the content of each of the xsl:fallback
+ * children must be evaluated; it is a non-recoverable dynamic error
+ * if it has no xsl:fallback children.
+ */
+ XTDE1450,
+
+ /**
+ * It is a non-recoverable dynamic error if the effective value
+ * of the format attribute [of an xsl:result-document element] is
+ * not a valid lexical QName, or if it does not match the expanded-QName
+ * of an output definition in the stylesheet. If the processor is
+ * able to detect the error statically (for example, when the format
+ * attribute contains no curly brackets), then the processor may
+ * optionally signal this as a static error.
+ */
+ XTDE1460,
+
+ /**
+ * It is a non-recoverable dynamic error to evaluate the xsl:result-document
+ * instruction in temporary output state.
+ */
+ XTDE1480,
+
+ /**
+ * It is a non-recoverable dynamic error for a transformation to
+ * generate two or more final result trees with the same URI.
+ */
+ XTDE1490,
+
+ /**
+ * It is a recoverable dynamic error for a transformation to generate
+ * two or more final result trees with URIs that identify the same
+ * physical resource. The optional recovery action is implementation-dependent,
+ * since it may be impossible for the processor to detect the error.
+ */
+ XTRE1495,
+
+ /**
+ * It is a recoverable dynamic error for a stylesheet to write to
+ * an external resource and read from the same resource during a
+ * single transformation, whether or not the same URI is used to
+ * access the resource in both cases. Action: The optional recovery
+ * action is implementation-dependent: implementations are not required
+ * to detect the error condition. Note that if the error is not
+ * detected, it is undefined whether the document that is read from
+ * the resource reflects its state before or after the result tree
+ * is written.
+ */
+ XTRE1500,
+
+ /**
+ * It is a recoverable dynamic error if an xsl:value-of or xsl:text
+ * instruction specifies that output escaping is to be disabled
+ * and the implementation does not support this. Action: The optional
+ * recovery action is to ignore the disable-output-escaping attribute.
+ */
+ XTRE1620,
+
+ /**
+ * It is a recoverable dynamic error if an xsl:value-of or xsl:text
+ * instruction specifies that output escaping is to be disabled
+ * when writing to a final result tree that is not being serialized.
+ * Action: The optional recovery action is to ignore the disable-output-escaping
+ * attribute.
+ */
+ XTRE1630,
+
+ /**
+ * A basic XSLT processor must raise a non-recoverable dynamic error
+ * if the input to the processor includes a node with a type annotation
+ * other than xs:untyped or xs:untypedAtomic, or an atomic value
+ * of a type other than those which a basic XSLT processor supports.
+ */
+ XTDE1665
+
+ };
+
+ /**
+ * Issues a warning, should not be used excessively. This can
+ * be used to communicate that a certain implementation defined
+ * feature is unsupported or that a certain expression most likely
+ * doesn't do what the users wants, to name a few examples.
+ *
+ * @see <a href="http://www.w3.org/TR/xpath20/#errors">XML Path Language (XPath) 2.0,
+ * 2.3 Error Handling</a>
+ * @param message the message to be read by the user.
+ * @param sourceLocation the location of where the warning originates from.
+ */
+ void warning(const QString &message, const QSourceLocation &sourceLocation = QSourceLocation());
+
+ /**
+ * Issues an error. May be used at the static analysis phase or
+ * the dynamic evaluation phase.
+ *
+ * For SourceLocationReflection instances, the overload taking an SouourceLocationReflection should be used.
+ *
+ * @see <a href="http://www.w3.org/TR/xpath20/#errors">XML Path Language (XPath) 2.0,
+ * 2.3 Error Handling</a>
+ * @param message the message to be read by the user.
+ * @param errorCode identifies the error condition, as described
+ * @param sourceLocation the location of where the error originates from
+ * in "XML Path Language (XPath) 2.0" section "G Error Conditions"
+ */
+ void error(const QString &message,
+ const ReportContext::ErrorCode errorCode,
+ const QSourceLocation &sourceLocation);
+
+ /**
+ * Overload.
+ *
+ * Same as the above, but passes the SourceLocationReflection as reference for error reporting.
+ */
+ void error(const QString &message,
+ const ReportContext::ErrorCode errorCode,
+ const SourceLocationReflection *const reflection);
+
+ /**
+ * Issues an error which is not identified in the XPath specifications. This function
+ * is among other things used for implementing the <tt>fn:error()</tt> function.
+ */
+ void error(const QString &message,
+ const QXmlName qName,
+ const SourceLocationReflection *const r);
+
+ /**
+ * @return the QAbstractMessageHandler which functions such as warning() and
+ * error() should submit messages to. This function
+ * may never return @c null; a valid QAbstractMessageHandler pointer must always be returned.
+ */
+ virtual QAbstractMessageHandler *messageHandler() const = 0;
+
+ virtual NamePool::Ptr namePool() const = 0;
+
+ /**
+ * Returns a string representation of the error code @p code.
+ *
+ * @see ReportContext::ErrorCode
+ * @param errorCode identifies the error condition, as described
+ * in <a href="http://www.w3.org/TR/xpath20/#id-errors">XML Path
+ * Language (XPath) 2.0, G Error Conditions</a>
+ */
+ static QString codeToString(const ReportContext::ErrorCode errorCode);
+
+ /**
+ * @returns the error code part of @p typeURI and sets @p uri to the error namespace. Note
+ * that the error namespace not necessarily is the namespace for XPath and
+ * XQuery errors, http://www.w3.org/2005/xqt-errors, but can be user defined.
+ */
+ static QString codeFromURI(const QString &typeURI,
+ QString &uri);
+
+ /**
+ * @short Returns the source location applying for @p reflection.
+ */
+ virtual QSourceLocation locationFor(const SourceLocationReflection *const reflection) const = 0;
+
+ /**
+ * Resolves @p relative against @p baseURI, possibly using a URI resolver.
+ */
+ QUrl resolveURI(const QUrl &relative,
+ const QUrl &baseURI) const;
+
+ /**
+ * @short The URI resolver in use.
+ *
+ * If no URI resolver is in use, a @c null pointer is returned.
+ *
+ * @note You should probably use resolveURI(), which handles the case of
+ * when uriResolver() is @c null.
+ */
+ virtual const QAbstractUriResolver *uriResolver() const = 0;
+
+ private:
+ void createError(const QString &description,
+ const QtMsgType type,
+ const QUrl &id,
+ const QSourceLocation &sourceLocation) const;
+ static inline QString finalizeDescription(const QString &desc);
+ QSourceLocation lookupSourceLocation(const SourceLocationReflection *const ref) const;
+
+ Q_DISABLE_COPY(ReportContext)
+ };
+
+ /**
+ * @short This is the class type that is being thrown when a query error occur.
+ *
+ * @relates ReportContext
+ */
+ typedef bool Exception;
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/environment/qstackcontextbase.cpp b/src/xmlpatterns/environment/qstackcontextbase.cpp
new file mode 100644
index 0000000..fbed9cd
--- /dev/null
+++ b/src/xmlpatterns/environment/qstackcontextbase.cpp
@@ -0,0 +1,153 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 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 qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/**
+ * @file
+ * @short This file is included by qstackcontextbase_p.h.
+ * If you need includes in this file, put them in qstackcontextbase_p.h, outside of the namespace.
+ */
+
+template<typename TSuperClass>
+StackContextBase<TSuperClass>::StackContextBase() : m_rangeVariables(10),
+ m_expressionVariables(10),
+ m_positionIterators(5),
+ m_itemCacheCells(5),
+ m_itemSequenceCacheCells(5)
+{
+ /* The m_* containers are initialized with default sizes. Estimated guesses on usage patterns. */
+}
+
+template<typename TSuperClass>
+StackContextBase<TSuperClass>::StackContextBase(const DynamicContext::Ptr &prevContext)
+ : TSuperClass(prevContext),
+ m_rangeVariables(10),
+ m_expressionVariables(10),
+ m_positionIterators(5),
+ m_itemCacheCells(5),
+ m_itemSequenceCacheCells(5)
+{
+ Q_ASSERT(prevContext);
+}
+
+template<typename TSuperClass>
+ItemCacheCell &StackContextBase<TSuperClass>::itemCacheCell(const VariableSlotID slot)
+{
+ if(slot >= m_itemCacheCells.size())
+ m_itemCacheCells.resize(qMax(slot + 1, m_itemCacheCells.size()));
+
+ return m_itemCacheCells[slot];
+}
+
+template<typename TSuperClass>
+ItemSequenceCacheCell::Vector &StackContextBase<TSuperClass>::itemSequenceCacheCells(const VariableSlotID slot)
+{
+ if(slot >= m_itemSequenceCacheCells.size())
+ m_itemSequenceCacheCells.resize(qMax(slot + 1, m_itemSequenceCacheCells.size()));
+
+ return m_itemSequenceCacheCells;
+}
+
+template<typename TSuperClass>
+Item StackContextBase<TSuperClass>::rangeVariable(const VariableSlotID slot) const
+{
+ Q_ASSERT(slot < m_rangeVariables.size());
+ Q_ASSERT(m_rangeVariables.at(slot));
+ return m_rangeVariables.at(slot);
+}
+
+template<typename TSuperClass>
+Expression::Ptr StackContextBase<TSuperClass>::expressionVariable(const VariableSlotID slot) const
+{
+ Q_ASSERT(slot < m_expressionVariables.size());
+ Q_ASSERT(m_expressionVariables.at(slot));
+ return m_expressionVariables.at(slot);
+}
+
+template<typename TSuperClass>
+Item::Iterator::Ptr StackContextBase<TSuperClass>::positionIterator(const VariableSlotID slot) const
+{
+ Q_ASSERT(slot < m_positionIterators.size());
+ return m_positionIterators.at(slot);
+}
+
+template<typename TSuperClass>
+template<typename VectorType, typename UnitType>
+inline
+void StackContextBase<TSuperClass>::setSlotVariable(const VariableSlotID slot,
+ const UnitType &newValue,
+ VectorType &container) const
+{
+ if(slot < container.size())
+ container.replace(slot, newValue);
+ else
+ {
+ container.resize(slot + 1);
+ container.replace(slot, newValue);
+ }
+}
+
+template<typename TSuperClass>
+void StackContextBase<TSuperClass>::setRangeVariable(const VariableSlotID slot,
+ const Item &newValue)
+{
+ setSlotVariable(slot, newValue, m_rangeVariables);
+}
+
+template<typename TSuperClass>
+void StackContextBase<TSuperClass>::setExpressionVariable(const VariableSlotID slot,
+ const Expression::Ptr &newValue)
+{
+ setSlotVariable(slot, newValue, m_expressionVariables);
+}
+
+template<typename TSuperClass>
+void StackContextBase<TSuperClass>::setPositionIterator(const VariableSlotID slot,
+ const Item::Iterator::Ptr &newValue)
+{
+ setSlotVariable(slot, newValue, m_positionIterators);
+}
+
+template<typename TSuperClass>
+DynamicContext::TemplateParameterHash &StackContextBase<TSuperClass>::templateParameterStore()
+{
+ return m_templateParameterStore;
+}
+
diff --git a/src/xmlpatterns/environment/qstackcontextbase_p.h b/src/xmlpatterns/environment/qstackcontextbase_p.h
new file mode 100644
index 0000000..ac1f038
--- /dev/null
+++ b/src/xmlpatterns/environment/qstackcontextbase_p.h
@@ -0,0 +1,136 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 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 qt-sales@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_StackContextBase_H
+#define Patternist_StackContextBase_H
+
+#include <QVector>
+
+#include "qdaytimeduration_p.h"
+#include "qdelegatingdynamiccontext_p.h"
+#include "qexpression_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short Base class for all DynamicContext classes that needs to supply
+ * variables. It has a new frame for local caches, position iterators,
+ * expressions, range variables, template parameters but notably continues
+ * to delegate global caches.
+ *
+ * @author Frans Englich <fenglich@trolltech.com>
+ */
+ template<typename TSuperClass>
+ class StackContextBase : public TSuperClass
+ {
+ public:
+ StackContextBase();
+ /**
+ * Construct a StackContextBase and passes @p prevContext to its super class. This
+ * constructor is typically used when the super class is DelegatingDynamicContext.
+ */
+ StackContextBase(const DynamicContext::Ptr &prevContext);
+
+ virtual void setRangeVariable(const VariableSlotID slotNumber,
+ const Item &newValue);
+ virtual Item rangeVariable(const VariableSlotID slotNumber) const;
+
+ virtual void setExpressionVariable(const VariableSlotID slotNumber,
+ const Expression::Ptr &newValue);
+ virtual Expression::Ptr expressionVariable(const VariableSlotID slotNumber) const;
+
+ virtual Item::Iterator::Ptr positionIterator(const VariableSlotID slot) const;
+ virtual void setPositionIterator(const VariableSlotID slot,
+ const Item::Iterator::Ptr &newValue);
+ virtual ItemCacheCell &itemCacheCell(const VariableSlotID slot);
+ virtual ItemSequenceCacheCell::Vector &itemSequenceCacheCells(const VariableSlotID slot);
+
+ virtual DynamicContext::TemplateParameterHash &templateParameterStore();
+
+ protected:
+ /**
+ * This function is protected, although it only is used in this class. I don't
+ * know why it has to be, but it won't compile when private.
+ */
+ template<typename VectorType, typename UnitType>
+ inline
+ void setSlotVariable(const VariableSlotID slot,
+ const UnitType &newValue,
+ VectorType &container) const;
+
+ private:
+ Item::Vector m_rangeVariables;
+ Expression::Vector m_expressionVariables;
+ Item::Iterator::Vector m_positionIterators;
+ ItemCacheCell::Vector m_itemCacheCells;
+ ItemSequenceCacheCell::Vector m_itemSequenceCacheCells;
+ DynamicContext::TemplateParameterHash m_templateParameterStore;
+ };
+
+ #include "qstackcontextbase.cpp"
+
+ /**
+ * @short A DynamicContext that creates a new scope for variables.
+ *
+ * This DynamicContext is used for recursive user function calls, for example.
+ */
+ typedef StackContextBase<DelegatingDynamicContext> StackContext;
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/environment/qstaticbaseuricontext.cpp b/src/xmlpatterns/environment/qstaticbaseuricontext.cpp
new file mode 100644
index 0000000..280763a
--- /dev/null
+++ b/src/xmlpatterns/environment/qstaticbaseuricontext.cpp
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 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 qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qstaticbaseuricontext_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+StaticBaseURIContext::StaticBaseURIContext(const QUrl &bURI,
+ const StaticContext::Ptr &prevContext) : DelegatingStaticContext(prevContext)
+ , m_baseURI(bURI)
+{
+ Q_ASSERT(m_baseURI.isValid());
+ Q_ASSERT(!m_baseURI.isRelative());
+ Q_ASSERT(prevContext);
+}
+
+QUrl StaticBaseURIContext::baseURI() const
+{
+ return m_baseURI;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/environment/qstaticbaseuricontext_p.h b/src/xmlpatterns/environment/qstaticbaseuricontext_p.h
new file mode 100644
index 0000000..db0d85c
--- /dev/null
+++ b/src/xmlpatterns/environment/qstaticbaseuricontext_p.h
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 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 qt-sales@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_StaticBaseURIContext_H
+#define Patternist_StaticBaseURIContext_H
+
+#include "qdelegatingstaticcontext_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short A StaticContext that changes the static base URI.
+ * of items.
+ *
+ * @since 4.5
+ * @author Frans Englich <fenglich@trolltech.com>
+ */
+ class StaticBaseURIContext : public DelegatingStaticContext
+ {
+ public:
+ /**
+ * The @p bURI is the new static base URI, and it must be valid
+ * and absolute.
+ */
+ StaticBaseURIContext(const QUrl &bURI,
+ const StaticContext::Ptr &prevContext);
+
+ virtual QUrl baseURI() const;
+
+ private:
+ const QUrl m_baseURI;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/environment/qstaticcompatibilitycontext.cpp b/src/xmlpatterns/environment/qstaticcompatibilitycontext.cpp
new file mode 100644
index 0000000..c437ba1
--- /dev/null
+++ b/src/xmlpatterns/environment/qstaticcompatibilitycontext.cpp
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 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 qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qstaticcompatibilitycontext_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+StaticCompatibilityContext::StaticCompatibilityContext(const StaticContext::Ptr &context) : DelegatingStaticContext(context)
+{
+}
+
+bool StaticCompatibilityContext::compatModeEnabled() const
+{
+ return true;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/environment/qstaticcompatibilitycontext_p.h b/src/xmlpatterns/environment/qstaticcompatibilitycontext_p.h
new file mode 100644
index 0000000..4fbeff7
--- /dev/null
+++ b/src/xmlpatterns/environment/qstaticcompatibilitycontext_p.h
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 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 qt-sales@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_StaticCompatibilityContext_H
+#define Patternist_StaticCompatibilityContext_H
+
+#include "qdelegatingstaticcontext_p.h"
+
+QT_BEGIN_HEADER
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short Has the XPath Compatibility Mode activated. Used for XSL-T 2.0's
+ * compatibility mode.
+ *
+ * @since 4.5
+ * @author Frans Englich <fenglich@trolltech.com>
+ */
+ class Q_AUTOTEST_EXPORT StaticCompatibilityContext : public DelegatingStaticContext
+ {
+ public:
+ StaticCompatibilityContext(const StaticContext::Ptr &context);
+
+ /**
+ * Returns always @c true.
+ */
+ virtual bool compatModeEnabled() const;
+ };
+}
+
+QT_END_NAMESPACE
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/environment/qstaticcontext.cpp b/src/xmlpatterns/environment/qstaticcontext.cpp
new file mode 100644
index 0000000..69067de
--- /dev/null
+++ b/src/xmlpatterns/environment/qstaticcontext.cpp
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 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 qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qcommonnamespaces_p.h"
+#include "qexpression_p.h"
+
+#include "qstaticcontext_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+StaticContext::~StaticContext()
+{
+}
+
+void StaticContext::wrapExpressionWith(const SourceLocationReflection *const existingNode,
+ const QExplicitlySharedDataPointer<Expression> &newNode)
+{
+ addLocation(newNode.data(), locationFor(existingNode));
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/environment/qstaticcontext_p.h b/src/xmlpatterns/environment/qstaticcontext_p.h
new file mode 100644
index 0000000..bda7a99
--- /dev/null
+++ b/src/xmlpatterns/environment/qstaticcontext_p.h
@@ -0,0 +1,299 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 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 qt-sales@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_StaticContext_H
+#define Patternist_StaticContext_H
+
+#include "qexternalvariableloader_p.h"
+#include "qitemtype_p.h"
+#include "qnamepool_p.h"
+#include "qnamespaceresolver_p.h"
+#include "qreportcontext_p.h"
+#include "qresourceloader_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+class QUrl;
+template<typename Key, typename T> class QHash;
+
+namespace QPatternist
+{
+ class DynamicContext;
+ class Expression;
+ class FunctionFactory;
+ class SchemaTypeFactory;
+
+ /**
+ * @short Carries information and facilities used at compilation time.
+ *
+ * A representation of the Static Context in XPath 2.0. The Static Context
+ * contains information which doesn't change and is the "outer scope" of the
+ * expression. It provides for example a base URI the expression can relate to and
+ * what functions and variables that are available for the expression.
+ *
+ * @see <a href="http://www.w3.org/TR/xpath20/#static_context">XML Path
+ * Language (XPath) 2.0, 2.1.1 Static Context</a>
+ * @author Frans Englich <fenglich@trolltech.com>
+ */
+ class StaticContext : public ReportContext
+ {
+ public:
+ /**
+ * A smart pointer wrapping StaticContext instances.
+ */
+ typedef QExplicitlySharedDataPointer<StaticContext> Ptr;
+
+ /**
+ * @see <a href="http://www.w3.org/TR/xquery/#id-boundary-space-decls">XQuery 1.0:
+ * An XML Query Language, 4.3 Boundary-space Declaration</a>
+ * @see <a href="http://www.w3.org/TR/xquery/#dt-boundary-space-policy">XQuery 1.0:
+ * An XML Query Language, Definition: Boundary-space policy</a>
+ */
+ enum BoundarySpacePolicy
+ {
+ BSPPreserve,
+ BSPStrip
+ };
+
+ /**
+ * @see <a href="http://www.w3.org/TR/xquery/#id-construction-declaration">XQuery 1.0:
+ * An XML Query Language, 4.6 Construction Declaration</a>
+ * @see <a href="http://www.w3.org/TR/xquery/#dt-construction-mode">XQuery 1.0:
+ * An XML Query Language, Definition: Construction mode</a>
+ */
+ enum ConstructionMode
+ {
+ CMPreserve,
+ CMStrip
+ };
+
+ /**
+ * @see <a href="http://www.w3.org/TR/xquery/#id-default-ordering-decl">XQuery 1.0:
+ * An XML Query Language, 4.7 Ordering Mode Declaration</a>
+ * @see <a href="http://www.w3.org/TR/xquery/#dt-ordering-mode">XQuery 1.0:
+ * An XML Query Language, Definition: Ordering mode</a>
+ */
+ enum OrderingMode
+ {
+ Ordered,
+ Unordered
+ };
+
+ /**
+ * @see <a href="http://www.w3.org/TR/xquery/#id-empty-order-decl">XQuery 1.0:
+ * An XML Query Language, 4.8 Empty Order Declaration</a>
+ * @see <a href="http://www.w3.org/TR/xquery/#dt-default-empty-order">XQuery 1.0:
+ * An XML Query Language, Definition: Default order for empty sequences</a>
+ */
+ enum OrderingEmptySequence
+ {
+ Greatest,
+ Least
+ };
+
+ enum InheritMode
+ {
+ Inherit,
+ NoInherit
+ };
+
+ enum PreserveMode
+ {
+ Preserve,
+ NoPreserve
+ };
+
+ inline StaticContext()
+ {
+ }
+
+ virtual ~StaticContext();
+
+ virtual NamespaceResolver::Ptr namespaceBindings() const = 0;
+ virtual void setNamespaceBindings(const NamespaceResolver::Ptr &) = 0;
+ virtual QExplicitlySharedDataPointer<FunctionFactory> functionSignatures() const = 0;
+ virtual QExplicitlySharedDataPointer<SchemaTypeFactory> schemaDefinitions() const = 0;
+
+ /**
+ * The base URI of the context. Typically, this is the base URI
+ * if of the element that contained the expression.
+ *
+ * The base URI is in this implementation is never undefined, but is
+ * always valid.
+ */
+ virtual QUrl baseURI() const = 0;
+
+ virtual void setBaseURI(const QUrl &uri) = 0;
+
+ /**
+ * @returns always the standard function namespace defined in
+ * <a href="http://www.w3.org/TR/xpath-functions/">XQuery 1.0 and
+ * XPath 2.0 Functions and Operators</a>
+ */
+ virtual QString defaultFunctionNamespace() const = 0;
+ virtual void setDefaultFunctionNamespace(const QString &ns) = 0;
+
+ virtual QString defaultElementNamespace() const = 0;
+ virtual void setDefaultElementNamespace(const QString &ns) = 0;
+
+ /**
+ * @returns the URI identifying the default collation. The function
+ * is responsible for ensuring a collation is always returned. If
+ * a collation is not provided by the user or the host language in the
+ * context, the Unicode codepoint URI should be returned.
+ */
+ virtual QUrl defaultCollation() const = 0;
+
+ virtual void setDefaultCollation(const QUrl &uri) = 0;
+
+ /**
+ * Determine whether Backwards Compatible Mode is used.
+ *
+ * @see <a href="http://www.w3.org/TR/xpath20/#id-backwards-compatibility">XML Path
+ * Language (XPath) 2.0, I Backwards Compatibility with XPath 1.0 (Non-Normative)</a>
+ * @see <a href="http://www.w3.org/TR/xpath20/#dt-xpath-compat-mode">XML Path
+ * Language (XPath) 2.0, Definition: XPath 1.0 compatibility mode</a>
+ */
+ virtual bool compatModeEnabled() const = 0;
+
+ virtual void setCompatModeEnabled(const bool newVal) = 0;
+
+ /**
+ * This is the DynamicContext that is used for pre-evaluation at
+ * compilation time, const-folding at the static stage.
+ */
+ virtual QExplicitlySharedDataPointer<DynamicContext> dynamicContext() const = 0;
+
+ virtual BoundarySpacePolicy boundarySpacePolicy() const = 0;
+ virtual void setBoundarySpacePolicy(const BoundarySpacePolicy policy) = 0;
+
+ virtual ConstructionMode constructionMode() const = 0;
+ virtual void setConstructionMode(const ConstructionMode mode) = 0;
+
+ virtual OrderingMode orderingMode() const = 0;
+ virtual void setOrderingMode(const OrderingMode mode) = 0;
+ virtual OrderingEmptySequence orderingEmptySequence() const = 0;
+ virtual void setOrderingEmptySequence(const OrderingEmptySequence ordering) = 0;
+
+ virtual InheritMode inheritMode() const = 0;
+ virtual void setInheritMode(const InheritMode mode) = 0;
+
+ virtual PreserveMode preserveMode() const = 0;
+ virtual void setPreserveMode(const PreserveMode mode) = 0;
+
+ /**
+ * @short The static type of the context item.
+ *
+ * Different StaticContext instances are used for different nodes in the
+ * AST to properly reflect the type of the focus. If the focus is undefined,
+ * this function must return @c null.
+ *
+ * @see <a href="http://www.w3.org/TR/xquery/#dt-context-item-static-type">XQuery
+ * 1.0: An XML Query Language, Definition: Context item static type</a>
+ */
+ virtual ItemType::Ptr contextItemType() const = 0;
+
+ /**
+ * @short The static type of the current item, as returned by @c
+ * fn:current().
+ */
+ virtual ItemType::Ptr currentItemType() const = 0;
+
+ /**
+ * Copies this StaticContext and returns the copy.
+ *
+ * The copy and original must not be independent. Since the StaticContext is modified
+ * during the compilation process, the copy must be independent from the original
+ * to the degree that is required for the subclass in question.
+ */
+ virtual StaticContext::Ptr copy() const = 0;
+
+ virtual ExternalVariableLoader::Ptr externalVariableLoader() const = 0;
+ virtual ResourceLoader::Ptr resourceLoader() const = 0;
+ virtual NamePool::Ptr namePool() const = 0;
+
+ /**
+ * @short Adds @p location for @p reflection.
+ */
+ virtual void addLocation(const SourceLocationReflection *const reflection,
+ const QSourceLocation &location) = 0;
+
+ /**
+ * @short Returns a hash of the contained locations.
+ *
+ * The key is the address for the expression, and the value is its location. Note
+ * that the key cannot be dereferenced, there's no guarantee the
+ * Expression is in scope. The key is merely an identifier.
+ */
+ virtual LocationHash sourceLocations() const = 0;
+
+ virtual VariableSlotID currentRangeSlot() const = 0;
+ virtual VariableSlotID allocateRangeSlot() = 0;
+
+ /**
+ * @short Ensures source locations are handled in such a manner that @p
+ * existingNode wraps @p newNode.
+ *
+ * Ensures that the source locations for @p existingNode, applies to
+ * @p newNode.
+ */
+ void wrapExpressionWith(const SourceLocationReflection *const existingNode,
+ const QExplicitlySharedDataPointer<Expression> &newNode);
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/environment/qstaticcurrentcontext.cpp b/src/xmlpatterns/environment/qstaticcurrentcontext.cpp
new file mode 100644
index 0000000..31bb40e
--- /dev/null
+++ b/src/xmlpatterns/environment/qstaticcurrentcontext.cpp
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 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 qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qstaticcurrentcontext_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+StaticCurrentContext::StaticCurrentContext(const ItemType::Ptr &t,
+ const StaticContext::Ptr &context) : DelegatingStaticContext(context)
+ , m_currentItemType(t)
+{
+ Q_ASSERT(m_currentItemType);
+}
+
+ItemType::Ptr StaticCurrentContext::currentItemType() const
+{
+ return m_currentItemType;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/environment/qstaticcurrentcontext_p.h b/src/xmlpatterns/environment/qstaticcurrentcontext_p.h
new file mode 100644
index 0000000..137463e
--- /dev/null
+++ b/src/xmlpatterns/environment/qstaticcurrentcontext_p.h
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 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 qt-sales@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_StaticCurrentContext_H
+#define Patternist_StaticCurrentContext_H
+
+#include "qdelegatingstaticcontext_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short A StaticContext that carries a specified static type for the
+ * current item, as returned by @c fn:current(), but otherwise delegates to
+ * another StaticContext.
+ *
+ * @since 4.5
+ * @author Frans Englich <fenglich@trolltech.com>
+ */
+ class Q_AUTOTEST_EXPORT StaticCurrentContext : public DelegatingStaticContext
+ {
+ public:
+ StaticCurrentContext(const ItemType::Ptr &currentItemType,
+ const StaticContext::Ptr &context);
+ /**
+ * @returns the type passed in the constructor.
+ */
+ virtual ItemType::Ptr currentItemType() const;
+
+ private:
+ const ItemType::Ptr m_currentItemType;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/environment/qstaticfocuscontext.cpp b/src/xmlpatterns/environment/qstaticfocuscontext.cpp
new file mode 100644
index 0000000..bb0fd62
--- /dev/null
+++ b/src/xmlpatterns/environment/qstaticfocuscontext.cpp
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 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 qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qstaticfocuscontext_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+StaticFocusContext::StaticFocusContext(const ItemType::Ptr &t,
+ const StaticContext::Ptr &context) : DelegatingStaticContext(context)
+ , m_contextItemType(t)
+{
+}
+
+ItemType::Ptr StaticFocusContext::contextItemType() const
+{
+ return m_contextItemType;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/environment/qstaticfocuscontext_p.h b/src/xmlpatterns/environment/qstaticfocuscontext_p.h
new file mode 100644
index 0000000..69bb598
--- /dev/null
+++ b/src/xmlpatterns/environment/qstaticfocuscontext_p.h
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 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 qt-sales@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_StaticFocusContext_H
+#define Patternist_StaticFocusContext_H
+
+#include "qdelegatingstaticcontext_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short A StaticContext that carries a specified static type
+ * for the context item, but otherwise delegates to another StaticContext.
+ *
+ * @author Frans Englich <fenglich@trolltech.com>
+ */
+ class Q_AUTOTEST_EXPORT StaticFocusContext : public DelegatingStaticContext
+ {
+ public:
+ /**
+ * @p contextItemType may be @c null.
+ */
+ StaticFocusContext(const ItemType::Ptr &contextItemType,
+ const StaticContext::Ptr &context);
+ /**
+ * @returns the type passed in the constructor.
+ */
+ virtual ItemType::Ptr contextItemType() const;
+
+ private:
+ const ItemType::Ptr m_contextItemType;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/environment/qstaticnamespacecontext.cpp b/src/xmlpatterns/environment/qstaticnamespacecontext.cpp
new file mode 100644
index 0000000..10344bd
--- /dev/null
+++ b/src/xmlpatterns/environment/qstaticnamespacecontext.cpp
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 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 qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qstaticnamespacecontext_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace QPatternist;
+
+StaticNamespaceContext::StaticNamespaceContext(const NamespaceResolver::Ptr &resolver,
+ const StaticContext::Ptr &context) : DelegatingStaticContext(context)
+ , m_namespaceBindings(resolver)
+{
+ Q_ASSERT(m_namespaceBindings);
+}
+
+NamespaceResolver::Ptr StaticNamespaceContext::namespaceBindings() const
+{
+ return m_namespaceBindings;
+}
+
+QT_END_NAMESPACE
diff --git a/src/xmlpatterns/environment/qstaticnamespacecontext_p.h b/src/xmlpatterns/environment/qstaticnamespacecontext_p.h
new file mode 100644
index 0000000..705c718
--- /dev/null
+++ b/src/xmlpatterns/environment/qstaticnamespacecontext_p.h
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 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 qt-sales@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_StaticNamespaceContext_H
+#define Patternist_StaticNamespaceContext_H
+
+#include "qdelegatingstaticcontext_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+namespace QPatternist
+{
+ /**
+ * @short A StaticContext that carries a specified namespace resolver
+ * for the context item, but otherwise delegates to another StaticContext.
+ *
+ * @author Frans Englich <fenglich@trolltech.com>
+ */
+ class Q_AUTOTEST_EXPORT StaticNamespaceContext : public DelegatingStaticContext
+ {
+ public:
+ StaticNamespaceContext(const NamespaceResolver::Ptr &resolver,
+ const StaticContext::Ptr &context);
+
+ /**
+ * @returns the resolver passed in the constructor.
+ */
+ virtual NamespaceResolver::Ptr namespaceBindings() const;
+
+ private:
+ const NamespaceResolver::Ptr m_namespaceBindings;
+ };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif