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 class XQILLA_API VarEntry
00041 {
00042 public:
00043 VarEntry(const XMLCh *u, const XMLCh *n, VarEntry *p)
00044 : uri(u), name(n), prev(p) {}
00045
00046 const XMLCh *uri, *name;
00047 VarEntry *prev;
00048 };
00049
00050 StaticAnalysis(XPath2MemoryManager* memMgr);
00051 StaticAnalysis(const StaticAnalysis &o, XPath2MemoryManager* memMgr);
00052
00053 void copy(const StaticAnalysis &o);
00054
00056 void clear();
00057
00060 void forceNoFolding(bool value);
00061 bool isNoFoldingForced() const;
00062
00063 void contextItemUsed(bool value);
00064 void contextPositionUsed(bool value);
00065 void contextSizeUsed(bool value);
00066 bool isContextItemUsed() const;
00067 bool isContextPositionUsed() const;
00068 bool isContextSizeUsed() const;
00070 bool areContextFlagsUsed() const;
00071
00072 void currentTimeUsed(bool value);
00073 void implicitTimezoneUsed(bool value);
00074
00075 void availableDocumentsUsed(bool value);
00076 void availableCollectionsUsed(bool value);
00077 bool areDocsOrCollectionsUsed() const;
00078
00079 void variableUsed(const XMLCh *namespaceURI, const XMLCh *name);
00080 bool removeVariable(const XMLCh *namespaceURI, const XMLCh *name);
00081 bool isVariableUsed(const XMLCh *namespaceURI, const XMLCh *name) const;
00082 VarEntry *variablesUsed() const;
00083
00085 void add(const StaticAnalysis &o);
00086 void addExceptContextFlags(const StaticAnalysis &o);
00087 void addExceptVariable(const XMLCh *namespaceURI, const XMLCh *name, const StaticAnalysis &o);
00088
00090 bool isUsed() const;
00091 bool isUsedExceptContextFlags() const;
00092
00093 void creative(bool value);
00094 bool isCreative() const;
00095
00096 void updating(bool value);
00097 bool isUpdating() const;
00098 void possiblyUpdating(bool value);
00099 bool isPossiblyUpdating() const;
00100
00105 enum Properties {
00106 DOCORDER = 0x001,
00107 PEER = 0x002,
00108 SUBTREE = 0x004,
00109 GROUPED = 0x008,
00110 SAMEDOC = 0x010,
00111 ONENODE = 0x020,
00112 SELF = 0x040,
00113 FORWARDREF = 0x080,
00114 UNDEFINEDVAR = 0x100
00115 };
00116
00117 unsigned int getProperties() const;
00118 void setProperties(unsigned int props);
00119
00120 const StaticType &getStaticType() const;
00121 StaticType &getStaticType();
00122
00123 std::string toString() const;
00124
00125 private:
00126 StaticAnalysis(const StaticAnalysis &o);
00127 StaticAnalysis &operator=(const StaticAnalysis &o);
00128
00129 bool _contextItem;
00130 bool _contextPosition;
00131 bool _contextSize;
00132 bool _currentTime;
00133 bool _implicitTimezone;
00134 bool _availableDocuments;
00135 bool _availableCollections;
00136 bool _forceNoFolding;
00137 bool _creative;
00138 bool _updating;
00139 bool _possiblyUpdating;
00140
00141 unsigned int _properties;
00142 StaticType _staticType;
00143
00144 VarEntry *_dynamicVariables;
00145 XPath2MemoryManager *_memMgr;
00146 };
00147
00148 #endif