Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
XPathQilFactory.cs
Go to the documentation of this file.
4
6
8{
10 : base(f, debug)
11 {
12 }
13
14 public QilNode Error(string res, QilNode args)
15 {
17 }
18
19 public QilNode Error(ISourceLineInfo lineInfo, string res, params string[] args)
20 {
22 }
23
29
30 public bool IsAnyType(QilNode n)
31 {
32 XmlQueryType xmlType = n.XmlType;
33 return !xmlType.IsStrict && !xmlType.IsNode;
34 }
35
37 {
38 XmlQueryType xmlType = n.XmlType;
39 if (xmlType.IsAtomicValue && !xmlType.IsEmpty)
40 {
41 return !(n is QilIterator);
42 }
43 return false;
44 }
45
47 {
48 XmlQueryType xmlType = n.XmlType;
49 if (xmlType.MaybeMany)
50 {
51 if (xmlType.IsNode && xmlType.IsNotRtf)
52 {
53 return DocOrderDistinct(n);
54 }
56 if (!xmlType.IsAtomicValue)
57 {
59 }
60 }
61 return n;
62 }
63
68
70 {
72 right = TypeAssert(right, XmlQueryTypeFactory.ItemS);
73 double num = ((op != QilNodeType.Eq) ? 1.0 : 0.0);
74 double val = num;
76 {
77 Double(val),
78 left,
79 right
80 });
81 }
82
84 {
86 right = TypeAssert(right, XmlQueryTypeFactory.ItemS);
87 double val = op switch
88 {
89 QilNodeType.Lt => 2.0,
90 QilNodeType.Le => 3.0,
91 QilNodeType.Gt => 4.0,
92 _ => 5.0,
93 };
95 {
96 Double(val),
97 left,
98 right
99 });
100 }
101
114
116 {
117 switch (n.XmlType.TypeCode)
118 {
119 case XmlTypeCode.Boolean:
120 if (n.NodeType != QilNodeType.True)
121 {
122 if (n.NodeType != QilNodeType.False)
123 {
124 return Conditional(n, String("true"), String("false"));
125 }
126 return String("false");
127 }
128 return String("true");
129 case XmlTypeCode.Double:
130 if (n.NodeType != QilNodeType.LiteralDouble)
131 {
133 }
135 case XmlTypeCode.String:
136 return n;
137 default:
138 if (n.XmlType.IsNode)
139 {
141 }
143 }
144 }
145
147 {
148 switch (n.XmlType.TypeCode)
149 {
150 case XmlTypeCode.Boolean:
151 return n;
152 case XmlTypeCode.Double:
153 {
155 if (n.NodeType != QilNodeType.LiteralDouble)
156 {
157 return Loop(qilIterator = Let(n), Or(Lt(qilIterator, Double(0.0)), Lt(Double(0.0), qilIterator)));
158 }
159 return Boolean((double)(QilLiteral)n < 0.0 || 0.0 < (double)(QilLiteral)n);
160 }
161 case XmlTypeCode.String:
162 if (n.NodeType != QilNodeType.LiteralString)
163 {
164 return Ne(StrLength(n), Int32(0));
165 }
166 return Boolean(((string)(QilLiteral)n).Length != 0);
167 default:
168 if (n.XmlType.IsNode)
169 {
170 return Not(IsEmpty(n));
171 }
173 }
174 }
175
177 {
178 switch (n.XmlType.TypeCode)
179 {
180 case XmlTypeCode.Boolean:
181 if (n.NodeType != QilNodeType.True)
182 {
183 if (n.NodeType != QilNodeType.False)
184 {
185 return Conditional(n, Double(1.0), Double(0.0));
186 }
187 return Double(0.0);
188 }
189 return Double(1.0);
190 case XmlTypeCode.Double:
191 return n;
192 case XmlTypeCode.String:
194 default:
195 if (n.XmlType.IsNode)
196 {
198 }
200 }
201 }
202
204 {
205 if (n.XmlType.IsNode && n.XmlType.IsNotRtf && n.XmlType.IsSingleton)
206 {
207 return n;
208 }
210 }
211
213 {
214 if (n.XmlType.IsNode && n.XmlType.IsNotRtf)
215 {
216 return n;
217 }
219 }
220
222 {
223 if (n.XmlType.IsNode && n.XmlType.IsNotRtf)
224 {
225 return n;
226 }
227 if (CannotBeNodeSet(n))
228 {
229 return null;
230 }
231 return InvokeEnsureNodeSet(n);
232 }
233
235 {
237 if (qilNode == null)
238 {
240 }
241 return qilNode;
242 }
243
248
249 public QilNode Id(QilNode context, QilNode id)
250 {
251 if (id.XmlType.IsSingleton)
252 {
253 return Deref(context, ConvertToString(id));
254 }
256 return Loop(n = For(id), Deref(context, ConvertToString(n)));
257 }
258
260 {
261 return XsltInvokeEarlyBound(QName("starts-with"), XsltMethods.StartsWith, XmlQueryTypeFactory.BooleanX, new QilNode[2] { str1, str2 });
262 }
263
265 {
266 return XsltInvokeEarlyBound(QName("contains"), XsltMethods.Contains, XmlQueryTypeFactory.BooleanX, new QilNode[2] { str1, str2 });
267 }
268
270 {
271 return XsltInvokeEarlyBound(QName("substring-before"), XsltMethods.SubstringBefore, XmlQueryTypeFactory.StringX, new QilNode[2] { str1, str2 });
272 }
273
275 {
276 return XsltInvokeEarlyBound(QName("substring-after"), XsltMethods.SubstringAfter, XmlQueryTypeFactory.StringX, new QilNode[2] { str1, str2 });
277 }
278
280 {
281 return XsltInvokeEarlyBound(QName("substring"), XsltMethods.Substring2, XmlQueryTypeFactory.StringX, new QilNode[2] { str, start });
282 }
283
285 {
286 return XsltInvokeEarlyBound(QName("substring"), XsltMethods.Substring3, XmlQueryTypeFactory.StringX, new QilNode[3] { str, start, length });
287 }
288
293
295 {
296 return XsltInvokeEarlyBound(QName("translate"), XsltMethods.Translate, XmlQueryTypeFactory.StringX, new QilNode[3] { str1, str2, str3 });
297 }
298
299 public QilNode InvokeLang(QilNode lang, QilNode context)
300 {
301 return XsltInvokeEarlyBound(QName("lang"), XsltMethods.Lang, XmlQueryTypeFactory.BooleanX, new QilNode[2] { lang, context });
302 }
303
305 {
307 }
308
310 {
311 return XsltInvokeEarlyBound(QName("ceiling"), XsltMethods.Ceiling, XmlQueryTypeFactory.DoubleX, new QilNode[1] { value });
312 }
313
315 {
317 }
318}
static string XPath_NodeSetExpected
Definition SR.cs:1856
Definition SR.cs:7
static readonly MethodInfo Floor
static readonly MethodInfo Substring2
static readonly MethodInfo RelationalOperator
static readonly MethodInfo NormalizeSpace
static readonly MethodInfo StartsWith
static readonly MethodInfo Lang
static readonly MethodInfo SubstringAfter
static readonly MethodInfo EnsureNodeSet
static readonly MethodInfo SubstringBefore
static readonly MethodInfo EqualityOperator
static readonly MethodInfo Ceiling
static readonly MethodInfo FormatMessage
static readonly MethodInfo Contains
static readonly MethodInfo Round
static readonly MethodInfo Translate
static readonly MethodInfo Substring3
static unsafe string DoubleToString(double dbl)
QilNode InvokeStartsWith(QilNode str1, QilNode str2)
QilNode Error(string res, QilNode args)
QilNode InvokeSubstring(QilNode str, QilNode start)
QilNode InvokeLang(QilNode lang, QilNode context)
QilNode InvokeSubstringBefore(QilNode str1, QilNode str2)
QilNode InvokeFormatMessage(QilNode res, QilNode args)
QilNode InvokeSubstringAfter(QilNode str1, QilNode str2)
QilNode InvokeRelationalOperator(QilNodeType op, QilNode left, QilNode right)
QilNode InvokeEqualityOperator(QilNodeType op, QilNode left, QilNode right)
QilNode Id(QilNode context, QilNode id)
QilNode InvokeContains(QilNode str1, QilNode str2)
QilNode InvokeTranslate(QilNode str1, QilNode str2, QilNode str3)
QilNode InvokeSubstring(QilNode str, QilNode start, QilNode length)
XPathQilFactory(QilFactory f, bool debug)
QilNode Error(ISourceLineInfo lineInfo, string res, params string[] args)
QilNode ConvertToType(XmlTypeCode requiredType, QilNode n)
static readonly XmlQueryType NodeSDod
static readonly XmlQueryType DoubleX
static readonly XmlQueryType StringX
static readonly XmlQueryType NodeNotRtfS
static readonly XmlQueryType ItemS
static readonly XmlQueryType BooleanX
static readonly XmlQueryType NodeNotRtf
static string CreateMessage(ISourceLineInfo lineInfo, string res, params string[] args)