1 /****************************************************************************
3 ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
6 ** This file is part of the QtXmlPatterns module of the Qt Toolkit.
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
40 ****************************************************************************/
46 // This file is not part of the Qt API. It exists purely as an
47 // implementation detail. This header file may change from version to
48 // version without notice, or even be removed.
52 #ifndef Patternist_GenericStaticContext_H
53 #define Patternist_GenericStaticContext_H
58 #include <private/qstaticcontext_p.h>
59 #include <private/qfunctionfactory_p.h>
60 #include <private/qschematypefactory_p.h>
69 * @short Provides setters and getters for the properties defined in StaticContext.
71 * @author Frans Englich <frans.englich@nokia.com>
73 class GenericStaticContext : public StaticContext
76 typedef QExplicitlySharedDataPointer<GenericStaticContext> Ptr;
78 * Constructs a GenericStaticContext. The components are initialized as per
79 * the recommended default values in XQuery 1.0. <tt>Default order for empty sequences</tt>,
80 * orderingEmptySequence(), is initialized to Greatest.
82 * @see <a href="http://www.w3.org/TR/xquery/#id-xq-static-context-components">XQuery
83 * 1.0: An XML Query Language, C.1 Static Context Components</a>
84 * @param errorHandler the error handler. May be null.
85 * @param np the NamePool. May not be null.
86 * @param aBaseURI the base URI in the static context. Must be absolute
89 GenericStaticContext(const NamePool::Ptr &np,
90 QAbstractMessageHandler *const errorHandler,
92 const FunctionFactory::Ptr &factory,
93 const QXmlQuery::QueryLanguage lang);
95 virtual NamespaceResolver::Ptr namespaceBindings() const;
96 virtual void setNamespaceBindings(const NamespaceResolver::Ptr &);
98 virtual FunctionFactory::Ptr functionSignatures() const;
99 virtual SchemaTypeFactory::Ptr schemaDefinitions() const;
102 * Returns a DynamicContext used for evaluation at compile time.
104 * @bug The DynamicContext isn't stable. It should be cached privately.
106 virtual DynamicContext::Ptr dynamicContext() const;
108 virtual QUrl baseURI() const;
109 virtual void setBaseURI(const QUrl &uri);
111 virtual bool compatModeEnabled() const;
112 virtual void setCompatModeEnabled(const bool newVal);
115 * @returns always the Unicode codepoint collation URI
117 virtual QUrl defaultCollation() const;
119 virtual QAbstractMessageHandler * messageHandler() const;
121 virtual void setDefaultCollation(const QUrl &uri);
123 virtual BoundarySpacePolicy boundarySpacePolicy() const;
124 virtual void setBoundarySpacePolicy(const BoundarySpacePolicy policy);
126 virtual ConstructionMode constructionMode() const;
127 virtual void setConstructionMode(const ConstructionMode mode);
129 virtual OrderingMode orderingMode() const;
130 virtual void setOrderingMode(const OrderingMode mode);
131 virtual OrderingEmptySequence orderingEmptySequence() const;
132 virtual void setOrderingEmptySequence(const OrderingEmptySequence ordering);
134 virtual QString defaultFunctionNamespace() const;
135 virtual void setDefaultFunctionNamespace(const QString &ns);
137 virtual QString defaultElementNamespace() const;
138 virtual void setDefaultElementNamespace(const QString &ns);
140 virtual InheritMode inheritMode() const;
141 virtual void setInheritMode(const InheritMode mode);
143 virtual PreserveMode preserveMode() const;
144 virtual void setPreserveMode(const PreserveMode mode);
146 virtual ItemType::Ptr contextItemType() const;
147 void setContextItemType(const ItemType::Ptr &type);
148 virtual ItemType::Ptr currentItemType() const;
150 virtual StaticContext::Ptr copy() const;
152 virtual ResourceLoader::Ptr resourceLoader() const;
153 void setResourceLoader(const ResourceLoader::Ptr &loader);
155 virtual ExternalVariableLoader::Ptr externalVariableLoader() const;
156 void setExternalVariableLoader(const ExternalVariableLoader::Ptr &loader);
157 virtual NamePool::Ptr namePool() const;
159 virtual void addLocation(const SourceLocationReflection *const reflection,
160 const QSourceLocation &location);
161 virtual QSourceLocation locationFor(const SourceLocationReflection *const reflection) const;
163 virtual LocationHash sourceLocations() const;
164 virtual QAbstractUriResolver *uriResolver() const;
166 virtual VariableSlotID currentRangeSlot() const;
167 virtual VariableSlotID allocateRangeSlot();
170 BoundarySpacePolicy m_boundarySpacePolicy;
171 ConstructionMode m_constructionMode;
172 FunctionFactory::Ptr m_functionFactory;
173 QString m_defaultElementNamespace;
174 QString m_defaultFunctionNamespace;
175 OrderingEmptySequence m_orderingEmptySequence;
176 OrderingMode m_orderingMode;
177 QUrl m_defaultCollation;
179 QAbstractMessageHandler * m_messageHandler;
180 PreserveMode m_preserveMode;
181 InheritMode m_inheritMode;
182 NamespaceResolver::Ptr m_namespaceResolver;
183 ExternalVariableLoader::Ptr m_externalVariableLoader;
184 ResourceLoader::Ptr m_resourceLoader;
185 const NamePool::Ptr m_namePool;
186 ItemType::Ptr m_contextItemType;
187 LocationHash m_locations;
188 QAbstractUriResolver * m_uriResolver;
189 QXmlQuery::QueryLanguage m_queryLanguage;
190 VariableSlotID m_rangeSlot;
191 bool m_compatModeEnabled;