Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ExtensionQuery.cs
Go to the documentation of this file.
1using System;
4
6
7internal abstract class ExtensionQuery : Query
8{
9 protected string prefix;
10
11 protected string name;
12
14
16
17 public override XPathNavigator Current
18 {
19 get
20 {
21 if (_queryIterator == null)
22 {
24 }
26 {
27 Advance();
28 }
30 }
31 }
32
33 public override int CurrentPosition
34 {
35 get
36 {
37 if (_queryIterator != null)
38 {
40 }
41 return 0;
42 }
43 }
44
45 protected string QName
46 {
47 get
48 {
49 if (prefix.Length == 0)
50 {
51 return name;
52 }
53 return prefix + ":" + name;
54 }
55 }
56
57 public override int Count
58 {
59 get
60 {
61 if (_queryIterator != null)
62 {
63 return _queryIterator.Count;
64 }
65 return 1;
66 }
67 }
68
70
71 public ExtensionQuery(string prefix, string name)
72 {
73 this.prefix = prefix;
74 this.name = name;
75 }
76
78 : base(other)
79 {
80 prefix = other.prefix;
81 name = other.name;
82 xsltContext = other.xsltContext;
84 }
85
86 public override void Reset()
87 {
88 if (_queryIterator != null)
89 {
91 }
92 }
93
94 public override XPathNavigator Advance()
95 {
96 if (_queryIterator == null)
97 {
99 }
101 {
102 return _queryIterator.Current;
103 }
104 return null;
105 }
106
107 protected object ProcessResult(object value)
108 {
109 if (value is string)
110 {
111 return value;
112 }
113 if (value is double)
114 {
115 return value;
116 }
117 if (value is bool)
118 {
119 return value;
120 }
121 if (value is XPathNavigator)
122 {
123 return value;
124 }
125 if (value is int)
126 {
127 return (double)(int)value;
128 }
129 if (value == null)
130 {
132 return this;
133 }
134 if (value is ResetableIterator resetableIterator)
135 {
136 _queryIterator = (ResetableIterator)resetableIterator.Clone();
137 return this;
138 }
139 if (value is XPathNodeIterator nodeIterator)
140 {
141 _queryIterator = new XPathArrayIterator(nodeIterator);
142 return this;
143 }
144 if (value is IXPathNavigable iXPathNavigable)
145 {
146 return iXPathNavigable.CreateNavigator();
147 }
148 if (value is short)
149 {
150 return (double)(short)value;
151 }
152 if (value is long)
153 {
154 return (double)(long)value;
155 }
156 if (value is uint)
157 {
158 return (double)(uint)value;
159 }
160 if (value is ushort)
161 {
162 return (double)(int)(ushort)value;
163 }
164 if (value is ulong)
165 {
166 return (double)(ulong)value;
167 }
168 if (value is float)
169 {
170 return (double)(float)value;
171 }
172 if (value is decimal)
173 {
174 return (double)(decimal)value;
175 }
176 return value.ToString();
177 }
178}
ExtensionQuery(string prefix, string name)
override XPathNavigator Advance()
override XPathResultType StaticType
static Query Clone(Query input)
Definition Query.cs:66
static string Xp_NodeSetExpected
Definition SR.cs:1244
Definition SR.cs:7
static XPathException Create(string res)