Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
AllElementsContentValidator.cs
Go to the documentation of this file.
2
3namespace System.Xml.Schema;
4
6{
7 private readonly Hashtable _elements;
8
9 private readonly object[] _particles;
10
11 private readonly BitSet _isRequired;
12
13 private int _countRequired;
14
15 public override bool IsEmptiable
16 {
17 get
18 {
19 if (!base.IsEmptiable)
20 {
21 return _countRequired == 0;
22 }
23 return true;
24 }
25 }
26
29 {
30 _elements = new Hashtable(size);
31 _particles = new object[size];
32 _isRequired = new BitSet(size);
33 }
34
35 public bool AddElement(XmlQualifiedName name, object particle, bool isEmptiable)
36 {
37 if (_elements[name] != null)
38 {
39 return false;
40 }
41 int count = _elements.Count;
42 _elements.Add(name, count);
43 _particles[count] = particle;
44 if (!isEmptiable)
45 {
48 }
49 return true;
50 }
51
57
58 public override object ValidateElement(XmlQualifiedName name, ValidationState context, out int errorCode)
59 {
60 object obj = _elements[name];
61 errorCode = 0;
62 if (obj == null)
63 {
65 return null;
66 }
67 int num = (int)obj;
68 if (context.AllElementsSet[num])
69 {
70 errorCode = -2;
71 return null;
72 }
73 if (context.CurrentState.AllElementsRequired == -1)
74 {
76 }
77 context.AllElementsSet.Set(num);
78 if (_isRequired[num])
79 {
81 }
82 return _particles[num];
83 }
84
85 public override bool CompleteValidation(ValidationState context)
86 {
88 {
89 return true;
90 }
91 return false;
92 }
93
95 {
96 ArrayList arrayList = null;
97 foreach (DictionaryEntry element in _elements)
98 {
99 if (!context.AllElementsSet[(int)element.Value] && (!isRequiredOnly || _isRequired[(int)element.Value]))
100 {
101 if (arrayList == null)
102 {
103 arrayList = new ArrayList();
104 }
105 arrayList.Add(element.Key);
106 }
107 }
108 return arrayList;
109 }
110
112 {
114 foreach (DictionaryEntry element in _elements)
115 {
116 if (!context.AllElementsSet[(int)element.Value] && (!isRequiredOnly || _isRequired[(int)element.Value]))
117 {
119 }
120 }
121 return arrayList;
122 }
123}
virtual void Add(object key, object? value)
Definition Hashtable.cs:676
override void InitValidation(ValidationState context)
override bool CompleteValidation(ValidationState context)
bool AddElement(XmlQualifiedName name, object particle, bool isEmptiable)
override ArrayList ExpectedParticles(ValidationState context, bool isRequiredOnly, XmlSchemaSet schemaSet)
override ArrayList ExpectedElements(ValidationState context, bool isRequiredOnly)
AllElementsContentValidator(XmlSchemaContentType contentType, int size, bool isEmptiable)
override object ValidateElement(XmlQualifiedName name, ValidationState context, out int errorCode)
void Set(int index)
Definition BitSet.cs:50
static void AddParticleToExpected(XmlSchemaParticle p, XmlSchemaSet schemaSet, ArrayList particles)