SourceForge.net Logo
StaticAnalysis.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2001-2008
3  * DecisionSoft Limited. All rights reserved.
4  * Copyright (c) 2004-2008
5  * Oracle. All rights reserved.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  * $Id$
20  */
21 
22 #ifndef _STATICANALYSIS_HPP
23 #define _STATICANALYSIS_HPP
24 
25 #include <string>
26 
27 #include <xqilla/framework/XQillaExport.hpp>
29 
30 #include <vector>
31 
33 
37 class XQILLA_API StaticAnalysis
38 {
39 public:
40  class XQILLA_API VarEntry
41  {
42  public:
43  VarEntry(const XMLCh *u, const XMLCh *n, VarEntry *p)
44  : uri(u), name(n), prev(p) {}
45 
46  const XMLCh *uri, *name;
48  };
49 
52 
53  void copy(const StaticAnalysis &o);
54 
56  void clear();
57 
60  void forceNoFolding(bool value);
61  bool isNoFoldingForced() const;
62 
63  void contextItemUsed(bool value);
64  void contextPositionUsed(bool value);
65  void contextSizeUsed(bool value);
66  bool isContextItemUsed() const;
67  bool isContextPositionUsed() const;
68  bool isContextSizeUsed() const;
70  bool areContextFlagsUsed() const;
71 
72  void currentTimeUsed(bool value);
73  void implicitTimezoneUsed(bool value);
74 
75  void availableDocumentsUsed(bool value);
76  void availableCollectionsUsed(bool value);
77  bool areDocsOrCollectionsUsed() const;
78 
79  void variableUsed(const XMLCh *namespaceURI, const XMLCh *name);
80  bool removeVariable(const XMLCh *namespaceURI, const XMLCh *name);
81  bool isVariableUsed(const XMLCh *namespaceURI, const XMLCh *name) const;
82  VarEntry *variablesUsed() const;
83 
85  void add(const StaticAnalysis &o);
86  void addExceptContextFlags(const StaticAnalysis &o);
87  void addExceptVariable(const XMLCh *namespaceURI, const XMLCh *name, const StaticAnalysis &o);
88 
90  bool isUsed() const;
91  bool isUsedExceptContextFlags() const;
92 
93  void creative(bool value);
94  bool isCreative() const;
95 
96  void updating(bool value);
97  bool isUpdating() const;
98  void possiblyUpdating(bool value);
99  bool isPossiblyUpdating() const;
100 
105  enum Properties {
106  DOCORDER = 0x001,
107  PEER = 0x002,
108  SUBTREE = 0x004,
109  GROUPED = 0x008,
110  SAMEDOC = 0x010,
111  ONENODE = 0x020,
112  SELF = 0x040,
113  FORWARDREF = 0x080,
114  UNDEFINEDVAR = 0x100
115  };
116 
117  unsigned int getProperties() const;
118  void setProperties(unsigned int props);
119 
120  const StaticType &getStaticType() const;
121  StaticType &getStaticType();
122 
123  std::string toString() const;
124 
125 private:
126  StaticAnalysis(const StaticAnalysis &o);
127  StaticAnalysis &operator=(const StaticAnalysis &o);
128 
129  bool _contextItem;
130  bool _contextPosition;
131  bool _contextSize;
132  bool _currentTime;
133  bool _implicitTimezone;
134  bool _availableDocuments;
135  bool _availableCollections;
136  bool _forceNoFolding;
137  bool _creative;
138  bool _updating;
139  bool _possiblyUpdating;
140 
141  unsigned int _properties;
142  StaticType _staticType;
143 
144  VarEntry *_dynamicVariables;
145  XPath2MemoryManager *_memMgr;
146 };
147 
148 #endif