SourceForge.net Logo

StaticAnalysis.hpp

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2001-2007
00003  *     DecisionSoft Limited. All rights reserved.
00004  * Copyright (c) 2004-2007
00005  *     Oracle. All rights reserved.
00006  *
00007  * Licensed under the Apache License, Version 2.0 (the "License");
00008  * you may not use this file except in compliance with the License.
00009  * You may obtain a copy of the License at
00010  *
00011  *     http://www.apache.org/licenses/LICENSE-2.0
00012  *
00013  * Unless required by applicable law or agreed to in writing, software
00014  * distributed under the License is distributed on an "AS IS" BASIS,
00015  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00016  * See the License for the specific language governing permissions and
00017  * limitations under the License.
00018  *
00019  * $Id: StaticAnalysis.hpp,v 1.2 2007/11/28 13:13:19 jpcs Exp $
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 <xercesc/util/RefHash2KeysTableOf.hpp>
00031 #include <xercesc/util/StringPool.hpp>
00032 
00033 #include <vector>
00034 
00035 class XPath2MemoryManager;
00036 
00037 typedef XERCES_CPP_NAMESPACE_QUALIFIER RefHash2KeysTableOf<int> VariableAccessSet;
00038 typedef XERCES_CPP_NAMESPACE_QUALIFIER RefHash2KeysTableOfEnumerator<int> VariableAccessSetEnumerator;
00039 
00043 class XQILLA_API StaticAnalysis
00044 {
00045 public:
00046   StaticAnalysis(XPath2MemoryManager* memMgr);
00047   StaticAnalysis(const StaticAnalysis &o, XPath2MemoryManager* memMgr);
00048 
00049   void copy(const StaticAnalysis &o);
00050 
00052   void clear();
00053 
00056   void forceNoFolding(bool value);
00057   bool isNoFoldingForced() const;
00058 
00059   void contextItemUsed(bool value);
00060   void contextPositionUsed(bool value);
00061   void contextSizeUsed(bool value);
00062   bool isContextItemUsed() const;
00063   bool isContextPositionUsed() const;
00064   bool isContextSizeUsed() const;
00066   bool areContextFlagsUsed() const;
00067 
00068   void currentTimeUsed(bool value);
00069   void implicitTimezoneUsed(bool value);
00070 
00071   void availableDocumentsUsed(bool value);
00072   void availableCollectionsUsed(bool value);
00073   bool areDocsOrCollectionsUsed() const;
00074 
00075   void variableUsed(const XMLCh *namespaceURI, const XMLCh *name);
00076   bool removeVariable(const XMLCh *namespaceURI, const XMLCh *name);
00077   bool isVariableUsed(const XMLCh *namespaceURI, const XMLCh *name) const;
00078   std::vector<std::pair<const XMLCh*, const XMLCh*> > variablesUsed() const;
00079 
00081   void add(const StaticAnalysis &o);
00082   void addExceptContextFlags(const StaticAnalysis &o);
00083 
00085   bool isUsed() const;
00086   bool isUsedExceptContextFlags() const;
00087 
00088   void creative(bool value);
00089   bool isCreative() const;
00090 
00091   void updating(bool value);
00092   bool isUpdating() const;
00093   void possiblyUpdating(bool value);
00094   bool isPossiblyUpdating() const;
00095 
00100   enum Properties {
00101     DOCORDER     = 0x001, 
00102     PEER         = 0x002, 
00103     SUBTREE      = 0x004, 
00104     GROUPED      = 0x008, 
00105     SAMEDOC      = 0x010, 
00106     ONENODE      = 0x020, 
00107     SELF         = 0x040, 
00108     FORWARDREF   = 0x080, 
00109     UNDEFINEDVAR = 0x100  
00110   };
00111 
00112   unsigned int getProperties() const;
00113   void setProperties(unsigned int props);
00114 
00115   const StaticType &getStaticType() const;
00116   StaticType &getStaticType();
00117 
00118   std::string toString() const;
00119 
00120 private:
00121   StaticAnalysis(const StaticAnalysis &o);
00122   StaticAnalysis &operator=(const StaticAnalysis &o);
00123 
00124   bool _contextItem;
00125   bool _contextPosition;
00126   bool _contextSize;
00127   bool _currentTime;
00128   bool _implicitTimezone;
00129   bool _availableDocuments;
00130   bool _availableCollections;
00131   bool _forceNoFolding;
00132   bool _creative;
00133   bool _updating;
00134   bool _possiblyUpdating;
00135 
00136   unsigned int _properties;
00137   StaticType _staticType;
00138 
00139   VariableAccessSet _dynamicVariables;
00140   XERCES_CPP_NAMESPACE_QUALIFIER XMLStringPool _uriPool;
00141   XPath2MemoryManager* _memMgr;
00142 };
00143 
00144 #endif

Generated on Wed Dec 12 20:16:43 2007 for XQilla Simple API by  doxygen 1.5.1