# StaticResolutionContext.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: StaticResolutionContext.hpp,v 1.15 2006/11/01 16:37:11 jpcs Exp $
    00012  */
    00013
    00014 #ifndef _STATICRESOLUTIONCONTEXT_HPP
    00015 #define _STATICRESOLUTIONCONTEXT_HPP
    00016
    00017 #include <string>
    00018
    00019 #include <xqilla/framework/XQillaExport.hpp>
    00020 #include <xqilla/ast/StaticType.hpp>
    00021
    00022 #include <xercesc/util/RefHash2KeysTableOf.hpp>
    00023 #include <xercesc/util/StringPool.hpp>
    00024
    00025 #include <vector>
    00026
    00027 class XPath2MemoryManager;
    00028
    00029 typedef XERCES_CPP_NAMESPACE_QUALIFIER RefHash2KeysTableOf<int> VariableAccessSet;
    00030 typedef XERCES_CPP_NAMESPACE_QUALIFIER RefHash2KeysTableOfEnumerator<int> VariableAccessSetEnumerator;
    00031
    00035 class XQILLA_API StaticResolutionContext
    00036 {
    00037 public:
    00038   StaticResolutionContext(XPath2MemoryManager* memMgr);
    00039   StaticResolutionContext(const StaticResolutionContext &o, XPath2MemoryManager* memMgr);
    00040
    00041   void copy(const StaticResolutionContext &o);
    00042
    00044   void clear();
    00045
    00048   void forceNoFolding(bool value);
    00049   bool isNoFoldingForced() const;
    00050
    00051   void contextItemUsed(bool value);
    00052   void contextPositionUsed(bool value);
    00053   void contextSizeUsed(bool value);
    00054   bool isContextItemUsed() const;
    00055   bool isContextPositionUsed() const;
    00056   bool isContextSizeUsed() const;
    00058   bool areContextFlagsUsed() const;
    00059
    00060   void currentTimeUsed(bool value);
    00061   void implicitTimezoneUsed(bool value);
    00062   bool areContextTimeUsed() const;
    00063   void availableDocumentsUsed(bool value);
    00064   void availableCollectionsUsed(bool value);
    00065   bool areDocsOrCollectionsUsed() const;
    00066
    00067   void variableUsed(const XMLCh *namespaceURI, const XMLCh *name);
    00068   bool removeVariable(const XMLCh *namespaceURI, const XMLCh *name);
    00069   bool isVariableUsed(const XMLCh *namespaceURI, const XMLCh *name) const;
    00070   std::vector<std::pair<const XMLCh*, const XMLCh*> > variablesUsed() const;
    00071
    00073   void add(const StaticResolutionContext &o);
    00074   void addExceptContextFlags(const StaticResolutionContext &o);
    00075
    00077   bool isUsed() const;
    00078   bool isUsedExceptContextFlags() const;
    00079
    00080   void creative(bool value);
    00081   bool isCreative() const;
    00082
    00087   enum Properties {
    00088     DOCORDER     = 0x001,
    00089     PEER         = 0x002,
    00090     SUBTREE      = 0x004,
    00091     GROUPED      = 0x008,
    00092     SAMEDOC      = 0x010,
    00093     ONENODE      = 0x020,
    00094     SELF         = 0x040,
    00095     FORWARDREF   = 0x080,
    00096     UNDEFINEDVAR = 0x100
    00097   };
    00098
    00099   unsigned int getProperties() const;
    00100   void setProperties(unsigned int props);
    00101
    00102   const StaticType &getStaticType() const;
    00103   StaticType &getStaticType();
    00104
    00105   std::string toString() const;
    00106
    00107 private:
    00108   StaticResolutionContext(const StaticResolutionContext &o);
    00109   StaticResolutionContext &operator=(const StaticResolutionContext &o);
    00110
    00111   bool _contextItem;
    00112   bool _contextPosition;
    00113   bool _contextSize;
    00114   bool _currentTime;
    00115   bool _implicitTimezone;
    00116   bool _availableDocuments;
    00117   bool _availableCollections;
    00118   bool _forceNoFolding;
    00119   bool _creative;
    00120
    00121   unsigned int _properties;
    00122   StaticType _staticType;
    00123
    00124   VariableAccessSet _dynamicVariables;
    00125   XERCES_CPP_NAMESPACE_QUALIFIER XMLStringPool _uriPool;
    00126   XPath2MemoryManager* _memMgr;
    00127 };
    00128
    00129 #endif