Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
XmlQueryCardinality.cs
Go to the documentation of this file.
2using System.IO;
3
4namespace System.Xml.Xsl;
5
6internal struct XmlQueryCardinality
7{
8 private readonly int _value;
9
21
33
34 private static readonly string[] s_toString = new string[8] { "", "?", "", "?", "+", "*", "+", "*" };
35
36 private static readonly string[] s_serialized = new string[8] { "None", "Zero", "One", "ZeroOrOne", "More", "NotOne", "OneOrMore", "ZeroOrMore" };
37
39
41
43
45
47
49
51
53
55 {
56 _value = value;
57 }
58
60 {
61 return _value == other._value;
62 }
63
64 public static bool operator ==(XmlQueryCardinality left, XmlQueryCardinality right)
65 {
66 return left._value == right._value;
67 }
68
69 public static bool operator !=(XmlQueryCardinality left, XmlQueryCardinality right)
70 {
71 return left._value != right._value;
72 }
73
74 public override bool Equals([NotNullWhen(true)] object other)
75 {
77 {
79 }
80 return false;
81 }
82
83 public override int GetHashCode()
84 {
85 return _value;
86 }
87
89 {
90 return new XmlQueryCardinality(left._value | right._value);
91 }
92
94 {
95 return s_cardinalityProduct[left._value, right._value];
96 }
97
99 {
100 return s_cardinalitySum[left._value, right._value];
101 }
102
104 {
105 return (left._value & ~right._value) == 0;
106 }
107
109 {
110 return (right._value & ~left._value) == 0;
111 }
112
114 {
115 return new XmlQueryCardinality(_value | (_value >> 1) | (_value >> 2));
116 }
117
119 {
120 if (_value != 0)
121 {
122 return (_value & other._value) == 0;
123 }
124 return false;
125 }
126
127 public string ToString(string format)
128 {
129 if (format == "S")
130 {
131 return s_serialized[_value];
132 }
133 return ToString();
134 }
135
136 public override string ToString()
137 {
138 return s_toString[_value];
139 }
140
142 {
143 writer.Write((byte)_value);
144 }
145
147 : this(reader.ReadByte())
148 {
149 }
150}
void GetObjectData(BinaryWriter writer)
static bool operator!=(XmlQueryCardinality left, XmlQueryCardinality right)
bool Equals(XmlQueryCardinality other)
static XmlQueryCardinality operator+(XmlQueryCardinality left, XmlQueryCardinality right)
static XmlQueryCardinality operator*(XmlQueryCardinality left, XmlQueryCardinality right)
static XmlQueryCardinality ZeroOrOne
bool NeverSubset(XmlQueryCardinality other)
static XmlQueryCardinality operator|(XmlQueryCardinality left, XmlQueryCardinality right)
static XmlQueryCardinality OneOrMore
static XmlQueryCardinality ZeroOrMore
static bool operator==(XmlQueryCardinality left, XmlQueryCardinality right)
static bool operator<=(XmlQueryCardinality left, XmlQueryCardinality right)
override bool Equals([NotNullWhen(true)] object other)
static readonly string[] s_serialized
static readonly XmlQueryCardinality[,] s_cardinalityProduct
static readonly XmlQueryCardinality[,] s_cardinalitySum
static bool operator>=(XmlQueryCardinality left, XmlQueryCardinality right)
static XmlQueryCardinality NotOne