Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ForEachAction.cs
Go to the documentation of this file.
2
4
6{
7 private int _selectKey = -1;
8
10
11 internal override void Compile(Compiler compiler)
12 {
16 if (compiler.Recurse())
17 {
20 compiler.ToParent();
21 }
22 }
23
24 internal override bool CompileAttribute(Compiler compiler)
25 {
26 string localName = compiler.Input.LocalName;
27 string value = compiler.Input.Value;
28 if (Ref.Equal(localName, compiler.Atoms.Select))
29 {
30 _selectKey = compiler.AddQuery(value);
31 return true;
32 }
33 return false;
34 }
35
36 internal override void Execute(Processor processor, ActionFrame frame)
37 {
38 switch (frame.State)
39 {
40 default:
41 return;
42 case 0:
43 if (_sortContainer != null)
44 {
45 processor.InitSortArray();
46 processor.PushActionFrame(_sortContainer, frame.NodeSet);
47 frame.State = 2;
48 return;
49 }
50 goto case 2;
51 case 2:
52 frame.InitNewNodeSet(processor.StartQuery(frame.NodeSet, _selectKey));
53 if (_sortContainer != null)
54 {
55 frame.SortNewNodeSet(processor, processor.SortArray);
56 }
57 frame.State = 3;
58 goto case 3;
59 case 3:
60 if (frame.NewNextNode(processor))
61 {
62 frame.State = 4;
63 break;
64 }
65 frame.Finished();
66 return;
67 case 4:
68 break;
69 case 5:
70 frame.State = 3;
71 goto case 3;
72 case 1:
73 return;
74 }
75 processor.PushActionFrame(frame, frame.NewNodeSet);
76 frame.State = 5;
77 }
78
80 {
82 do
83 {
84 switch (input.NodeType)
85 {
86 case XPathNodeType.Element:
87 if (Ref.Equal(input.NamespaceURI, input.Atoms.UriXsl) && Ref.Equal(input.LocalName, input.Atoms.Sort))
88 {
89 if (_sortContainer == null)
90 {
92 }
93 _sortContainer.AddAction(compiler.CreateSortAction());
94 break;
95 }
96 return;
97 case XPathNodeType.Text:
98 return;
99 case XPathNodeType.SignificantWhitespace:
100 AddEvent(compiler.CreateTextEvent());
101 break;
102 }
103 }
104 while (input.Advance());
105 }
106}
static bool Equal(string strA, string strB)
Definition Ref.cs:5
void SortNewNodeSet(Processor proc, ArrayList sortarray)
bool NewNextNode(Processor proc)
void InitNewNodeSet(XPathNodeIterator nodeSet)
void CompileAttributes(Compiler compiler)
void CheckRequiredAttribute(Compiler compiler, object attrValue, string attrName)
override void Execute(Processor processor, ActionFrame frame)
override bool CompileAttribute(Compiler compiler)
void CompileSortElements(Compiler compiler)
override void Compile(Compiler compiler)