00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _STATICANALYSIS_HPP
00023 #define _STATICANALYSIS_HPP
00024
00025 #include <string>
00026
00027 #include <xqilla/framework/XQillaExport.hpp>
00028 #include <xqilla/ast/StaticType.hpp>
00029
00030 #include <vector>
00031
00032 class XPath2MemoryManager;
00033
00037 class XQILLA_API StaticAnalysis
00038 {
00039 public:
00040 StaticAnalysis(XPath2MemoryManager* memMgr);
00041 StaticAnalysis(const StaticAnalysis &o, XPath2MemoryManager* memMgr);
00042
00043 void copy(const StaticAnalysis &o);
00044
00046 void clear();
00047
00050 void forceNoFolding(bool value);
00051 bool isNoFoldingForced() const;
00052
00053 void contextItemUsed(bool value);
00054 void contextPositionUsed(bool value);
00055 void contextSizeUsed(bool value);
00056 bool isContextItemUsed() const;
00057 bool isContextPositionUsed() const;
00058 bool isContextSizeUsed() const;
00060 bool areContextFlagsUsed() const;
00061
00062 void currentTimeUsed(bool value);
00063 void implicitTimezoneUsed(bool value);
00064
00065 void availableDocumentsUsed(bool value);
00066 void availableCollectionsUsed(bool value);
00067 bool areDocsOrCollectionsUsed() const;
00068
00069 void variableUsed(const XMLCh *namespaceURI, const XMLCh *name);
00070 bool removeVariable(const XMLCh *namespaceURI, const XMLCh *name);
00071 bool isVariableUsed(const XMLCh *namespaceURI, const XMLCh *name) const;
00072 std::vector<std::pair<const XMLCh*, const XMLCh*> > variablesUsed() const;
00073
00075 void add(const StaticAnalysis &o);
00076 void addExceptContextFlags(const StaticAnalysis &o);
00077
00079 bool isUsed() const;
00080 bool isUsedExceptContextFlags() const;
00081
00082 void creative(bool value);
00083 bool isCreative() const;
00084
00085 void updating(bool value);
00086 bool isUpdating() const;
00087 void possiblyUpdating(bool value);
00088 bool isPossiblyUpdating() const;
00089
00094 enum Properties {
00095 DOCORDER = 0x001,
00096 PEER = 0x002,
00097 SUBTREE = 0x004,
00098 GROUPED = 0x008,
00099 SAMEDOC = 0x010,
00100 ONENODE = 0x020,
00101 SELF = 0x040,
00102 FORWARDREF = 0x080,
00103 UNDEFINEDVAR = 0x100
00104 };
00105
00106 unsigned int getProperties() const;
00107 void setProperties(unsigned int props);
00108
00109 const StaticType &getStaticType() const;
00110 StaticType &getStaticType();
00111
00112 std::string toString() const;
00113
00114 private:
00115 StaticAnalysis(const StaticAnalysis &o);
00116 StaticAnalysis &operator=(const StaticAnalysis &o);
00117
00118 bool _contextItem;
00119 bool _contextPosition;
00120 bool _contextSize;
00121 bool _currentTime;
00122 bool _implicitTimezone;
00123 bool _availableDocuments;
00124 bool _availableCollections;
00125 bool _forceNoFolding;
00126 bool _creative;
00127 bool _updating;
00128 bool _possiblyUpdating;
00129
00130 unsigned int _properties;
00131 StaticType _staticType;
00132
00133 class VarEntry
00134 {
00135 public:
00136 VarEntry(const XMLCh *u, const XMLCh *n, VarEntry *p)
00137 : uri(u), name(n), prev(p) {}
00138
00139 const XMLCh *uri, *name;
00140 VarEntry *prev;
00141 };
00142
00143 VarEntry *_dynamicVariables;
00144 XPath2MemoryManager *_memMgr;
00145 };
00146
00147 #endif