Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
VariableAction.cs
Go to the documentation of this file.
1
using
System.Xml.XPath
;
2
3
namespace
System.Xml.Xsl.XsltOld
;
4
5
internal
class
VariableAction
:
ContainerAction
,
IXsltContextVariable
6
{
7
public
static
object
BeingComputedMark
=
new
object();
8
9
protected
XmlQualifiedName
name
;
10
11
protected
string
nameStr
;
12
13
protected
string
baseUri
;
14
15
protected
int
selectKey
= -1;
16
17
protected
int
stylesheetid
;
18
19
protected
VariableType
varType
;
20
21
private
int
_varKey
;
22
23
internal
int
Stylesheetid
=>
stylesheetid
;
24
25
internal
XmlQualifiedName
Name
=>
name
;
26
27
internal
string
NameStr
=>
nameStr
;
28
29
internal
int
VarKey
=>
_varKey
;
30
31
internal
bool
IsGlobal
32
{
33
get
34
{
35
if
(
varType
!= 0)
36
{
37
return
varType
==
VariableType
.GlobalParameter;
38
}
39
return
true
;
40
}
41
}
42
43
XPathResultType
IXsltContextVariable.VariableType
=>
XPathResultType
.Any;
44
45
bool
IXsltContextVariable.IsLocal
46
{
47
get
48
{
49
if
(
varType
!=
VariableType
.LocalVariable)
50
{
51
return
varType
==
VariableType
.LocalParameter;
52
}
53
return
true
;
54
}
55
}
56
57
bool
IXsltContextVariable.IsParam
58
{
59
get
60
{
61
if
(
varType
!=
VariableType
.LocalParameter)
62
{
63
return
varType
==
VariableType
.GlobalParameter;
64
}
65
return
true
;
66
}
67
}
68
69
internal
VariableAction
(
VariableType
type
)
70
{
71
varType
=
type
;
72
}
73
74
internal
override
void
Compile
(
Compiler
compiler
)
75
{
76
stylesheetid
=
compiler
.Stylesheetid;
77
baseUri
=
compiler
.Input.BaseURI;
78
CompileAttributes
(
compiler
);
79
CheckRequiredAttribute
(
compiler
,
name
,
"name"
);
80
if
(
compiler
.Recurse())
81
{
82
CompileTemplate
(
compiler
);
83
compiler
.ToParent();
84
if
(
selectKey
!= -1 &&
containedActions
!=
null
)
85
{
86
throw
XsltException
.
Create
(
System
.
SR
.
Xslt_VariableCntSel2
,
nameStr
);
87
}
88
}
89
if
(
containedActions
!=
null
)
90
{
91
baseUri
=
baseUri
+
"#"
+
compiler
.GetUnicRtfId();
92
}
93
else
94
{
95
baseUri
=
null
;
96
}
97
_varKey
=
compiler
.InsertVariable(
this
);
98
}
99
100
internal
override
bool
CompileAttribute
(
Compiler
compiler
)
101
{
102
string
localName =
compiler
.Input.LocalName;
103
string
value
=
compiler
.Input.Value;
104
if
(
Ref
.
Equal
(localName,
compiler
.Atoms.Name))
105
{
106
nameStr
=
value
;
107
name
=
compiler
.CreateXPathQName(
nameStr
);
108
}
109
else
110
{
111
if
(!
Ref
.
Equal
(localName,
compiler
.Atoms.Select))
112
{
113
return
false
;
114
}
115
selectKey
=
compiler
.AddQuery(
value
);
116
}
117
return
true
;
118
}
119
120
internal
override
void
Execute
(
Processor
processor
,
ActionFrame
frame)
121
{
122
object
obj
=
null
;
123
switch
(frame.
State
)
124
{
125
default
:
126
return
;
127
case
0:
128
{
129
if
(
IsGlobal
)
130
{
131
if
(frame.
GetVariable
(
_varKey
) !=
null
)
132
{
133
frame.
Finished
();
134
return
;
135
}
136
frame.
SetVariable
(
_varKey
,
BeingComputedMark
);
137
}
138
if
(
varType
==
VariableType
.GlobalParameter)
139
{
140
obj
=
processor
.GetGlobalParameter(
name
);
141
}
142
else
if
(
varType
==
VariableType
.LocalParameter)
143
{
144
obj
=
processor
.GetParameter(
name
);
145
}
146
if
(
obj
!=
null
)
147
{
148
break
;
149
}
150
if
(
selectKey
!= -1)
151
{
152
obj
=
processor
.RunQuery(frame,
selectKey
);
153
break
;
154
}
155
if
(
containedActions
==
null
)
156
{
157
obj
=
string
.Empty;
158
break
;
159
}
160
NavigatorOutput
output
=
new
NavigatorOutput
(
baseUri
);
161
processor
.PushOutput(
output
);
162
processor
.PushActionFrame(frame);
163
frame.State
= 1;
164
return
;
165
}
166
case
1:
167
{
168
IRecordOutput
recordOutput
=
processor
.PopOutput();
169
obj
= ((
NavigatorOutput
)
recordOutput
).Navigator;
170
break
;
171
}
172
case
2:
173
break
;
174
}
175
frame.
SetVariable
(
_varKey
,
obj
);
176
frame.
Finished
();
177
}
178
179
object
IXsltContextVariable
.
Evaluate
(
XsltContext
xsltContext)
180
{
181
return
((
XsltCompileContext
)xsltContext).EvaluateVariable(
this
);
182
}
183
}
System.SR.Xslt_VariableCntSel2
static string Xslt_VariableCntSel2
Definition
SR.cs:1894
System.SR
Definition
SR.cs:7
System.Xml.Ref.Equal
static bool Equal(string strA, string strB)
Definition
Ref.cs:5
System.Xml.Ref
Definition
Ref.cs:4
System.Xml.XmlQualifiedName
Definition
XmlQualifiedName.cs:6
System.Xml.Xsl.XsltContext
Definition
XsltContext.cs:6
System.Xml.Xsl.XsltException.Create
static XsltException Create(string res, params string[] args)
Definition
XsltException.cs:87
System.Xml.Xsl.XsltException
Definition
XsltException.cs:12
System.Xml.Xsl.XsltOld.ActionFrame.SetVariable
void SetVariable(int index, object value)
Definition
ActionFrame.cs:139
System.Xml.Xsl.XsltOld.ActionFrame.State
int State
Definition
ActionFrame.cs:78
System.Xml.Xsl.XsltOld.ActionFrame.GetVariable
object GetVariable(int index)
Definition
ActionFrame.cs:134
System.Xml.Xsl.XsltOld.ActionFrame.Finished
void Finished()
Definition
ActionFrame.cs:209
System.Xml.Xsl.XsltOld.ActionFrame
Definition
ActionFrame.cs:10
System.Xml.Xsl.XsltOld.CompiledAction.CompileAttributes
void CompileAttributes(Compiler compiler)
Definition
CompiledAction.cs:14
System.Xml.Xsl.XsltOld.CompiledAction.CheckRequiredAttribute
void CheckRequiredAttribute(Compiler compiler, object attrValue, string attrName)
Definition
CompiledAction.cs:77
System.Xml.Xsl.XsltOld.Compiler
Definition
Compiler.cs:15
System.Xml.Xsl.XsltOld.ContainerAction.containedActions
ArrayList containedActions
Definition
ContainerAction.cs:11
System.Xml.Xsl.XsltOld.ContainerAction.CompileTemplate
void CompileTemplate(Compiler compiler)
Definition
ContainerAction.cs:531
System.Xml.Xsl.XsltOld.ContainerAction
Definition
ContainerAction.cs:10
System.Xml.Xsl.XsltOld.NavigatorOutput
Definition
NavigatorOutput.cs:6
System.Xml.Xsl.XsltOld.Processor
Definition
Processor.cs:14
System.Xml.Xsl.XsltOld.VariableAction.name
XmlQualifiedName name
Definition
VariableAction.cs:9
System.Xml.Xsl.XsltOld.VariableAction.IsGlobal
bool IsGlobal
Definition
VariableAction.cs:32
System.Xml.Xsl.XsltOld.VariableAction.VarKey
int VarKey
Definition
VariableAction.cs:29
System.Xml.Xsl.XsltOld.VariableAction.Compile
override void Compile(Compiler compiler)
Definition
VariableAction.cs:74
System.Xml.Xsl.XsltOld.VariableAction.Execute
override void Execute(Processor processor, ActionFrame frame)
Definition
VariableAction.cs:120
System.Xml.Xsl.XsltOld.VariableAction.stylesheetid
int stylesheetid
Definition
VariableAction.cs:17
System.Xml.Xsl.XsltOld.VariableAction.BeingComputedMark
static object BeingComputedMark
Definition
VariableAction.cs:7
System.Xml.Xsl.XsltOld.VariableAction.Stylesheetid
int Stylesheetid
Definition
VariableAction.cs:23
System.Xml.Xsl.XsltOld.VariableAction.CompileAttribute
override bool CompileAttribute(Compiler compiler)
Definition
VariableAction.cs:100
System.Xml.Xsl.XsltOld.VariableAction.Name
XmlQualifiedName Name
Definition
VariableAction.cs:25
System.Xml.Xsl.XsltOld.VariableAction.baseUri
string baseUri
Definition
VariableAction.cs:13
System.Xml.Xsl.XsltOld.VariableAction._varKey
int _varKey
Definition
VariableAction.cs:21
System.Xml.Xsl.XsltOld.VariableAction.NameStr
string NameStr
Definition
VariableAction.cs:27
System.Xml.Xsl.XsltOld.VariableAction.varType
VariableType varType
Definition
VariableAction.cs:19
System.Xml.Xsl.XsltOld.VariableAction.selectKey
int selectKey
Definition
VariableAction.cs:15
System.Xml.Xsl.XsltOld.VariableAction.nameStr
string nameStr
Definition
VariableAction.cs:11
System.Xml.Xsl.XsltOld.VariableAction.VariableAction
VariableAction(VariableType type)
Definition
VariableAction.cs:69
System.Xml.Xsl.XsltOld.VariableAction
Definition
VariableAction.cs:6
System.Xml.Xsl.XsltOld.XsltCompileContext
Definition
XsltCompileContext.cs:12
System.Xml.Xsl.IXsltContextVariable.Evaluate
object Evaluate(XsltContext xsltContext)
System.Xml.Xsl.IXsltContextVariable
Definition
IXsltContextVariable.cs:6
System.Xml.Xsl.XsltOld.IRecordOutput
Definition
IRecordOutput.cs:4
System.Xml.XPath.XPathResultType
XPathResultType
Definition
XPathResultType.cs:4
System.Xml.XPath
Definition
Extensions.cs:5
System.Xml.Xsl.XsltOld.VariableType
VariableType
Definition
VariableType.cs:4
System.Xml.Xsl.XsltOld
Definition
IXsltDebugger.cs:1
System.Xml.ValueHandleType.Dictionary
@ Dictionary
System.ExceptionArgument.value
@ value
System.ExceptionArgument.type
@ type
System.ExceptionArgument.obj
@ obj
System
Definition
BlockingCollection.cs:8
source
System.Private.Xml
System.Xml.Xsl.XsltOld
VariableAction.cs
Generated by
1.10.0