Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
CompiledXpathExpr.cs
Go to the documentation of this file.
1using System;
3using System.Xml;
6
8
10{
11 private sealed class UndefinedXsltContext : XsltContext
12 {
14
15 public override string DefaultNamespace => string.Empty;
16
17 public override bool Whitespace => false;
18
24
25 public override string LookupNamespace(string prefix)
26 {
27 if (prefix.Length == 0)
28 {
29 return string.Empty;
30 }
32 if (text == null)
33 {
35 }
36 return text;
37 }
38
39 public override IXsltContextVariable ResolveVariable(string prefix, string name)
40 {
42 }
43
44 public override IXsltContextFunction ResolveFunction(string prefix, string name, XPathResultType[] ArgTypes)
45 {
47 }
48
50 {
51 return false;
52 }
53
54 public override int CompareDocument(string baseUri, string nextbaseUri)
55 {
56 return string.CompareOrdinal(baseUri, nextbaseUri);
57 }
58 }
59
60 private Query _query;
61
62 private readonly string _expr;
63
64 private bool _needContext;
65
67 {
68 get
69 {
70 if (_needContext)
71 {
73 }
74 return _query;
75 }
76 }
77
78 public override string Expression => _expr;
79
81
88
89 public virtual void CheckErrors()
90 {
91 }
92
93 public override void AddSort(object expr, IComparer comparer)
94 {
96 if (expr is string query)
97 {
99 }
100 else
101 {
103 {
105 }
106 evalQuery = compiledXpathExpr.QueryTree;
107 }
109 if (sortQuery == null)
110 {
112 }
114 }
115
116 public override void AddSort(object expr, XmlSortOrder order, XmlCaseOrder caseOrder, string lang, XmlDataType dataType)
117 {
118 AddSort(expr, new XPathComparerHelper(order, caseOrder, lang, dataType));
119 }
120
121 public override XPathExpression Clone()
122 {
124 }
125
130
132 {
133 XsltContext xsltContext = nsResolver as XsltContext;
134 if (xsltContext == null)
135 {
136 if (nsResolver == null)
137 {
139 }
140 xsltContext = new UndefinedXsltContext(nsResolver);
141 }
142 _query.SetXsltContext(xsltContext);
143 _needContext = false;
144 }
145}
override IXsltContextVariable ResolveVariable(string prefix, string name)
override int CompareDocument(string baseUri, string nextbaseUri)
override IXsltContextFunction ResolveFunction(string prefix, string name, XPathResultType[] ArgTypes)
CompiledXpathExpr(Query query, string expression, bool needContext)
override void SetContext(IXmlNamespaceResolver nsResolver)
override void AddSort(object expr, XmlSortOrder order, XmlCaseOrder caseOrder, string lang, XmlDataType dataType)
override void AddSort(object expr, IComparer comparer)
override void SetContext(XmlNamespaceManager nsManager)
Query Build(AstNode root, string query)
virtual void SetXsltContext(XsltContext context)
Definition Query.cs:52
XPathResultType StaticType
Definition Query.cs:34
static Query Clone(Query input)
Definition Query.cs:66
void AddSort(Query evalQuery, IComparer comparer)
Definition SortQuery.cs:102
static string Xp_UndefinedXsltContext
Definition SR.cs:1254
static string Xp_BadQueryObject
Definition SR.cs:1252
static string XmlUndefinedAlias
Definition SR.cs:1640
static string Xp_NoContext
Definition SR.cs:1256
Definition SR.cs:7
static XPathException Create(string res)
string? LookupNamespace(string prefix)