00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef _STATICANALYSIS_HPP
00015 #define _STATICANALYSIS_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 StaticAnalysis
00036 {
00037 public:
00038 StaticAnalysis(XPath2MemoryManager* memMgr);
00039 StaticAnalysis(const StaticAnalysis &o, XPath2MemoryManager* memMgr);
00040
00041 void copy(const StaticAnalysis &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
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 StaticAnalysis &o);
00074 void addExceptContextFlags(const StaticAnalysis &o);
00075
00077 bool isUsed() const;
00078 bool isUsedExceptContextFlags() const;
00079
00080 void creative(bool value);
00081 bool isCreative() const;
00082
00083 void updating(bool value);
00084 bool isUpdating() const;
00085 void possiblyUpdating(bool value);
00086 bool isPossiblyUpdating() const;
00087
00092 enum Properties {
00093 DOCORDER = 0x001,
00094 PEER = 0x002,
00095 SUBTREE = 0x004,
00096 GROUPED = 0x008,
00097 SAMEDOC = 0x010,
00098 ONENODE = 0x020,
00099 SELF = 0x040,
00100 FORWARDREF = 0x080,
00101 UNDEFINEDVAR = 0x100
00102 };
00103
00104 unsigned int getProperties() const;
00105 void setProperties(unsigned int props);
00106
00107 const StaticType &getStaticType() const;
00108 StaticType &getStaticType();
00109
00110 std::string toString() const;
00111
00112 private:
00113 StaticAnalysis(const StaticAnalysis &o);
00114 StaticAnalysis &operator=(const StaticAnalysis &o);
00115
00116 bool _contextItem;
00117 bool _contextPosition;
00118 bool _contextSize;
00119 bool _currentTime;
00120 bool _implicitTimezone;
00121 bool _availableDocuments;
00122 bool _availableCollections;
00123 bool _forceNoFolding;
00124 bool _creative;
00125 bool _updating;
00126 bool _possiblyUpdating;
00127
00128 unsigned int _properties;
00129 StaticType _staticType;
00130
00131 VariableAccessSet _dynamicVariables;
00132 XERCES_CPP_NAMESPACE_QUALIFIER XMLStringPool _uriPool;
00133 XPath2MemoryManager* _memMgr;
00134 };
00135
00136 #endif