00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _STATICCONTEXT_HPP
00023 #define _STATICCONTEXT_HPP
00024
00025 #include <xqilla/framework/XQillaExport.hpp>
00026 #include <xqilla/simple-api/XQilla.hpp>
00027 #include <time.h>
00028 #include <xqilla/schema/DocumentCache.hpp>
00029 #include <xercesc/util/PlatformUtils.hpp>
00030 #include <xercesc/util/XMemory.hpp>
00031
00032 class DynamicContext;
00033 class XPath2MemoryManager;
00034 class FuncFactory;
00035 class DatatypeFactory;
00036 class Collation;
00037 class VariableTypeStore;
00038 class ItemFactory;
00039 class StaticType;
00040 class ModuleResolver;
00041 class ExternalFunctionResolver;
00042 class MessageListener;
00043 class ExternalFunction;
00044 class XQillaConfiguration;
00045 class XQUserFunction;
00046 class XQillaNSResolver;
00047
00048
00049 typedef std::vector<ASTNode*,XQillaAllocator<ASTNode*> > VectorOfASTNodes;
00050 typedef std::vector<XQUserFunction*, XQillaAllocator<XQUserFunction*> > UserFunctions;
00051
00052 XERCES_CPP_NAMESPACE_BEGIN
00053 class DOMDocument;
00054 class DOMXPathNSResolver;
00055 class XMLEntityResolver;
00056 XERCES_CPP_NAMESPACE_END
00057
00059 class XQILLA_API StaticContext : public XERCES_CPP_NAMESPACE_QUALIFIER XMemory
00060 {
00061 public:
00062 typedef enum {
00063 ORDERING_ORDERED,
00064 ORDERING_UNORDERED
00065 } NodeSetOrdering;
00066
00067 typedef enum {
00068 CONSTRUCTION_MODE_PRESERVE,
00069 CONSTRUCTION_MODE_STRIP
00070 } ConstructionMode;
00071
00072 typedef enum {
00073 FLWOR_ORDER_EMPTY_GREATEST,
00074 FLWOR_ORDER_EMPTY_LEAST
00075 } FLWOROrderingMode;
00076
00077 virtual ~StaticContext() {};
00078
00079 virtual DynamicContext *createModuleContext(XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager *memMgr =
00080 XERCES_CPP_NAMESPACE_QUALIFIER XMLPlatformUtils::fgMemoryManager) const = 0;
00081 virtual DynamicContext *createDynamicContext(XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager *memMgr =
00082 XERCES_CPP_NAMESPACE_QUALIFIER XMLPlatformUtils::fgMemoryManager) const = 0;
00083
00084 virtual DynamicContext *createDebugQueryContext(const Item::Ptr &contextItem,
00085 size_t contextPosition,
00086 size_t contextSize,
00087 const VariableStore *variables,
00088 const XERCES_CPP_NAMESPACE_QUALIFIER DOMXPathNSResolver *nsResolver,
00089 const XMLCh *defaultElementNS,
00090 XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager *memMgr =
00091 XERCES_CPP_NAMESPACE_QUALIFIER XMLPlatformUtils::fgMemoryManager) const = 0;
00092
00094 virtual XQillaConfiguration *getConfiguration() const = 0;
00095
00098 virtual XQilla::Language getLanguage() const = 0;
00099
00101 virtual ItemFactory *getItemFactory() const = 0;
00103 virtual void setItemFactory(ItemFactory *factory) = 0;
00104
00106 virtual const StaticType &getContextItemType() const = 0;
00108 virtual void setContextItemType(const StaticType &st) = 0;
00109
00111 virtual bool getXPath1CompatibilityMode() const = 0;
00113 virtual void setXPath1CompatibilityMode(bool newMode) = 0;
00114
00116 virtual const XERCES_CPP_NAMESPACE_QUALIFIER DOMXPathNSResolver* getNSResolver() const = 0;
00119 virtual const XMLCh* getUriBoundToPrefix(const XMLCh* prefix, const LocationInfo *location = 0) const = 0;
00122 virtual const XMLCh* getPrefixBoundToUri(const XMLCh* uri) const = 0;
00124 virtual void setNSResolver(const XERCES_CPP_NAMESPACE_QUALIFIER DOMXPathNSResolver* resolver) = 0;
00126 virtual void setNamespaceBinding(const XMLCh* prefix, const XMLCh* uri) = 0;
00127
00129 virtual const XMLCh* getDefaultElementAndTypeNS() const = 0;
00131 virtual void setDefaultElementAndTypeNS(const XMLCh* newNS) = 0;
00132
00134 virtual const XMLCh* getDefaultFuncNS() const = 0;
00136 virtual void setDefaultFuncNS(const XMLCh* newNS) = 0;
00137
00139 virtual DocumentCache* getDocumentCache() const = 0;
00141 virtual void setDocumentCache(DocumentCache* docCache) = 0;
00142
00151 virtual bool isTypeOrDerivedFromType(const XMLCh* const uri, const XMLCh* const typeName, const XMLCh* const uriToCheck, const XMLCh* const typeNameToCheck) const = 0;
00157 virtual void setXMLEntityResolver(XERCES_CPP_NAMESPACE_QUALIFIER XMLEntityResolver* const handler) = 0;
00159 virtual XERCES_CPP_NAMESPACE_QUALIFIER XMLEntityResolver* getXMLEntityResolver() const = 0;
00160
00162 virtual void setModuleResolver(ModuleResolver *resolver) = 0;
00164 virtual ModuleResolver *getModuleResolver() const = 0;
00165
00166 virtual VectorOfStrings* resolveModuleURI(const XMLCh* uri) const = 0;
00167
00169 virtual void addSchemaLocation(const XMLCh* uri, VectorOfStrings* locations, const LocationInfo *location = 0) = 0;
00170
00172 virtual VariableTypeStore* getVariableTypeStore() = 0;
00173
00175 virtual void addTemplate(XQUserFunction *tp) = 0;
00177 virtual const XQUserFunction *lookUpNamedTemplate(const XMLCh *uri, const XMLCh *name) const = 0;
00179 virtual const UserFunctions &getTemplateRules() const = 0;
00180
00182 virtual void addCustomFunction(FuncFactory *func) = 0;
00184 virtual void removeCustomFunction(FuncFactory *func) = 0;
00186 virtual ASTNode *lookUpFunction(const XMLCh *uri, const XMLCh *name, const VectorOfASTNodes &v) const = 0;
00187
00189 virtual void setExternalFunctionResolver(ExternalFunctionResolver *resolver) = 0;
00191 virtual ExternalFunctionResolver *getExternalFunctionResolver() const = 0;
00193 virtual void addExternalFunction(const ExternalFunction *func) = 0;
00195 virtual const ExternalFunction *lookUpExternalFunction(const XMLCh *uri, const XMLCh *name, size_t numArgs) const = 0;
00196
00198 virtual Collation* getCollation(const XMLCh* const URI, const LocationInfo *location = 0) const = 0;
00200 virtual void addCollation(Collation* collation) = 0;
00201
00203 virtual Collation* getDefaultCollation(const LocationInfo *location = 0) const = 0;
00205 virtual void setDefaultCollation(const XMLCh* const URI) = 0;
00206
00208 virtual const XMLCh* getBaseURI() const = 0;
00210 virtual void setBaseURI(const XMLCh* newURI) = 0;
00211
00213 virtual NodeSetOrdering getNodeSetOrdering() const = 0;
00215 virtual void setNodeSetOrdering(NodeSetOrdering newOrder) = 0;
00216
00218 virtual ConstructionMode getConstructionMode() const = 0;
00220 virtual void setConstructionMode(ConstructionMode newMode) = 0;
00221
00223 virtual void setPreserveBoundarySpace(bool value) = 0;
00225 virtual bool getPreserveBoundarySpace() const = 0;
00226
00228 virtual FLWOROrderingMode getDefaultFLWOROrderingMode() const = 0;
00230 virtual void setDefaultFLWOROrderingMode(FLWOROrderingMode newMode) = 0;
00231
00233 virtual void setInheritNamespaces(bool value) = 0;
00235 virtual bool getInheritNamespaces() const = 0;
00236
00238 virtual void setPreserveNamespaces(bool value) = 0;
00240 virtual bool getPreserveNamespaces() const = 0;
00241
00243 virtual void setRevalidationMode(DocumentCache::ValidationMode mode) = 0;
00245 virtual DocumentCache::ValidationMode getRevalidationMode() const = 0;
00246
00248 virtual void setMessageListener(MessageListener *listener) = 0;
00250 virtual MessageListener *getMessageListener() const = 0;
00251
00253
00255
00269 virtual bool getProjection() const = 0;
00286 virtual void setProjection(bool enabled) = 0;
00287
00288 virtual bool getDoLintWarnings() const = 0;
00289 virtual void setDoLintWarnings(bool enabled) = 0;
00290
00292 virtual const XMLCh *allocateTempVarName(const XMLCh *prefix = 0) = 0;
00293
00295 virtual XPath2MemoryManager* getMemoryManager() const = 0;
00297 virtual void setMemoryManager(XPath2MemoryManager* memMgr) = 0;
00298 };
00299
00300 #endif