Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
VariableQuery.cs
Go to the documentation of this file.
1using System;
4
6
7internal sealed class VariableQuery : ExtensionQuery
8{
10
12 {
13 get
14 {
15 if (_variable != null)
16 {
17 return GetXPathType(Evaluate(null));
18 }
19 XPathResultType xPathResultType = ((_variable != null) ? _variable.VariableType : XPathResultType.Any);
20 if (xPathResultType == XPathResultType.Error)
21 {
22 xPathResultType = XPathResultType.Any;
23 }
24 return xPathResultType;
25 }
26 }
27
28 public VariableQuery(string name, string prefix)
29 : base(prefix, name)
30 {
31 }
32
34 : base(other)
35 {
36 _variable = other._variable;
37 }
38
39 public override void SetXsltContext(XsltContext context)
40 {
41 if (context == null)
42 {
44 }
45 if (xsltContext != context)
46 {
47 xsltContext = context;
49 if (_variable == null)
50 {
51 throw XPathException.Create(System.SR.Xp_UndefVar, base.QName);
52 }
53 }
54 }
55
56 public override object Evaluate(XPathNodeIterator nodeIterator)
57 {
58 if (xsltContext == null)
59 {
61 }
63 }
64
65 public override XPathNodeIterator Clone()
66 {
67 return new VariableQuery(this);
68 }
69}
XPathResultType GetXPathType(object value)
Definition Query.cs:147
override XPathResultType StaticType
VariableQuery(string name, string prefix)
override XPathNodeIterator Clone()
override object Evaluate(XPathNodeIterator nodeIterator)
override void SetXsltContext(XsltContext context)
static string Xp_UndefVar
Definition SR.cs:1258
static string Xp_NoContext
Definition SR.cs:1256
Definition SR.cs:7
static XPathException Create(string res)
IXsltContextVariable ResolveVariable(string prefix, string name)
object Evaluate(XsltContext xsltContext)