|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the QtXmlPatterns module of the Qt Toolkit. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 // |
|
43 // W A R N I N G |
|
44 // ------------- |
|
45 // |
|
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. |
|
49 // |
|
50 // We mean it. |
|
51 |
|
52 #ifndef Patternist_GenericStaticContext_H |
|
53 #define Patternist_GenericStaticContext_H |
|
54 |
|
55 #include <QUrl> |
|
56 #include <QXmlQuery> |
|
57 |
|
58 #include "qstaticcontext_p.h" |
|
59 #include "qfunctionfactory_p.h" |
|
60 #include "qschematypefactory_p.h" |
|
61 |
|
62 QT_BEGIN_HEADER |
|
63 |
|
64 QT_BEGIN_NAMESPACE |
|
65 |
|
66 namespace QPatternist |
|
67 { |
|
68 /** |
|
69 * @short Provides setters and getters for the properties defined in StaticContext. |
|
70 * |
|
71 * @author Frans Englich <frans.englich@nokia.com> |
|
72 */ |
|
73 class GenericStaticContext : public StaticContext |
|
74 { |
|
75 public: |
|
76 typedef QExplicitlySharedDataPointer<GenericStaticContext> Ptr; |
|
77 /** |
|
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. |
|
81 * |
|
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 |
|
87 * and valid. |
|
88 */ |
|
89 GenericStaticContext(const NamePool::Ptr &np, |
|
90 QAbstractMessageHandler *const errorHandler, |
|
91 const QUrl &aBaseURI, |
|
92 const FunctionFactory::Ptr &factory, |
|
93 const QXmlQuery::QueryLanguage lang); |
|
94 |
|
95 virtual NamespaceResolver::Ptr namespaceBindings() const; |
|
96 virtual void setNamespaceBindings(const NamespaceResolver::Ptr &); |
|
97 |
|
98 virtual FunctionFactory::Ptr functionSignatures() const; |
|
99 virtual SchemaTypeFactory::Ptr schemaDefinitions() const; |
|
100 |
|
101 /** |
|
102 * Returns a DynamicContext used for evaluation at compile time. |
|
103 * |
|
104 * @bug The DynamicContext isn't stable. It should be cached privately. |
|
105 */ |
|
106 virtual DynamicContext::Ptr dynamicContext() const; |
|
107 |
|
108 virtual QUrl baseURI() const; |
|
109 virtual void setBaseURI(const QUrl &uri); |
|
110 |
|
111 virtual bool compatModeEnabled() const; |
|
112 virtual void setCompatModeEnabled(const bool newVal); |
|
113 |
|
114 /** |
|
115 * @returns always the Unicode codepoint collation URI |
|
116 */ |
|
117 virtual QUrl defaultCollation() const; |
|
118 |
|
119 virtual QAbstractMessageHandler * messageHandler() const; |
|
120 |
|
121 virtual void setDefaultCollation(const QUrl &uri); |
|
122 |
|
123 virtual BoundarySpacePolicy boundarySpacePolicy() const; |
|
124 virtual void setBoundarySpacePolicy(const BoundarySpacePolicy policy); |
|
125 |
|
126 virtual ConstructionMode constructionMode() const; |
|
127 virtual void setConstructionMode(const ConstructionMode mode); |
|
128 |
|
129 virtual OrderingMode orderingMode() const; |
|
130 virtual void setOrderingMode(const OrderingMode mode); |
|
131 virtual OrderingEmptySequence orderingEmptySequence() const; |
|
132 virtual void setOrderingEmptySequence(const OrderingEmptySequence ordering); |
|
133 |
|
134 virtual QString defaultFunctionNamespace() const; |
|
135 virtual void setDefaultFunctionNamespace(const QString &ns); |
|
136 |
|
137 virtual QString defaultElementNamespace() const; |
|
138 virtual void setDefaultElementNamespace(const QString &ns); |
|
139 |
|
140 virtual InheritMode inheritMode() const; |
|
141 virtual void setInheritMode(const InheritMode mode); |
|
142 |
|
143 virtual PreserveMode preserveMode() const; |
|
144 virtual void setPreserveMode(const PreserveMode mode); |
|
145 |
|
146 virtual ItemType::Ptr contextItemType() const; |
|
147 void setContextItemType(const ItemType::Ptr &type); |
|
148 virtual ItemType::Ptr currentItemType() const; |
|
149 |
|
150 virtual StaticContext::Ptr copy() const; |
|
151 |
|
152 virtual ResourceLoader::Ptr resourceLoader() const; |
|
153 void setResourceLoader(const ResourceLoader::Ptr &loader); |
|
154 |
|
155 virtual ExternalVariableLoader::Ptr externalVariableLoader() const; |
|
156 void setExternalVariableLoader(const ExternalVariableLoader::Ptr &loader); |
|
157 virtual NamePool::Ptr namePool() const; |
|
158 |
|
159 virtual void addLocation(const SourceLocationReflection *const reflection, |
|
160 const QSourceLocation &location); |
|
161 virtual QSourceLocation locationFor(const SourceLocationReflection *const reflection) const; |
|
162 |
|
163 virtual LocationHash sourceLocations() const; |
|
164 virtual QAbstractUriResolver *uriResolver() const; |
|
165 |
|
166 virtual VariableSlotID currentRangeSlot() const; |
|
167 virtual VariableSlotID allocateRangeSlot(); |
|
168 |
|
169 private: |
|
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; |
|
178 QUrl m_baseURI; |
|
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; |
|
192 }; |
|
193 } |
|
194 |
|
195 QT_END_NAMESPACE |
|
196 |
|
197 QT_END_HEADER |
|
198 |
|
199 #endif |