00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _STATICCONTEXT_HPP
00021 #define _STATICCONTEXT_HPP
00022
00023 #include <xqilla/framework/XQillaExport.hpp>
00024 #include <xqilla/simple-api/XQilla.hpp>
00025 #include <time.h>
00026 #include <xqilla/schema/DocumentCache.hpp>
00027 #include <xercesc/util/PlatformUtils.hpp>
00028 #include <xercesc/util/XMemory.hpp>
00029
00030 class DynamicContext;
00031 class XPath2MemoryManager;
00032 class FuncFactory;
00033 class DatatypeFactory;
00034 class Collation;
00035 class VariableTypeStore;
00036 class ItemFactory;
00037 class StaticType;
00038 class ModuleResolver;
00039 class ExternalFunctionResolver;
00040 class MessageListener;
00041 class ExternalFunction;
00042 class XQillaConfiguration;
00043 class XQUserFunction;
00044 class XQillaNSResolver;
00045
00046
00047 typedef std::vector<ASTNode*,XQillaAllocator<ASTNode*> > VectorOfASTNodes;
00048 typedef std::vector<XQUserFunction*, XQillaAllocator<XQUserFunction*> > UserFunctions;
00049
00050 XERCES_CPP_NAMESPACE_BEGIN
00051 class DOMDocument;
00052 class DOMXPathNSResolver;
00053 class XMLEntityResolver;
00054 XERCES_CPP_NAMESPACE_END
00055
00057 class XQILLA_API StaticContext : public XERCES_CPP_NAMESPACE_QUALIFIER XMemory
00058 {
00059 public:
00060 typedef enum {
00061 ORDERING_ORDERED,
00062 ORDERING_UNORDERED
00063 } NodeSetOrdering;
00064
00065 typedef enum {
00066 CONSTRUCTION_MODE_PRESERVE,
00067 CONSTRUCTION_MODE_STRIP
00068 } ConstructionMode;
00069
00070 typedef enum {
00071 FLWOR_ORDER_EMPTY_GREATEST,
00072 FLWOR_ORDER_EMPTY_LEAST
00073 } FLWOROrderingMode;
00074
00075 typedef enum {
00076 NONE,
00077 CASE_INSENSITIVE,
00078 CASE_SENSITIVE,
00079 UPPERCASE,
00080 LOWERCASE
00081 } FTCaseOption;
00082
00083 virtual ~StaticContext() {};
00084
00085 virtual DynamicContext *createModuleContext(XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager *memMgr =
00086 XERCES_CPP_NAMESPACE_QUALIFIER XMLPlatformUtils::fgMemoryManager) const = 0;
00087 virtual DynamicContext *createDynamicContext(XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager *memMgr =
00088 XERCES_CPP_NAMESPACE_QUALIFIER XMLPlatformUtils::fgMemoryManager) const = 0;
00089
00090 virtual DynamicContext *createDebugQueryContext(const Item::Ptr &contextItem,
00091 size_t contextPosition,
00092 size_t contextSize,
00093 const VariableStore *variables,
00094 const XERCES_CPP_NAMESPACE_QUALIFIER DOMXPathNSResolver *nsResolver,
00095 const XMLCh *defaultElementNS,
00096 XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager *memMgr =
00097 XERCES_CPP_NAMESPACE_QUALIFIER XMLPlatformUtils::fgMemoryManager) const = 0;
00098
00100 virtual XQillaConfiguration *getConfiguration() const = 0;
00101
00104 virtual XQilla::Language getLanguage() const = 0;
00105
00107 virtual ItemFactory *getItemFactory() const = 0;
00109 virtual void setItemFactory(ItemFactory *factory) = 0;
00110
00112 virtual const StaticType &getContextItemType() const = 0;
00114 virtual void setContextItemType(const StaticType &st) = 0;
00115
00117 virtual bool getXPath1CompatibilityMode() const = 0;
00119 virtual void setXPath1CompatibilityMode(bool newMode) = 0;
00120
00122 virtual const XERCES_CPP_NAMESPACE_QUALIFIER DOMXPathNSResolver* getNSResolver() const = 0;
00125 virtual const XMLCh* getUriBoundToPrefix(const XMLCh* prefix, const LocationInfo *location = 0) const = 0;
00128 virtual const XMLCh* getPrefixBoundToUri(const XMLCh* uri) const = 0;
00130 virtual void setNSResolver(const XERCES_CPP_NAMESPACE_QUALIFIER DOMXPathNSResolver* resolver) = 0;
00132 virtual void setNamespaceBinding(const XMLCh* prefix, const XMLCh* uri) = 0;
00133
00135 virtual const XMLCh* getDefaultElementAndTypeNS() const = 0;
00137 virtual void setDefaultElementAndTypeNS(const XMLCh* newNS) = 0;
00138
00140 virtual const XMLCh* getDefaultFuncNS() const = 0;
00142 virtual void setDefaultFuncNS(const XMLCh* newNS) = 0;
00143
00145 virtual DocumentCache* getDocumentCache() const = 0;
00147 virtual void setDocumentCache(DocumentCache* docCache) = 0;
00148
00157 virtual bool isTypeOrDerivedFromType(const XMLCh* const uri, const XMLCh* const typeName, const XMLCh* const uriToCheck, const XMLCh* const typeNameToCheck) const = 0;
00163 virtual void setXMLEntityResolver(XERCES_CPP_NAMESPACE_QUALIFIER XMLEntityResolver* const handler) = 0;
00165 virtual XERCES_CPP_NAMESPACE_QUALIFIER XMLEntityResolver* getXMLEntityResolver() const = 0;
00166
00168 virtual void setModuleResolver(ModuleResolver *resolver) = 0;
00170 virtual ModuleResolver *getModuleResolver() const = 0;
00171
00172 virtual VectorOfStrings* resolveModuleURI(const XMLCh* uri) const = 0;
00173
00175 virtual void addSchemaLocation(const XMLCh* uri, VectorOfStrings* locations, const LocationInfo *location = 0) = 0;
00176
00178 virtual VariableTypeStore* getVariableTypeStore() = 0;
00179
00181 virtual void addTemplate(XQUserFunction *tp) = 0;
00183 virtual const XQUserFunction *lookUpNamedTemplate(const XMLCh *uri, const XMLCh *name) const = 0;
00185 virtual const UserFunctions &getTemplateRules() const = 0;
00186
00188 virtual void addCustomFunction(FuncFactory *func) = 0;
00190 virtual void removeCustomFunction(FuncFactory *func) = 0;
00192 virtual ASTNode *lookUpFunction(const XMLCh *uri, const XMLCh *name, const VectorOfASTNodes &v, const LocationInfo *location = 0) const = 0;
00193
00195 virtual void setExternalFunctionResolver(ExternalFunctionResolver *resolver) = 0;
00197 virtual ExternalFunctionResolver *getExternalFunctionResolver() const = 0;
00199 virtual void addExternalFunction(const ExternalFunction *func) = 0;
00201 virtual const ExternalFunction *lookUpExternalFunction(const XMLCh *uri, const XMLCh *name, size_t numArgs) const = 0;
00202
00204 virtual Collation* getCollation(const XMLCh* const URI, const LocationInfo *location = 0) const = 0;
00206 virtual void addCollation(Collation* collation) = 0;
00207
00209 virtual Collation* getDefaultCollation(const LocationInfo *location = 0) const = 0;
00211 virtual void setDefaultCollation(const XMLCh* const URI) = 0;
00212
00214 virtual const XMLCh* getBaseURI() const = 0;
00216 virtual void setBaseURI(const XMLCh* newURI) = 0;
00217
00219 virtual NodeSetOrdering getNodeSetOrdering() const = 0;
00221 virtual void setNodeSetOrdering(NodeSetOrdering newOrder) = 0;
00222
00224 virtual ConstructionMode getConstructionMode() const = 0;
00226 virtual void setConstructionMode(ConstructionMode newMode) = 0;
00227
00229 virtual void setPreserveBoundarySpace(bool value) = 0;
00231 virtual bool getPreserveBoundarySpace() const = 0;
00232
00234 virtual FLWOROrderingMode getDefaultFLWOROrderingMode() const = 0;
00236 virtual void setDefaultFLWOROrderingMode(FLWOROrderingMode newMode) = 0;
00237
00239 virtual void setInheritNamespaces(bool value) = 0;
00241 virtual bool getInheritNamespaces() const = 0;
00242
00244 virtual void setPreserveNamespaces(bool value) = 0;
00246 virtual bool getPreserveNamespaces() const = 0;
00247
00249 virtual void setRevalidationMode(DocumentCache::ValidationMode mode) = 0;
00251 virtual DocumentCache::ValidationMode getRevalidationMode() const = 0;
00252
00254 virtual void setMessageListener(MessageListener *listener) = 0;
00256 virtual MessageListener *getMessageListener() const = 0;
00257
00259 virtual void setModule(XQQuery *module) = 0;
00261 virtual XQQuery *getModule() const = 0;
00262
00264
00266
00280 virtual bool getProjection() const = 0;
00297 virtual void setProjection(bool enabled) = 0;
00298
00299 virtual bool getDoLintWarnings() const = 0;
00300 virtual void setDoLintWarnings(bool enabled) = 0;
00301
00303 virtual const XMLCh *allocateTempVarName(const XMLCh *prefix = 0) = 0;
00304
00306 virtual XPath2MemoryManager* getMemoryManager() const = 0;
00308 virtual void setMemoryManager(XPath2MemoryManager* memMgr) = 0;
00309
00311 virtual void setFTCase(FTCaseOption option) = 0;
00312 virtual FTCaseOption getFTCase() = 0;
00313 };
00314
00315 #endif