0a61be2e1eef9a9fb56c27255e96ea79f987f01d
[profile/ivi/qtxmlpatterns.git] / src / xmlpatterns / environment / qgenericstaticcontext_p.h
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
5 **
6 ** This file is part of the QtXmlPatterns module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** GNU Lesser General Public License Usage
10 ** This file may be used under the terms of the GNU Lesser General Public
11 ** License version 2.1 as published by the Free Software Foundation and
12 ** appearing in the file LICENSE.LGPL included in the packaging of this
13 ** file. Please review the following information to ensure the GNU Lesser
14 ** General Public License version 2.1 requirements will be met:
15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
16 **
17 ** In addition, as a special exception, Nokia gives you certain additional
18 ** rights. These rights are described in the Nokia Qt LGPL Exception
19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
20 **
21 ** GNU General Public License Usage
22 ** Alternatively, this file may be used under the terms of the GNU General
23 ** Public License version 3.0 as published by the Free Software Foundation
24 ** and appearing in the file LICENSE.GPL included in the packaging of this
25 ** file. Please review the following information to ensure the GNU General
26 ** Public License version 3.0 requirements will be met:
27 ** http://www.gnu.org/copyleft/gpl.html.
28 **
29 ** Other Usage
30 ** Alternatively, this file may be used in accordance with the terms and
31 ** conditions contained in a signed written agreement between you and Nokia.
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 <private/qstaticcontext_p.h>
59 #include <private/qfunctionfactory_p.h>
60 #include <private/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