Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
XPathAncestorQuery.cs
Go to the documentation of this file.
2
4
5internal sealed class XPathAncestorQuery : CacheAxisQuery
6{
7 private readonly bool _matchSelf;
8
9 public override int CurrentPosition => outputBuffer.Count - count + 1;
10
11 public override QueryProps Properties => base.Properties | QueryProps.Reverse;
12
13 public XPathAncestorQuery(Query qyInput, string name, string prefix, XPathNodeType typeTest, bool matchSelf)
14 : base(qyInput, name, prefix, typeTest)
15 {
16 _matchSelf = matchSelf;
17 }
18
20 : base(other)
21 {
22 _matchSelf = other._matchSelf;
23 }
24
25 public override object Evaluate(XPathNodeIterator context)
26 {
27 base.Evaluate(context);
28 XPathNavigator xPathNavigator = null;
29 XPathNavigator xPathNavigator2;
30 while ((xPathNavigator2 = qyInput.Advance()) != null)
31 {
32 if (!_matchSelf || !matches(xPathNavigator2) || Query.Insert(outputBuffer, xPathNavigator2))
33 {
34 if (xPathNavigator == null || !xPathNavigator.MoveTo(xPathNavigator2))
35 {
36 xPathNavigator = xPathNavigator2.Clone();
37 }
38 while (xPathNavigator.MoveToParent() && (!matches(xPathNavigator) || Query.Insert(outputBuffer, xPathNavigator)))
39 {
40 }
41 }
42 }
43 return this;
44 }
45
46 public override XPathNodeIterator Clone()
47 {
48 return new XPathAncestorQuery(this);
49 }
50}
virtual bool matches(XPathNavigator e)
List< XPathNavigator > outputBuffer
XPathNavigator Advance()
static bool Insert(List< XPathNavigator > buffer, XPathNavigator nav)
Definition Query.cs:87
override object Evaluate(XPathNodeIterator context)
XPathAncestorQuery(Query qyInput, string name, string prefix, XPathNodeType typeTest, bool matchSelf)
bool MoveTo(XPathNavigator other)