Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
XmlQualifiedNameTest.cs
Go to the documentation of this file.
1namespace System.Xml.Xsl;
2
4{
5 private readonly bool _exclude;
6
7 private static readonly XmlQualifiedNameTest s_wc = New("*", "*");
8
10
11 public bool IsWildcard => (object)this == Wildcard;
12
13 public bool IsNameWildcard => (object)base.Name == "*";
14
15 public bool IsNamespaceWildcard => (object)base.Namespace == "*";
16
17 private XmlQualifiedNameTest(string name, string ns, bool exclude)
18 : base(name, ns)
19 {
21 }
22
23 public static XmlQualifiedNameTest New(string name, string ns)
24 {
25 if (ns == null && name == null)
26 {
27 return Wildcard;
28 }
29 return new XmlQualifiedNameTest((name == null) ? "*" : name, (ns == null) ? "*" : ns, exclude: false);
30 }
31
33 {
34 if (!other.IsNameWildcard)
35 {
36 return base.Name == other.Name;
37 }
38 return true;
39 }
40
42 {
43 if (!other.IsNamespaceWildcard && (_exclude != other._exclude || !(base.Namespace == other.Namespace)))
44 {
45 if (other._exclude && !_exclude)
46 {
47 return base.Namespace != other.Namespace;
48 }
49 return false;
50 }
51 return true;
52 }
53
55 {
57 {
59 }
60 return false;
61 }
62
64 {
65 if (IsNamespaceSubsetOf(other) || other.IsNamespaceSubsetOf(this))
66 {
68 {
69 return other.IsNameSubsetOf(this);
70 }
71 return true;
72 }
73 return false;
74 }
75
76 public override string ToString()
77 {
78 if ((object)this == Wildcard)
79 {
80 return "*";
81 }
82 if (base.Namespace.Length == 0)
83 {
84 return base.Name;
85 }
86 if ((object)base.Namespace == "*")
87 {
88 return "*:" + base.Name;
89 }
90 if (_exclude)
91 {
92 return "{~" + base.Namespace + "}:" + base.Name;
93 }
94 return "{" + base.Namespace + "}:" + base.Name;
95 }
96}
bool IsNamespaceSubsetOf(XmlQualifiedNameTest other)
bool HasIntersection(XmlQualifiedNameTest other)
static readonly XmlQualifiedNameTest s_wc
static XmlQualifiedNameTest New(string name, string ns)
bool IsNameSubsetOf(XmlQualifiedNameTest other)
static XmlQualifiedNameTest Wildcard
bool IsSubsetOf(XmlQualifiedNameTest other)
XmlQualifiedNameTest(string name, string ns, bool exclude)