# StaticContext.hpp

Go to the documentation of this file.

    00001 /*
    00002  * Copyright (c) 2001-2006
    00003  *     DecisionSoft Limited. All rights reserved.
    00004  * Copyright (c) 2004-2006
    00005  *     Progress Software Corporation. All rights reserved.
    00006  * Copyright (c) 2004-2006
    00007  *     Oracle. All rights reserved.
    00008  *
    00009  * See the file LICENSE for redistribution information.
    00010  *
    00011  * $Id: StaticContext.hpp,v 1.16 2006/11/01 16:37:12 jpcs Exp $
    00012  */
    00013
    00014 #ifndef _STATICCONTEXT_HPP
    00015 #define _STATICCONTEXT_HPP
    00016
    00017 #include <xqilla/framework/XQillaExport.hpp>
    00018 #include <time.h>
    00019 #include <xqilla/schema/DocumentCache.hpp>
    00020 #include <xercesc/util/PlatformUtils.hpp>
    00021 #include <xercesc/util/XMemory.hpp>
    00022
    00023 // Copied from ASTNode.hpp
    00024 typedef std::vector<ASTNode*,XQillaAllocator<ASTNode*> > VectorOfASTNodes;
    00025
    00026 class DynamicContext;
    00027 class XPath2MemoryManager;
    00028 class FuncFactory;
    00029 class DatatypeFactory;
    00030 class Collation;
    00031 class VariableTypeStore;
    00032 class ItemFactory;
    00033 class StaticType;
    00034 class ModuleResolver;
    00035
    00036 XERCES_CPP_NAMESPACE_BEGIN
    00037 class DOMDocument;
    00038 class DOMXPathNSResolver;
    00039 class XMLEntityResolver;
    00040 XERCES_CPP_NAMESPACE_END
    00041
    00043 class XQILLA_API StaticContext : public XERCES_CPP_NAMESPACE_QUALIFIER XMemory
    00044 {
    00045 public:
    00046   typedef enum {
    00047       ORDERING_ORDERED,
    00048       ORDERING_UNORDERED
    00049   } NodeSetOrdering;
    00050
    00051   typedef enum {
    00052     CONSTRUCTION_MODE_PRESERVE,
    00053     CONSTRUCTION_MODE_STRIP
    00054   } ConstructionMode;
    00055
    00056   typedef enum {
    00057     FLWOR_ORDER_EMPTY_GREATEST,
    00058     FLWOR_ORDER_EMPTY_LEAST
    00059   } FLWOROrderingMode;
    00060
    00061   virtual ~StaticContext() {};
    00062
    00063   virtual DynamicContext *createModuleContext(XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager *memMgr =
    00064                                               XERCES_CPP_NAMESPACE_QUALIFIER XMLPlatformUtils::fgMemoryManager) const = 0;
    00065   virtual DynamicContext *createDynamicContext(XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager *memMgr =
    00066                                                XERCES_CPP_NAMESPACE_QUALIFIER XMLPlatformUtils::fgMemoryManager) const = 0;
    00067
    00069   virtual ItemFactory *getItemFactory() const = 0;
    00071   virtual void setItemFactory(ItemFactory *factory) = 0;
    00072
    00074   virtual const StaticType &getContextItemType() const = 0;
    00076   virtual void setContextItemType(const StaticType &st) = 0;
    00077
    00079   virtual bool getXPath1CompatibilityMode() const = 0;
    00081   virtual void setXPath1CompatibilityMode(bool newMode) = 0;
    00082
    00084   virtual const XERCES_CPP_NAMESPACE_QUALIFIER DOMXPathNSResolver* getNSResolver() const = 0;
    00087   virtual const XMLCh* getUriBoundToPrefix(const XMLCh* prefix, const LocationInfo *location) const = 0;
    00090   virtual const XMLCh* getPrefixBoundToUri(const XMLCh* uri) const = 0;
    00092   virtual void setNSResolver(const XERCES_CPP_NAMESPACE_QUALIFIER DOMXPathNSResolver* resolver) = 0;
    00094   virtual void setNamespaceBinding(const XMLCh* prefix, const XMLCh* uri) = 0;
    00095
    00097   virtual const XMLCh* getDefaultElementAndTypeNS() const = 0;
    00099   virtual void setDefaultElementAndTypeNS(const XMLCh* newNS) = 0;
    00100
    00102   virtual const XMLCh* getDefaultFuncNS() const = 0;
    00104   virtual void setDefaultFuncNS(const XMLCh* newNS) = 0;
    00105
    00107   virtual const DocumentCache* getDocumentCache() const = 0;
    00109   virtual void setDocumentCache(DocumentCache* docCache) = 0;
    00110
    00119   virtual bool isTypeOrDerivedFromType(const XMLCh* const uri, const XMLCh* const typeName, const XMLCh* const uriToCheck, const XMLCh* const typeNameToCheck) const = 0;
    00125   virtual void setXMLEntityResolver(XERCES_CPP_NAMESPACE_QUALIFIER XMLEntityResolver* const handler) = 0;
    00127   virtual XERCES_CPP_NAMESPACE_QUALIFIER XMLEntityResolver* getXMLEntityResolver() const = 0;
    00128
    00130   virtual void setModuleResolver(ModuleResolver *resolver) = 0;
    00132   virtual ModuleResolver *getModuleResolver() const = 0;
    00133   /* Retrieve a list of locations for the given module URI */
    00134   virtual VectorOfStrings* resolveModuleURI(const XMLCh* uri) const = 0;
    00135
    00137   virtual void addSchemaLocation(const XMLCh* uri, VectorOfStrings* locations) = 0;
    00138
    00140   virtual VariableTypeStore* getVariableTypeStore() = 0;
    00141
    00143   virtual void addCustomFunction(FuncFactory *func) = 0;
    00145   virtual ASTNode* lookUpFunction(const XMLCh* prefix, const XMLCh* name, VectorOfASTNodes& v,
    00146                                   const LocationInfo *location) const = 0;
    00147
    00149   virtual Collation* getCollation(const XMLCh* const URI, const LocationInfo *location) const = 0;
    00151   virtual void addCollation(Collation* collation) = 0;
    00152
    00154   virtual Collation* getDefaultCollation(const LocationInfo *location) const = 0;
    00156   virtual void setDefaultCollation(const XMLCh* const URI) = 0;
    00157
    00159   virtual const XMLCh* getBaseURI() const = 0;
    00161   virtual void setBaseURI(const XMLCh* newURI) = 0;
    00162
    00164   virtual NodeSetOrdering getNodeSetOrdering() const = 0;
    00166   virtual void setNodeSetOrdering(NodeSetOrdering newOrder) = 0;
    00167
    00169   virtual ConstructionMode getConstructionMode() const = 0;
    00171   virtual void setConstructionMode(ConstructionMode newMode) = 0;
    00172
    00174   virtual void setPreserveBoundarySpace(bool value) = 0;
    00176   virtual bool getPreserveBoundarySpace() const = 0;
    00177
    00179   virtual FLWOROrderingMode getDefaultFLWOROrderingMode() const = 0;
    00181   virtual void setDefaultFLWOROrderingMode(FLWOROrderingMode newMode) = 0;
    00182
    00184   virtual void setInheritNamespaces(bool value) = 0;
    00186   virtual bool getInheritNamespaces() const = 0;
    00187
    00189   virtual void setPreserveNamespaces(bool value) = 0;
    00191   virtual bool getPreserveNamespaces() const = 0;
    00192
    00194   virtual void enableDebugging(bool enable=true) = 0;
    00196   virtual bool isDebuggingEnabled() const = 0;
    00197
    00199   //  XQilla context specific accessors  //
    00201
    00203   virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *createNewDocument() const = 0;
    00205   virtual void releaseDocument(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc) const = 0;
    00206
    00208   virtual XPath2MemoryManager* getMemoryManager() const = 0;
    00210   virtual void setMemoryManager(XPath2MemoryManager* memMgr) = 0;
    00211 };
    00212
    00213 #endif