Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
NamespaceResolver.cs
Go to the documentation of this file.
1namespace System.Xml.Linq;
2
3internal struct NamespaceResolver
4{
5 private sealed class NamespaceDeclaration
6 {
7 public string prefix;
8
9 public XNamespace ns;
10
11 public int scope;
12
14 }
15
16 private int _scope;
17
19
21
22 public void PushScope()
23 {
24 _scope++;
25 }
26
27 public void PopScope()
28 {
30 if (namespaceDeclaration != null)
31 {
32 do
33 {
35 if (namespaceDeclaration.scope != _scope)
36 {
37 break;
38 }
40 {
41 _declaration = null;
42 }
43 else
44 {
46 }
47 _rover = null;
48 }
50 }
51 _scope--;
52 }
53
71
90
92 {
93 if (_rover != null && _rover.ns == ns && (allowDefaultNamespace || _rover.prefix.Length > 0))
94 {
95 return _rover.prefix;
96 }
98 if (namespaceDeclaration != null)
99 {
100 do
101 {
103 if (!(namespaceDeclaration.ns == ns))
104 {
105 continue;
106 }
108 while (prev != namespaceDeclaration && prev.prefix != namespaceDeclaration.prefix)
109 {
110 prev = prev.prev;
111 }
112 if (prev == namespaceDeclaration)
113 {
115 {
118 }
119 if (namespaceDeclaration.prefix.Length > 0)
120 {
121 return namespaceDeclaration.prefix;
122 }
123 }
124 }
126 }
127 return null;
128 }
129}
string GetPrefixOfNamespace(XNamespace ns, bool allowDefaultNamespace)
void AddFirst(string prefix, XNamespace ns)
void Add(string prefix, XNamespace ns)