| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. |
| 4 | ** Contact: https://www.qt.io/licensing/ |
| 5 | ** |
| 6 | ** This file is part of the QtXmlPatterns module of the Qt Toolkit. |
| 7 | ** |
| 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 The Qt Company. For licensing terms |
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
| 15 | ** information use the contact form at https://www.qt.io/contact-us. |
| 16 | ** |
| 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 3 as published by the Free Software |
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
| 21 | ** packaging of this file. Please review the following information to |
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements |
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
| 24 | ** |
| 25 | ** GNU General Public License Usage |
| 26 | ** Alternatively, this file may be used under the terms of the GNU |
| 27 | ** General Public License version 2.0 or (at your option) the GNU General |
| 28 | ** Public license version 3 or any later version approved by the KDE Free |
| 29 | ** Qt Foundation. The licenses are as published by the Free Software |
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
| 31 | ** included in the packaging of this file. Please review the following |
| 32 | ** information to ensure the GNU General Public License requirements will |
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
| 35 | ** |
| 36 | ** $QT_END_LICENSE$ |
| 37 | ** |
| 38 | ****************************************************************************/ |
| 39 | |
| 40 | // |
| 41 | // W A R N I N G |
| 42 | // ------------- |
| 43 | // |
| 44 | // This file is not part of the Qt API. It exists purely as an |
| 45 | // implementation detail. This header file may change from version to |
| 46 | // version without notice, or even be removed. |
| 47 | // |
| 48 | // We mean it. |
| 49 | |
| 50 | #ifndef Patternist_GenericStaticContext_H |
| 51 | #define Patternist_GenericStaticContext_H |
| 52 | |
| 53 | #include <QUrl> |
| 54 | #include <QXmlQuery> |
| 55 | |
| 56 | #include <private/qstaticcontext_p.h> |
| 57 | #include <private/qfunctionfactory_p.h> |
| 58 | #include <private/qschematypefactory_p.h> |
| 59 | |
| 60 | QT_BEGIN_NAMESPACE |
| 61 | |
| 62 | namespace QPatternist |
| 63 | { |
| 64 | /** |
| 65 | * @short Provides setters and getters for the properties defined in StaticContext. |
| 66 | * |
| 67 | * @author Frans Englich <frans.englich@nokia.com> |
| 68 | */ |
| 69 | class GenericStaticContext : public StaticContext |
| 70 | { |
| 71 | public: |
| 72 | typedef QExplicitlySharedDataPointer<GenericStaticContext> Ptr; |
| 73 | /** |
| 74 | * Constructs a GenericStaticContext. The components are initialized as per |
| 75 | * the recommended default values in XQuery 1.0. <tt>Default order for empty sequences</tt>, |
| 76 | * orderingEmptySequence(), is initialized to Greatest. |
| 77 | * |
| 78 | * @see <a href="http://www.w3.org/TR/xquery/#id-xq-static-context-components">XQuery |
| 79 | * 1.0: An XML Query Language, C.1 Static Context Components</a> |
| 80 | * @param errorHandler the error handler. May be null. |
| 81 | * @param np the NamePool. May not be null. |
| 82 | * @param aBaseURI the base URI in the static context. Must be absolute |
| 83 | * and valid. |
| 84 | */ |
| 85 | GenericStaticContext(const NamePool::Ptr &np, |
| 86 | QAbstractMessageHandler *const errorHandler, |
| 87 | const QUrl &aBaseURI, |
| 88 | const FunctionFactory::Ptr &factory, |
| 89 | const QXmlQuery::QueryLanguage lang); |
| 90 | |
| 91 | virtual NamespaceResolver::Ptr namespaceBindings() const; |
| 92 | virtual void setNamespaceBindings(const NamespaceResolver::Ptr &); |
| 93 | |
| 94 | virtual FunctionFactory::Ptr functionSignatures() const; |
| 95 | virtual SchemaTypeFactory::Ptr schemaDefinitions() const; |
| 96 | |
| 97 | /** |
| 98 | * Returns a DynamicContext used for evaluation at compile time. |
| 99 | * |
| 100 | * @bug The DynamicContext isn't stable. It should be cached privately. |
| 101 | */ |
| 102 | virtual DynamicContext::Ptr dynamicContext() const; |
| 103 | |
| 104 | virtual QUrl baseURI() const; |
| 105 | virtual void setBaseURI(const QUrl &uri); |
| 106 | |
| 107 | virtual bool compatModeEnabled() const; |
| 108 | virtual void setCompatModeEnabled(const bool newVal); |
| 109 | |
| 110 | /** |
| 111 | * @returns always the Unicode codepoint collation URI |
| 112 | */ |
| 113 | virtual QUrl defaultCollation() const; |
| 114 | |
| 115 | virtual QAbstractMessageHandler * messageHandler() const; |
| 116 | |
| 117 | virtual void setDefaultCollation(const QUrl &uri); |
| 118 | |
| 119 | virtual BoundarySpacePolicy boundarySpacePolicy() const; |
| 120 | virtual void setBoundarySpacePolicy(const BoundarySpacePolicy policy); |
| 121 | |
| 122 | virtual ConstructionMode constructionMode() const; |
| 123 | virtual void setConstructionMode(const ConstructionMode mode); |
| 124 | |
| 125 | virtual OrderingMode orderingMode() const; |
| 126 | virtual void setOrderingMode(const OrderingMode mode); |
| 127 | virtual OrderingEmptySequence orderingEmptySequence() const; |
| 128 | virtual void setOrderingEmptySequence(const OrderingEmptySequence ordering); |
| 129 | |
| 130 | virtual QString defaultFunctionNamespace() const; |
| 131 | virtual void setDefaultFunctionNamespace(const QString &ns); |
| 132 | |
| 133 | virtual QString defaultElementNamespace() const; |
| 134 | virtual void setDefaultElementNamespace(const QString &ns); |
| 135 | |
| 136 | virtual InheritMode inheritMode() const; |
| 137 | virtual void setInheritMode(const InheritMode mode); |
| 138 | |
| 139 | virtual PreserveMode preserveMode() const; |
| 140 | virtual void setPreserveMode(const PreserveMode mode); |
| 141 | |
| 142 | virtual ItemType::Ptr contextItemType() const; |
| 143 | void setContextItemType(const ItemType::Ptr &type); |
| 144 | virtual ItemType::Ptr currentItemType() const; |
| 145 | |
| 146 | virtual StaticContext::Ptr copy() const; |
| 147 | |
| 148 | virtual ResourceLoader::Ptr resourceLoader() const; |
| 149 | void setResourceLoader(const ResourceLoader::Ptr &loader); |
| 150 | |
| 151 | virtual ExternalVariableLoader::Ptr externalVariableLoader() const; |
| 152 | void setExternalVariableLoader(const ExternalVariableLoader::Ptr &loader); |
| 153 | virtual NamePool::Ptr namePool() const; |
| 154 | |
| 155 | virtual void addLocation(const SourceLocationReflection *const reflection, |
| 156 | const QSourceLocation &location); |
| 157 | virtual QSourceLocation locationFor(const SourceLocationReflection *const reflection) const; |
| 158 | |
| 159 | virtual LocationHash sourceLocations() const; |
| 160 | virtual QAbstractUriResolver *uriResolver() const; |
| 161 | |
| 162 | virtual VariableSlotID currentRangeSlot() const; |
| 163 | virtual VariableSlotID allocateRangeSlot(); |
| 164 | |
| 165 | private: |
| 166 | BoundarySpacePolicy m_boundarySpacePolicy; |
| 167 | ConstructionMode m_constructionMode; |
| 168 | FunctionFactory::Ptr m_functionFactory; |
| 169 | QString m_defaultElementNamespace; |
| 170 | QString m_defaultFunctionNamespace; |
| 171 | OrderingEmptySequence m_orderingEmptySequence; |
| 172 | OrderingMode m_orderingMode; |
| 173 | QUrl m_defaultCollation; |
| 174 | QUrl m_baseURI; |
| 175 | QAbstractMessageHandler * m_messageHandler; |
| 176 | PreserveMode m_preserveMode; |
| 177 | InheritMode m_inheritMode; |
| 178 | NamespaceResolver::Ptr m_namespaceResolver; |
| 179 | ExternalVariableLoader::Ptr m_externalVariableLoader; |
| 180 | ResourceLoader::Ptr m_resourceLoader; |
| 181 | const NamePool::Ptr m_namePool; |
| 182 | ItemType::Ptr m_contextItemType; |
| 183 | LocationHash m_locations; |
| 184 | QAbstractUriResolver * m_uriResolver; |
| 185 | QXmlQuery::QueryLanguage m_queryLanguage; |
| 186 | VariableSlotID m_rangeSlot; |
| 187 | bool m_compatModeEnabled; |
| 188 | }; |
| 189 | } |
| 190 | |
| 191 | QT_END_NAMESPACE |
| 192 | |
| 193 | #endif |
| 194 | |