1 //------------------------------------------------------------------------------
4 // This file was automatically generated by SWIG (http://www.swig.org).
7 // Do not make changes to this file unless you know what you are doing--modify
8 // the SWIG interface file instead.
9 //------------------------------------------------------------------------------
14 internal class ItemContainer : global::System.IDisposable, global::System.Collections.IEnumerable
15 , global::System.Collections.Generic.IEnumerable<Item>
17 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
18 protected bool swigCMemOwn;
20 internal ItemContainer(global::System.IntPtr cPtr, bool cMemoryOwn)
22 swigCMemOwn = cMemoryOwn;
23 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
26 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ItemContainer obj)
28 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
31 //A Flag to check who called Dispose(). (By User or DisposeQueue)
32 private bool isDisposeQueued = false;
33 //A Flat to check if it is already disposed.
34 protected bool disposed = false;
41 isDisposeQueued = true;
42 DisposeQueue.Instance.Add(this);
48 //Throw excpetion if Dispose() is called in separate thread.
49 if (!Window.IsInstalled())
51 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
56 Dispose(DisposeTypes.Implicit);
60 Dispose(DisposeTypes.Explicit);
61 System.GC.SuppressFinalize(this);
65 protected virtual void Dispose(DisposeTypes type)
72 if (type == DisposeTypes.Explicit)
75 //Release your own managed resources here.
76 //You should release all of your own disposable objects here.
80 //Release your own unmanaged resources here.
81 //You should not access any managed member here except static instance.
82 //because the execution order of Finalizes is non-deterministic.
84 if (swigCPtr.Handle != global::System.IntPtr.Zero)
89 NDalicPINVOKE.delete_ItemContainer(swigCPtr);
91 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
97 public ItemContainer(global::System.Collections.ICollection c) : this()
100 throw new global::System.ArgumentNullException("c");
101 foreach (Item element in c)
107 public bool IsFixedSize
115 public bool IsReadOnly
123 public Item this[int index]
127 return getitem(index);
131 setitem(index, value);
139 return (int)capacity();
144 throw new global::System.ArgumentOutOfRangeException("Capacity");
145 reserve((uint)value);
157 public bool IsSynchronized
165 public void CopyTo(Item[] array)
167 CopyTo(0, array, 0, this.Count);
170 public void CopyTo(Item[] array, int arrayIndex)
172 CopyTo(0, array, arrayIndex, this.Count);
175 public void CopyTo(int index, Item[] array, int arrayIndex, int count)
178 throw new global::System.ArgumentNullException("array");
180 throw new global::System.ArgumentOutOfRangeException("index", "Value is less than zero");
182 throw new global::System.ArgumentOutOfRangeException("arrayIndex", "Value is less than zero");
184 throw new global::System.ArgumentOutOfRangeException("count", "Value is less than zero");
186 throw new global::System.ArgumentException("Multi dimensional array.", "array");
187 if (index + count > this.Count || arrayIndex + count > array.Length)
188 throw new global::System.ArgumentException("Number of elements to copy is too large.");
189 for (int i = 0; i < count; i++)
190 array.SetValue(getitemcopy(index + i), arrayIndex + i);
193 global::System.Collections.Generic.IEnumerator<Item> global::System.Collections.Generic.IEnumerable<Item>.GetEnumerator()
195 return new ItemContainerEnumerator(this);
198 global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
200 return new ItemContainerEnumerator(this);
203 public ItemContainerEnumerator GetEnumerator()
205 return new ItemContainerEnumerator(this);
208 // Type-safe enumerator
209 /// Note that the IEnumerator documentation requires an InvalidOperationException to be thrown
210 /// whenever the collection is modified. This has been done for changes in the size of the
211 /// collection but not when one of the elements of the collection is modified as it is a bit
212 /// tricky to detect unmanaged code that modifies the collection under our feet.
213 public sealed class ItemContainerEnumerator : global::System.Collections.IEnumerator
214 , global::System.Collections.Generic.IEnumerator<Item>
216 private ItemContainer collectionRef;
217 private int currentIndex;
218 private object currentObject;
219 private int currentSize;
221 public ItemContainerEnumerator(ItemContainer collection)
223 collectionRef = collection;
225 currentObject = null;
226 currentSize = collectionRef.Count;
229 // Type-safe iterator Current
234 if (currentIndex == -1)
235 throw new global::System.InvalidOperationException("Enumeration not started.");
236 if (currentIndex > currentSize - 1)
237 throw new global::System.InvalidOperationException("Enumeration finished.");
238 if (currentObject == null)
239 throw new global::System.InvalidOperationException("Collection modified.");
240 return (Item)currentObject;
244 // Type-unsafe IEnumerator.Current
245 object global::System.Collections.IEnumerator.Current
253 public bool MoveNext()
255 int size = collectionRef.Count;
256 bool moveOkay = (currentIndex + 1 < size) && (size == currentSize);
260 currentObject = collectionRef[currentIndex];
264 currentObject = null;
272 currentObject = null;
273 if (collectionRef.Count != currentSize)
275 throw new global::System.InvalidOperationException("Collection modified.");
279 public void Dispose()
282 currentObject = null;
288 NDalicPINVOKE.ItemContainer_Clear(swigCPtr);
289 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
292 public void Add(Item x)
294 NDalicPINVOKE.ItemContainer_Add(swigCPtr, Item.getCPtr(x));
295 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
300 uint ret = NDalicPINVOKE.ItemContainer_size(swigCPtr);
301 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
305 private uint capacity()
307 uint ret = NDalicPINVOKE.ItemContainer_capacity(swigCPtr);
308 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
312 private void reserve(uint n)
314 NDalicPINVOKE.ItemContainer_reserve(swigCPtr, n);
315 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
318 public ItemContainer() : this(NDalicPINVOKE.new_ItemContainer__SWIG_0(), true)
320 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
323 public ItemContainer(ItemContainer other) : this(NDalicPINVOKE.new_ItemContainer__SWIG_1(ItemContainer.getCPtr(other)), true)
325 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
328 public ItemContainer(int capacity) : this(NDalicPINVOKE.new_ItemContainer__SWIG_2(capacity), true)
330 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
333 private Item getitemcopy(int index)
335 Item ret = new Item(NDalicPINVOKE.ItemContainer_getitemcopy(swigCPtr, index), true);
336 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
340 private Item getitem(int index)
342 Item ret = new Item(NDalicPINVOKE.ItemContainer_getitem(swigCPtr, index), false);
343 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
347 private void setitem(int index, Item val)
349 NDalicPINVOKE.ItemContainer_setitem(swigCPtr, index, Item.getCPtr(val));
350 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
353 public void AddRange(ItemContainer values)
355 NDalicPINVOKE.ItemContainer_AddRange(swigCPtr, ItemContainer.getCPtr(values));
356 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
359 public ItemContainer GetRange(int index, int count)
361 global::System.IntPtr cPtr = NDalicPINVOKE.ItemContainer_GetRange(swigCPtr, index, count);
362 ItemContainer ret = (cPtr == global::System.IntPtr.Zero) ? null : new ItemContainer(cPtr, true);
363 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
367 public void Insert(int index, Item x)
369 NDalicPINVOKE.ItemContainer_Insert(swigCPtr, index, Item.getCPtr(x));
370 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
373 public void InsertRange(int index, ItemContainer values)
375 NDalicPINVOKE.ItemContainer_InsertRange(swigCPtr, index, ItemContainer.getCPtr(values));
376 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
379 public void RemoveAt(int index)
381 NDalicPINVOKE.ItemContainer_RemoveAt(swigCPtr, index);
382 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
385 public void RemoveRange(int index, int count)
387 NDalicPINVOKE.ItemContainer_RemoveRange(swigCPtr, index, count);
388 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
391 public static ItemContainer Repeat(Item value, int count)
393 global::System.IntPtr cPtr = NDalicPINVOKE.ItemContainer_Repeat(Item.getCPtr(value), count);
394 ItemContainer ret = (cPtr == global::System.IntPtr.Zero) ? null : new ItemContainer(cPtr, true);
395 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
399 public void Reverse()
401 NDalicPINVOKE.ItemContainer_Reverse__SWIG_0(swigCPtr);
402 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
405 public void Reverse(int index, int count)
407 NDalicPINVOKE.ItemContainer_Reverse__SWIG_1(swigCPtr, index, count);
408 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
411 public void SetRange(int index, ItemContainer values)
413 NDalicPINVOKE.ItemContainer_SetRange(swigCPtr, index, ItemContainer.getCPtr(values));
414 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();