Extended .NET SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
ChangeList.cs
Go to the documentation of this file.
1//------------------------------------------------------------------------------
2// <auto-generated />
3//
4// This file was automatically generated by SWIG (http://www.swig.org).
5// Version 4.0.2
6//
7// Do not make changes to this file unless you know what you are doing--modify
8// the SWIG interface file instead.
9//------------------------------------------------------------------------------
10
11namespace Teigha.TD {
12
13using System;
14using System.Runtime.InteropServices;
15using Teigha.Core;
16
17public class ChangeList : global::System.IDisposable
18 , global::System.Collections.Generic.IDictionary<OdDbHandle, ChangeType>
19 {
20 private Object locker = new Object();
21 private HandleRef swigCPtr;
22 protected bool swigCMemOwn;
23 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
24 public ChangeList(IntPtr cPtr, bool cMemoryOwn) {
25 swigCMemOwn = cMemoryOwn;
26 swigCPtr = new HandleRef(this, cPtr);
27 }
28 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
29 public static HandleRef getCPtr(ChangeList obj) {
30 return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
31 }
32
33 ~ChangeList() {
34 Dispose(false);
35 }
36
37 public void Dispose() {
38 Dispose(true);
39 global::System.GC.SuppressFinalize(this);
40 }
41
42 protected virtual void Dispose(bool disposing) {
43 lock(this) {
44 if (swigCPtr.Handle != global::System.IntPtr.Zero) {
45 if (swigCMemOwn) {
46 swigCMemOwn = false;
48 }
49 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
50 }
51 }
52 }
53
54
55 public ChangeType this[OdDbHandle key] {
56 get {
57 return getitem(key);
58 }
59
60 set {
61 setitem(key, value);
62 }
63 }
64
65 public bool TryGetValue(OdDbHandle key, out ChangeType value) {
66 if (this.ContainsKey(key)) {
67 value = this[key];
68 return true;
69 }
70 value = default(ChangeType);
71 return false;
72 }
73
74 public int Count {
75 get {
76 return (int)size();
77 }
78 }
79
80 public bool IsReadOnly {
81 get {
82 return false;
83 }
84 }
85
86 public global::System.Collections.Generic.ICollection<OdDbHandle> Keys {
87 get {
88 global::System.Collections.Generic.ICollection<OdDbHandle> keys = new global::System.Collections.Generic.List<OdDbHandle>();
89 int size = this.Count;
90 if (size > 0) {
91 global::System.IntPtr iter = create_iterator_begin();
92 for (int i = 0; i < size; i++) {
93 keys.Add(get_next_key(iter));
94 }
95 destroy_iterator(iter);
96 }
97 return keys;
98 }
99 }
100
101 public global::System.Collections.Generic.ICollection<ChangeType> Values {
102 get {
103 global::System.Collections.Generic.ICollection<ChangeType> vals = new global::System.Collections.Generic.List<ChangeType>();
104 foreach (global::System.Collections.Generic.KeyValuePair<OdDbHandle, ChangeType> pair in this) {
105 vals.Add(pair.Value);
106 }
107 return vals;
108 }
109 }
110
111 public void Add(global::System.Collections.Generic.KeyValuePair<OdDbHandle, ChangeType> item) {
112 Add(item.Key, item.Value);
113 }
114
115 public bool Remove(global::System.Collections.Generic.KeyValuePair<OdDbHandle, ChangeType> item) {
116 if (Contains(item)) {
117 return Remove(item.Key);
118 } else {
119 return false;
120 }
121 }
122
123 public bool Contains(global::System.Collections.Generic.KeyValuePair<OdDbHandle, ChangeType> item) {
124 if (this[item.Key] == item.Value) {
125 return true;
126 } else {
127 return false;
128 }
129 }
130
131 public void CopyTo(global::System.Collections.Generic.KeyValuePair<OdDbHandle, ChangeType>[] array) {
132 CopyTo(array, 0);
133 }
134
135 public void CopyTo(global::System.Collections.Generic.KeyValuePair<OdDbHandle, ChangeType>[] array, int arrayIndex) {
136 if (array == null)
137 throw new global::System.ArgumentNullException("array");
138 if (arrayIndex < 0)
139 throw new global::System.ArgumentOutOfRangeException("arrayIndex", "Value is less than zero");
140 if (array.Rank > 1)
141 throw new global::System.ArgumentException("Multi dimensional array.", "array");
142 if (arrayIndex+this.Count > array.Length)
143 throw new global::System.ArgumentException("Number of elements to copy is too large.");
144
145 global::System.Collections.Generic.IList<OdDbHandle> keyList = new global::System.Collections.Generic.List<OdDbHandle>(this.Keys);
146 for (int i = 0; i < keyList.Count; i++) {
147 OdDbHandle currentKey = keyList[i];
148 array.SetValue(new global::System.Collections.Generic.KeyValuePair<OdDbHandle, ChangeType>(currentKey, this[currentKey]), arrayIndex+i);
149 }
150 }
151
152 global::System.Collections.Generic.IEnumerator<global::System.Collections.Generic.KeyValuePair<OdDbHandle, ChangeType>> global::System.Collections.Generic.IEnumerable<global::System.Collections.Generic.KeyValuePair<OdDbHandle, ChangeType>>.GetEnumerator() {
153 return new ChangeListEnumerator(this);
154 }
155
156 global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() {
157 return new ChangeListEnumerator(this);
158 }
159
161 return new ChangeListEnumerator(this);
162 }
163
164 // Type-safe enumerator
169 public class ChangeListEnumerator : global::System.Collections.IEnumerator,
170 global::System.Collections.Generic.IEnumerator<global::System.Collections.Generic.KeyValuePair<OdDbHandle, ChangeType>>
171 {
172 private ChangeList collectionRef;
173 private global::System.Collections.Generic.IList<OdDbHandle> keyCollection;
174 private int currentIndex;
175 private object currentObject;
176 private int currentSize;
177
178 public ChangeListEnumerator(ChangeList collection) {
179 collectionRef = collection;
180 keyCollection = new global::System.Collections.Generic.List<OdDbHandle>(collection.Keys);
181 currentIndex = -1;
182 currentObject = null;
183 currentSize = collectionRef.Count;
184 }
185
186 // Type-safe iterator Current
187 public global::System.Collections.Generic.KeyValuePair<OdDbHandle, ChangeType> Current {
188 get {
189 if (currentIndex == -1)
190 throw new global::System.InvalidOperationException("Enumeration not started.");
191 if (currentIndex > currentSize - 1)
192 throw new global::System.InvalidOperationException("Enumeration finished.");
193 if (currentObject == null)
194 throw new global::System.InvalidOperationException("Collection modified.");
195 return (global::System.Collections.Generic.KeyValuePair<OdDbHandle, ChangeType>)currentObject;
196 }
197 }
198
199 // Type-unsafe IEnumerator.Current
200 object global::System.Collections.IEnumerator.Current {
201 get {
202 return Current;
203 }
204 }
205
206 public bool MoveNext() {
207 int size = collectionRef.Count;
208 bool moveOkay = (currentIndex+1 < size) && (size == currentSize);
209 if (moveOkay) {
210 currentIndex++;
211 OdDbHandle currentKey = keyCollection[currentIndex];
212 currentObject = new global::System.Collections.Generic.KeyValuePair<OdDbHandle, ChangeType>(currentKey, collectionRef[currentKey]);
213 } else {
214 currentObject = null;
215 }
216 return moveOkay;
217 }
218
219 public void Reset() {
220 currentIndex = -1;
221 currentObject = null;
222 if (collectionRef.Count != currentSize) {
223 throw new global::System.InvalidOperationException("Collection modified.");
224 }
225 }
226
227 public void Dispose() {
228 currentIndex = -1;
229 currentObject = null;
230 }
231 }
232
233
234 public ChangeList() : this(TD_DbPINVOKE.new_ChangeList__SWIG_0(), true) {
236 }
237
238 public ChangeList(ChangeList other) : this(TD_DbPINVOKE.new_ChangeList__SWIG_1(other), true) {
240 }
241
242 private UInt32 size() {
243// test csout
244 /*SIMPLETYPE*/
245 UInt32 ret = TD_DbPINVOKE.ChangeList_size(swigCPtr);
247 return ret;
248 }
249
250 public bool empty() {
251 bool ret = TD_DbPINVOKE.ChangeList_empty(swigCPtr);
253 return ret;
254 }
255
256 public void Clear() {
259 }
260
261 private ChangeType getitem(OdDbHandle key) {
264 return ret;
265 }
266
267 private void setitem(OdDbHandle key, ChangeType x) {
268 TD_DbPINVOKE.ChangeList_setitem(swigCPtr, OdDbHandle.getCPtr(key), (int)x);
269 if (TD_DbPINVOKE.SWIGPendingException.Pending) throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
270 }
271
272 public bool ContainsKey(OdDbHandle key) {
273 bool ret = TD_DbPINVOKE.ChangeList_ContainsKey(swigCPtr, OdDbHandle.getCPtr(key));
275 return ret;
276 }
277
278 public void Add(OdDbHandle key, ChangeType value) {
279 TD_DbPINVOKE.ChangeList_Add(swigCPtr, OdDbHandle.getCPtr(key), (int)value);
281 }
282
283 public bool Remove(OdDbHandle key) {
284 bool ret = TD_DbPINVOKE.ChangeList_Remove(swigCPtr, OdDbHandle.getCPtr(key));
286 return ret;
287 }
288
289 private global::System.IntPtr create_iterator_begin() {
290 global::System.IntPtr ret = TD_DbPINVOKE.ChangeList_create_iterator_begin(swigCPtr);
292 return ret;
293 }
294
295 private OdDbHandle get_next_key(global::System.IntPtr swigiterator) {
296 OdDbHandle ret = new OdDbHandle(TD_DbPINVOKE.ChangeList_get_next_key(swigCPtr, swigiterator), false);
297 if (TD_DbPINVOKE.SWIGPendingException.Pending) throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
298 return ret;
299 }
300
301 private void destroy_iterator(global::System.IntPtr swigiterator) {
302 TD_DbPINVOKE.ChangeList_destroy_iterator(swigCPtr, swigiterator);
303 if (TD_DbPINVOKE.SWIGPendingException.Pending) throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
304 }
305
306}
307
308}
static HandleRef getCPtr(OdDbHandle obj)
Definition: OdDbHandle.cs:26
OdDbHandle Add(Int64 value)
Definition: OdDbHandle.cs:137
global::System.Collections.Generic.KeyValuePair< OdDbHandle, ChangeType > Current
Definition: ChangeList.cs:187
ChangeListEnumerator(ChangeList collection)
Definition: ChangeList.cs:178
ChangeList(IntPtr cPtr, bool cMemoryOwn)
Definition: ChangeList.cs:24
void CopyTo(global::System.Collections.Generic.KeyValuePair< OdDbHandle, ChangeType >[] array, int arrayIndex)
Definition: ChangeList.cs:135
bool TryGetValue(OdDbHandle key, out ChangeType value)
Definition: ChangeList.cs:65
ChangeList(ChangeList other)
Definition: ChangeList.cs:238
void CopyTo(global::System.Collections.Generic.KeyValuePair< OdDbHandle, ChangeType >[] array)
Definition: ChangeList.cs:131
bool ContainsKey(OdDbHandle key)
Definition: ChangeList.cs:272
bool Remove(OdDbHandle key)
Definition: ChangeList.cs:283
global::System.Collections.Generic.ICollection< ChangeType > Values
Definition: ChangeList.cs:101
bool Remove(global::System.Collections.Generic.KeyValuePair< OdDbHandle, ChangeType > item)
Definition: ChangeList.cs:115
static HandleRef getCPtr(ChangeList obj)
Definition: ChangeList.cs:29
void Add(global::System.Collections.Generic.KeyValuePair< OdDbHandle, ChangeType > item)
Definition: ChangeList.cs:111
virtual void Dispose(bool disposing)
Definition: ChangeList.cs:42
global::System.Collections.Generic.ICollection< OdDbHandle > Keys
Definition: ChangeList.cs:86
void Add(OdDbHandle key, ChangeType value)
Definition: ChangeList.cs:278
bool Contains(global::System.Collections.Generic.KeyValuePair< OdDbHandle, ChangeType > item)
Definition: ChangeList.cs:123
ChangeListEnumerator GetEnumerator()
Definition: ChangeList.cs:160
static global::System.Exception Retrieve()
static bool ChangeList_ContainsKey(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
static global::System.IntPtr ChangeList_create_iterator_begin(global::System.Runtime.InteropServices.HandleRef jarg1)
static UInt32 ChangeList_size(global::System.Runtime.InteropServices.HandleRef jarg1)
static void ChangeList_Clear(global::System.Runtime.InteropServices.HandleRef jarg1)
static bool ChangeList_empty(global::System.Runtime.InteropServices.HandleRef jarg1)
static void ChangeList_Add(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int jarg3)
static void delete_ChangeList(global::System.Runtime.InteropServices.HandleRef jarg1)
static bool ChangeList_Remove(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
static int ChangeList_getitem(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)