# XQilla Simple API Documentation

- Main Page
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

# StaticAnalysis.hpp

Go to the documentation of this file.

    00001 /*
    00002  * Copyright (c) 2001, 2008,
    00003  *     DecisionSoft Limited. All rights reserved.
    00004  * Copyright (c) 2004, 2015 Oracle and/or its affiliates. All rights reserved.
    00005  *
    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
    00020 #ifndef _STATICANALYSIS_HPP
    00021 #define _STATICANALYSIS_HPP
    00022
    00023 #include <string>
    00024
    00025 #include <xqilla/framework/XQillaExport.hpp>
    00026 #include <xqilla/ast/StaticType.hpp>
    00027
    00028 #include <vector>
    00029
    00030 class XPath2MemoryManager;
    00031
    00035 class XQILLA_API StaticAnalysis
    00036 {
    00037 public:
    00038   static const int HASH_SIZE = 13;
    00039
    00040   class XQILLA_API VarEntry
    00041   {
    00042   public:
    00043     VarEntry() : uri(0), name(0), hash(0), prev(0) {}
    00044     void set(const XMLCh *u, const XMLCh *n);
    00045     void set(const XMLCh *u, const XMLCh *n, size_t h);
    00046
    00047     const XMLCh *uri, *name;
    00048     size_t hash;
    00049     VarEntry *prev;
    00050   };
    00051
    00052   StaticAnalysis(XPath2MemoryManager* memMgr);
    00053   StaticAnalysis(const StaticAnalysis &o, XPath2MemoryManager* memMgr);
    00054
    00055   void copy(const StaticAnalysis &o);
    00056   void release();
    00057
    00059   void clear();
    00060   void clearExceptType();
    00061
    00064   void forceNoFolding(bool value);
    00065   bool isNoFoldingForced() const;
    00066
    00067   void contextItemUsed(bool value);
    00068   void contextPositionUsed(bool value);
    00069   void contextSizeUsed(bool value);
    00070   bool isContextItemUsed() const;
    00071   bool isContextPositionUsed() const;
    00072   bool isContextSizeUsed() const;
    00074   bool areContextFlagsUsed() const;
    00075
    00076   void currentTimeUsed(bool value);
    00077   void implicitTimezoneUsed(bool value);
    00078
    00079   void availableDocumentsUsed(bool value);
    00080   void availableCollectionsUsed(bool value);
    00081   bool areDocsOrCollectionsUsed() const;
    00082
    00083   void variableUsed(const XMLCh *namespaceURI, const XMLCh *name);
    00084   bool removeVariable(const XMLCh *namespaceURI, const XMLCh *name);
    00085   bool isVariableUsed(const XMLCh *namespaceURI, const XMLCh *name) const;
    00086   bool isVariableUsed() const;
    00087   VarEntry **variablesUsed() const;
    00088
    00090   void add(const StaticAnalysis &o);
    00091   void addExceptContextFlags(const StaticAnalysis &o);
    00092   void addExceptVariable(const XMLCh *namespaceURI, const XMLCh *name, const StaticAnalysis &o);
    00093
    00095   bool isUsed() const;
    00096   bool isUsedExceptContextFlags() const;
    00097
    00098   void creative(bool value);
    00099   bool isCreative() const;
    00100
    00101   void updating(bool value);
    00102   bool isUpdating() const;
    00103   void possiblyUpdating(bool value);
    00104   bool isPossiblyUpdating() const;
    00105
    00110   enum Properties {
    00111     DOCORDER     = 0x001,
    00112     PEER         = 0x002,
    00113     SUBTREE      = 0x004,
    00114     GROUPED      = 0x008,
    00115     SAMEDOC      = 0x010,
    00116     ONENODE      = 0x020,
    00117     SELF         = 0x040,
    00118     UNDEFINEDVAR = 0x080
    00119   };
    00120
    00121   unsigned int getProperties() const;
    00122   void setProperties(unsigned int props);
    00123
    00124   const StaticType &getStaticType() const;
    00125   StaticType &getStaticType();
    00126
    00127   std::string toString() const;
    00128
    00129 private:
    00130   StaticAnalysis(const StaticAnalysis &o);
    00131   StaticAnalysis &operator=(const StaticAnalysis &o);
    00132
    00133   bool _contextItem;
    00134   bool _contextPosition;
    00135   bool _contextSize;
    00136   bool _currentTime;
    00137   bool _implicitTimezone;
    00138   bool _availableDocuments;
    00139   bool _availableCollections;
    00140   bool _forceNoFolding;
    00141   bool _creative;
    00142   bool _updating;
    00143   bool _possiblyUpdating;
    00144
    00145   unsigned int _properties;
    00146   StaticType _staticType;
    00147
    00148   VarEntry *_dynamicVariables[HASH_SIZE];
    00149   VarEntry *_recycle;
    00150   XPath2MemoryManager *_memMgr;
    00151 };
    00152
    00153 #endif