include
xqilla
ast
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, 2015 Oracle and/or its affiliates. All rights reserved.
5
*
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
20
#ifndef _STATICANALYSIS_HPP
21
#define _STATICANALYSIS_HPP
22
23
#include <string>
24
25
#include <xqilla/framework/XQillaExport.hpp>
26
#include <
xqilla/ast/StaticType.hpp
>
27
28
#include <vector>
29
30
class
XPath2MemoryManager
;
31
35
class
XQILLA_API
StaticAnalysis
36
{
37
public
:
38
static
const
int
HASH_SIZE = 13;
39
40
class
XQILLA_API
VarEntry
41
{
42
public
:
43
VarEntry
() : uri(0), name(0), hash(0), prev(0) {}
44
void
set(
const
XMLCh *u,
const
XMLCh *n);
45
void
set(
const
XMLCh *u,
const
XMLCh *n,
size_t
h);
46
47
const
XMLCh *
uri
, *name;
48
size_t
hash
;
49
VarEntry
*
prev
;
50
};
51
52
StaticAnalysis
(
XPath2MemoryManager
* memMgr);
53
StaticAnalysis
(
const
StaticAnalysis
&o,
XPath2MemoryManager
* memMgr);
54
55
void
copy(
const
StaticAnalysis
&o);
56
void
release();
57
59
void
clear();
60
void
clearExceptType();
61
64
void
forceNoFolding(
bool
value);
65
bool
isNoFoldingForced()
const
;
66
67
void
contextItemUsed(
bool
value);
68
void
contextPositionUsed(
bool
value);
69
void
contextSizeUsed(
bool
value);
70
bool
isContextItemUsed()
const
;
71
bool
isContextPositionUsed()
const
;
72
bool
isContextSizeUsed()
const
;
74
bool
areContextFlagsUsed()
const
;
75
76
void
currentTimeUsed(
bool
value);
77
void
implicitTimezoneUsed(
bool
value);
78
79
void
availableDocumentsUsed(
bool
value);
80
void
availableCollectionsUsed(
bool
value);
81
bool
areDocsOrCollectionsUsed()
const
;
82
83
void
variableUsed(
const
XMLCh *namespaceURI,
const
XMLCh *name);
84
bool
removeVariable(
const
XMLCh *namespaceURI,
const
XMLCh *name);
85
bool
isVariableUsed(
const
XMLCh *namespaceURI,
const
XMLCh *name)
const
;
86
bool
isVariableUsed()
const
;
87
VarEntry
**variablesUsed()
const
;
88
90
void
add(
const
StaticAnalysis
&o);
91
void
addExceptContextFlags(
const
StaticAnalysis
&o);
92
void
addExceptVariable(
const
XMLCh *namespaceURI,
const
XMLCh *name,
const
StaticAnalysis
&o);
93
95
bool
isUsed()
const
;
96
bool
isUsedExceptContextFlags()
const
;
97
98
void
creative(
bool
value);
99
bool
isCreative()
const
;
100
101
void
updating(
bool
value);
102
bool
isUpdating()
const
;
103
void
possiblyUpdating(
bool
value);
104
bool
isPossiblyUpdating()
const
;
105
110
enum
Properties
{
111
DOCORDER = 0x001,
112
PEER = 0x002,
113
SUBTREE = 0x004,
114
GROUPED = 0x008,
115
SAMEDOC = 0x010,
116
ONENODE = 0x020,
117
SELF = 0x040,
118
UNDEFINEDVAR = 0x080
119
};
120
121
unsigned
int
getProperties()
const
;
122
void
setProperties(
unsigned
int
props);
123
124
const
StaticType
&getStaticType()
const
;
125
StaticType
&getStaticType();
126
127
std::string toString()
const
;
128
129
private
:
130
StaticAnalysis
(
const
StaticAnalysis
&o);
131
StaticAnalysis
&operator=(
const
StaticAnalysis
&o);
132
133
bool
_contextItem;
134
bool
_contextPosition;
135
bool
_contextSize;
136
bool
_currentTime;
137
bool
_implicitTimezone;
138
bool
_availableDocuments;
139
bool
_availableCollections;
140
bool
_forceNoFolding;
141
bool
_creative;
142
bool
_updating;
143
bool
_possiblyUpdating;
144
145
unsigned
int
_properties;
146
StaticType
_staticType;
147
148
VarEntry *_dynamicVariables[HASH_SIZE];
149
VarEntry *_recycle;
150
XPath2MemoryManager
*_memMgr;
151
};
152
153
#endif
StaticAnalysis::VarEntry::VarEntry
VarEntry()
Definition:
StaticAnalysis.hpp:43
StaticAnalysis::VarEntry::hash
size_t hash
Definition:
StaticAnalysis.hpp:48
StaticAnalysis::VarEntry::uri
const XMLCh * uri
Definition:
StaticAnalysis.hpp:47
StaticAnalysis::Properties
Properties
Properties that allow optimisation regarding sorting or not.
Definition:
StaticAnalysis.hpp:110
XPath2MemoryManager
Definition:
XPath2MemoryManager.hpp:45
StaticAnalysis::VarEntry
Definition:
StaticAnalysis.hpp:40
StaticAnalysis::VarEntry::prev
VarEntry * prev
Definition:
StaticAnalysis.hpp:49
StaticType.hpp
StaticType
Class that represents the static type of an expression.
Definition:
StaticType.hpp:33
StaticAnalysis
Records access to various parts of the context during static resolution.
Definition:
StaticAnalysis.hpp:35
Generated by
1.8.17