SourceForge.net Logo
StaticContext.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2001, 2008,
3  * DecisionSoft Limited. All rights reserved.
4  * Copyright (c) 2004, 2018 Oracle and/or its affiliates. All rights reserved.
5  *
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 
20 #ifndef _STATICCONTEXT_HPP
21 #define _STATICCONTEXT_HPP
22 
23 #include <xqilla/framework/XQillaExport.hpp>
25 #include <time.h>
28 #include <xercesc/util/XMemory.hpp>
29 
30 class DynamicContext;
32 class FuncFactory;
33 class DatatypeFactory;
34 class Collation;
35 class VariableTypeStore;
36 class ItemFactory;
37 class StaticType;
38 class ModuleResolver;
40 class MessageListener;
41 class ExternalFunction;
43 class XQUserFunction;
44 class XQillaNSResolver;
45 
46 // Copied from ASTNode.hpp
47 typedef std::vector<ASTNode*,XQillaAllocator<ASTNode*> > VectorOfASTNodes;
48 typedef std::vector<XQUserFunction*, XQillaAllocator<XQUserFunction*> > UserFunctions;
49 
50 XERCES_CPP_NAMESPACE_BEGIN
51 class DOMDocument;
52 class DOMXPathNSResolver;
53 class XMLEntityResolver;
54 XERCES_CPP_NAMESPACE_END
55 
57 class XQILLA_API StaticContext : public XERCES_CPP_NAMESPACE_QUALIFIER XMemory
58 {
59 public:
60  typedef enum {
62  ORDERING_UNORDERED
63  } NodeSetOrdering;
64 
65  typedef enum {
67  CONSTRUCTION_MODE_STRIP
68  } ConstructionMode;
69 
70  typedef enum {
72  FLWOR_ORDER_EMPTY_LEAST
73  } FLWOROrderingMode;
74 
75  typedef enum {
80  LOWERCASE
81  } FTCaseOption;
82 
83  virtual ~StaticContext() {};
84 
85  virtual DynamicContext *createModuleContext(XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager *memMgr =
86  XERCES_CPP_NAMESPACE_QUALIFIER XMLPlatformUtils::fgMemoryManager) const = 0;
87  virtual DynamicContext *createDynamicContext(XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager *memMgr =
88  XERCES_CPP_NAMESPACE_QUALIFIER XMLPlatformUtils::fgMemoryManager) const = 0;
89 
90  virtual DynamicContext *createDebugQueryContext(const Item::Ptr &contextItem,
91  size_t contextPosition,
92  size_t contextSize,
93  const VariableStore *variables,
94  const XERCES_CPP_NAMESPACE_QUALIFIER DOMXPathNSResolver *nsResolver,
95  const XMLCh *defaultElementNS,
96  XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager *memMgr =
97  XERCES_CPP_NAMESPACE_QUALIFIER XMLPlatformUtils::fgMemoryManager) const = 0;
98 
100  virtual XQillaConfiguration *getConfiguration() const = 0;
101 
104  virtual XQilla::Language getLanguage() const = 0;
105 
107  virtual ItemFactory *getItemFactory() const = 0;
109  virtual void setItemFactory(ItemFactory *factory) = 0;
110 
112  virtual const StaticType &getContextItemType() const = 0;
114  virtual void setContextItemType(const StaticType &st) = 0;
115 
117  virtual bool getXPath1CompatibilityMode() const = 0;
119  virtual void setXPath1CompatibilityMode(bool newMode) = 0;
120 
122  virtual const XERCES_CPP_NAMESPACE_QUALIFIER DOMXPathNSResolver* getNSResolver() const = 0;
125  virtual const XMLCh* getUriBoundToPrefix(const XMLCh* prefix, const LocationInfo *location = 0) const = 0;
128  virtual const XMLCh* getPrefixBoundToUri(const XMLCh* uri) const = 0;
130  virtual void setNSResolver(const XERCES_CPP_NAMESPACE_QUALIFIER DOMXPathNSResolver* resolver) = 0;
132  virtual void setNamespaceBinding(const XMLCh* prefix, const XMLCh* uri) = 0;
133 
135  virtual const XMLCh* getDefaultElementAndTypeNS() const = 0;
137  virtual void setDefaultElementAndTypeNS(const XMLCh* newNS) = 0;
138 
140  virtual const XMLCh* getDefaultFuncNS() const = 0;
142  virtual void setDefaultFuncNS(const XMLCh* newNS) = 0;
143 
145  virtual DocumentCache* getDocumentCache() const = 0;
147  virtual void setDocumentCache(DocumentCache* docCache) = 0;
148 
157  virtual bool isTypeOrDerivedFromType(const XMLCh* const uri, const XMLCh* const typeName, const XMLCh* const uriToCheck, const XMLCh* const typeNameToCheck) const = 0;
163  virtual void setXMLEntityResolver(XERCES_CPP_NAMESPACE_QUALIFIER XMLEntityResolver* const handler) = 0;
165  virtual XERCES_CPP_NAMESPACE_QUALIFIER XMLEntityResolver* getXMLEntityResolver() const = 0;
166 
168  virtual void setModuleResolver(ModuleResolver *resolver) = 0;
170  virtual ModuleResolver *getModuleResolver() const = 0;
171  /* Retrieve a list of locations for the given module URI */
172  virtual VectorOfStrings* resolveModuleURI(const XMLCh* uri) const = 0;
173 
175  virtual void addSchemaLocation(const XMLCh* uri, VectorOfStrings* locations, const LocationInfo *location = 0) = 0;
176 
178  virtual VariableTypeStore* getVariableTypeStore() = 0;
179 
181  virtual void addTemplate(XQUserFunction *tp) = 0;
183  virtual const XQUserFunction *lookUpNamedTemplate(const XMLCh *uri, const XMLCh *name) const = 0;
185  virtual const UserFunctions &getTemplateRules() const = 0;
186 
188  virtual void addCustomFunction(FuncFactory *func) = 0;
190  virtual void removeCustomFunction(FuncFactory *func) = 0;
192  virtual ASTNode *lookUpFunction(const XMLCh *uri, const XMLCh *name, const VectorOfASTNodes &v, const LocationInfo *location = 0) const = 0;
193 
195  virtual void setExternalFunctionResolver(ExternalFunctionResolver *resolver) = 0;
197  virtual ExternalFunctionResolver *getExternalFunctionResolver() const = 0;
199  virtual void addExternalFunction(const ExternalFunction *func) = 0;
201  virtual const ExternalFunction *lookUpExternalFunction(const XMLCh *uri, const XMLCh *name, size_t numArgs) const = 0;
202 
204  virtual Collation* getCollation(const XMLCh* const URI, const LocationInfo *location = 0) const = 0;
206  virtual void addCollation(Collation* collation) = 0;
207 
209  virtual Collation* getDefaultCollation(const LocationInfo *location = 0) const = 0;
211  virtual void setDefaultCollation(const XMLCh* const URI) = 0;
212 
214  virtual const XMLCh* getBaseURI() const = 0;
216  virtual void setBaseURI(const XMLCh* newURI) = 0;
217 
219  virtual NodeSetOrdering getNodeSetOrdering() const = 0;
221  virtual void setNodeSetOrdering(NodeSetOrdering newOrder) = 0;
222 
224  virtual ConstructionMode getConstructionMode() const = 0;
226  virtual void setConstructionMode(ConstructionMode newMode) = 0;
227 
229  virtual void setPreserveBoundarySpace(bool value) = 0;
231  virtual bool getPreserveBoundarySpace() const = 0;
232 
234  virtual FLWOROrderingMode getDefaultFLWOROrderingMode() const = 0;
236  virtual void setDefaultFLWOROrderingMode(FLWOROrderingMode newMode) = 0;
237 
239  virtual void setInheritNamespaces(bool value) = 0;
241  virtual bool getInheritNamespaces() const = 0;
242 
244  virtual void setPreserveNamespaces(bool value) = 0;
246  virtual bool getPreserveNamespaces() const = 0;
247 
249  virtual void setRevalidationMode(DocumentCache::ValidationMode mode) = 0;
251  virtual DocumentCache::ValidationMode getRevalidationMode() const = 0;
252 
254  virtual void setMessageListener(MessageListener *listener) = 0;
256  virtual MessageListener *getMessageListener() const = 0;
257 
259  virtual void setModule(XQQuery *module) = 0;
261  virtual XQQuery *getModule() const = 0;
262 
264  // XQilla context specific accessors //
266 
280  virtual bool getProjection() const = 0;
297  virtual void setProjection(bool enabled) = 0;
298 
299  virtual bool getDoLintWarnings() const = 0;
300  virtual void setDoLintWarnings(bool enabled) = 0;
301 
303  virtual const XMLCh *allocateTempVarName(const XMLCh *prefix = 0) = 0;
304 
306  virtual XPath2MemoryManager* getMemoryManager() const = 0;
308  virtual void setMemoryManager(XPath2MemoryManager* memMgr) = 0;
309 
311  virtual void setFTCase(FTCaseOption option) = 0;
312  virtual FTCaseOption getFTCase() = 0;
313 };
314 
315 #endif
Definition: XPath2MemoryManager.hpp:45
This is the wrapper class for the variable store, which implements the lookup and scoping of simple v...
Definition: VariableTypeStore.hpp:34
Expression Context is a storage for contexts.
Definition: DocumentCache.hpp:52
Definition: StaticContext.hpp:66
Definition: ExternalFunction.hpp:32
The parse time static context interface.
Definition: StaticContext.hpp:57
std::vector< const XMLCh *, XQillaAllocator< const XMLCh * > > VectorOfStrings
Definition: DocumentCache.hpp:35
std::vector< ASTNode *, XQillaAllocator< ASTNode * > > VectorOfASTNodes
Definition: StaticContext.hpp:44
ValidationMode
Definition: DocumentCache.hpp:58
Definition: ExternalFunctionResolver.hpp:28
Definition: StaticContext.hpp:77
Definition: Collation.hpp:29
std::vector< XQUserFunction *, XQillaAllocator< XQUserFunction * > > UserFunctions
Definition: StaticContext.hpp:48
Definition: StaticContext.hpp:78
Definition: StaticContext.hpp:76
virtual ~StaticContext()
Definition: StaticContext.hpp:83
Encapsulates a query expression.
Definition: XQQuery.hpp:75
Definition: ModuleResolver.hpp:27
A class used to listen for warnings or trace information.
Definition: MessageListener.hpp:33
The execution time dynamic context interface.
Definition: DynamicContext.hpp:38
Definition: StaticContext.hpp:61
The pure virtual base class for accessing variables at runtime.
Definition: VariableStore.hpp:31
A class that gives records a location in the query.
Definition: LocationInfo.hpp:29
Definition: XQillaConfiguration.hpp:38
Definition: StaticContext.hpp:79
Definition: ItemFactory.hpp:50
Class that represents the static type of an expression.
Definition: StaticType.hpp:33
Definition: StaticContext.hpp:71
Language
Enumeration used to select a language to parse.
Definition: XQilla.hpp:65