Commit manual merge for dali-csharp.
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / ItemContainer.cs
1 //------------------------------------------------------------------------------
2 // <auto-generated />
3 //
4 // This file was automatically generated by SWIG (http://www.swig.org).
5 // Version 3.0.9
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
11 namespace Tizen.NUI {
12
13     internal class ItemContainer : global::System.IDisposable, global::System.Collections.IEnumerable
14     , global::System.Collections.Generic.IEnumerable<Item>
15  {
16   private global::System.Runtime.InteropServices.HandleRef swigCPtr;
17   protected bool swigCMemOwn;
18
19   internal ItemContainer(global::System.IntPtr cPtr, bool cMemoryOwn) {
20     swigCMemOwn = cMemoryOwn;
21     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
22   }
23
24   internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ItemContainer obj) {
25     return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
26   }
27
28   ~ItemContainer() {
29     DisposeQueue.Instance.Add(this);
30   }
31
32   public virtual void Dispose() {
33     if (!Window.IsInstalled()) {
34       DisposeQueue.Instance.Add(this);
35       return;
36     }
37
38     lock(this) {
39       if (swigCPtr.Handle != global::System.IntPtr.Zero) {
40         if (swigCMemOwn) {
41           swigCMemOwn = false;
42           NDalicPINVOKE.delete_ItemContainer(swigCPtr);
43         }
44         swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
45       }
46       global::System.GC.SuppressFinalize(this);
47     }
48   }
49
50   public ItemContainer(global::System.Collections.ICollection c) : this() {
51     if (c == null)
52       throw new global::System.ArgumentNullException("c");
53     foreach (Item element in c) {
54       this.Add(element);
55     }
56   }
57
58   public bool IsFixedSize {
59     get {
60       return false;
61     }
62   }
63
64   public bool IsReadOnly {
65     get {
66       return false;
67     }
68   }
69
70   public Item this[int index]  {
71     get {
72       return getitem(index);
73     }
74     set {
75       setitem(index, value);
76     }
77   }
78
79   public int Capacity {
80     get {
81       return (int)capacity();
82     }
83     set {
84       if (value < size())
85         throw new global::System.ArgumentOutOfRangeException("Capacity");
86       reserve((uint)value);
87     }
88   }
89
90   public int Count {
91     get {
92       return (int)size();
93     }
94   }
95
96   public bool IsSynchronized {
97     get {
98       return false;
99     }
100   }
101
102   public void CopyTo(Item[] array)
103   {
104     CopyTo(0, array, 0, this.Count);
105   }
106
107   public void CopyTo(Item[] array, int arrayIndex)
108   {
109     CopyTo(0, array, arrayIndex, this.Count);
110   }
111
112   public void CopyTo(int index, Item[] array, int arrayIndex, int count)
113   {
114     if (array == null)
115       throw new global::System.ArgumentNullException("array");
116     if (index < 0)
117       throw new global::System.ArgumentOutOfRangeException("index", "Value is less than zero");
118     if (arrayIndex < 0)
119       throw new global::System.ArgumentOutOfRangeException("arrayIndex", "Value is less than zero");
120     if (count < 0)
121       throw new global::System.ArgumentOutOfRangeException("count", "Value is less than zero");
122     if (array.Rank > 1)
123       throw new global::System.ArgumentException("Multi dimensional array.", "array");
124     if (index+count > this.Count || arrayIndex+count > array.Length)
125       throw new global::System.ArgumentException("Number of elements to copy is too large.");
126     for (int i=0; i<count; i++)
127       array.SetValue(getitemcopy(index+i), arrayIndex+i);
128   }
129
130   global::System.Collections.Generic.IEnumerator<Item> global::System.Collections.Generic.IEnumerable<Item>.GetEnumerator() {
131     return new ItemContainerEnumerator(this);
132   }
133
134   global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() {
135     return new ItemContainerEnumerator(this);
136   }
137
138   public ItemContainerEnumerator GetEnumerator() {
139     return new ItemContainerEnumerator(this);
140   }
141
142   // Type-safe enumerator
143   /// Note that the IEnumerator documentation requires an InvalidOperationException to be thrown
144   /// whenever the collection is modified. This has been done for changes in the size of the
145   /// collection but not when one of the elements of the collection is modified as it is a bit
146   /// tricky to detect unmanaged code that modifies the collection under our feet.
147   public sealed class ItemContainerEnumerator : global::System.Collections.IEnumerator
148     , global::System.Collections.Generic.IEnumerator<Item>
149   {
150     private ItemContainer collectionRef;
151     private int currentIndex;
152     private object currentObject;
153     private int currentSize;
154
155     public ItemContainerEnumerator(ItemContainer collection) {
156       collectionRef = collection;
157       currentIndex = -1;
158       currentObject = null;
159       currentSize = collectionRef.Count;
160     }
161
162     // Type-safe iterator Current
163     public Item Current {
164       get {
165         if (currentIndex == -1)
166           throw new global::System.InvalidOperationException("Enumeration not started.");
167         if (currentIndex > currentSize - 1)
168           throw new global::System.InvalidOperationException("Enumeration finished.");
169         if (currentObject == null)
170           throw new global::System.InvalidOperationException("Collection modified.");
171         return (Item)currentObject;
172       }
173     }
174
175     // Type-unsafe IEnumerator.Current
176     object global::System.Collections.IEnumerator.Current {
177       get {
178         return Current;
179       }
180     }
181
182     public bool MoveNext() {
183       int size = collectionRef.Count;
184       bool moveOkay = (currentIndex+1 < size) && (size == currentSize);
185       if (moveOkay) {
186         currentIndex++;
187         currentObject = collectionRef[currentIndex];
188       } else {
189         currentObject = null;
190       }
191       return moveOkay;
192     }
193
194     public void Reset() {
195       currentIndex = -1;
196       currentObject = null;
197       if (collectionRef.Count != currentSize) {
198         throw new global::System.InvalidOperationException("Collection modified.");
199       }
200     }
201
202     public void Dispose() {
203         currentIndex = -1;
204         currentObject = null;
205     }
206   }
207
208   public void Clear() {
209     NDalicPINVOKE.ItemContainer_Clear(swigCPtr);
210     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
211   }
212
213   public void Add(Item x) {
214     NDalicPINVOKE.ItemContainer_Add(swigCPtr, Item.getCPtr(x));
215     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
216   }
217
218   private uint size() {
219     uint ret = NDalicPINVOKE.ItemContainer_size(swigCPtr);
220     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
221     return ret;
222   }
223
224   private uint capacity() {
225     uint ret = NDalicPINVOKE.ItemContainer_capacity(swigCPtr);
226     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
227     return ret;
228   }
229
230   private void reserve(uint n) {
231     NDalicPINVOKE.ItemContainer_reserve(swigCPtr, n);
232     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
233   }
234
235   public ItemContainer() : this(NDalicPINVOKE.new_ItemContainer__SWIG_0(), true) {
236     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
237   }
238
239   public ItemContainer(ItemContainer other) : this(NDalicPINVOKE.new_ItemContainer__SWIG_1(ItemContainer.getCPtr(other)), true) {
240     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
241   }
242
243   public ItemContainer(int capacity) : this(NDalicPINVOKE.new_ItemContainer__SWIG_2(capacity), true) {
244     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
245   }
246
247   private Item getitemcopy(int index) {
248     Item ret = new Item(NDalicPINVOKE.ItemContainer_getitemcopy(swigCPtr, index), true);
249     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
250     return ret;
251   }
252
253   private Item getitem(int index) {
254     Item ret = new Item(NDalicPINVOKE.ItemContainer_getitem(swigCPtr, index), false);
255     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
256     return ret;
257   }
258
259   private void setitem(int index, Item val) {
260     NDalicPINVOKE.ItemContainer_setitem(swigCPtr, index, Item.getCPtr(val));
261     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
262   }
263
264   public void AddRange(ItemContainer values) {
265     NDalicPINVOKE.ItemContainer_AddRange(swigCPtr, ItemContainer.getCPtr(values));
266     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
267   }
268
269   public ItemContainer GetRange(int index, int count) {
270     global::System.IntPtr cPtr = NDalicPINVOKE.ItemContainer_GetRange(swigCPtr, index, count);
271     ItemContainer ret = (cPtr == global::System.IntPtr.Zero) ? null : new ItemContainer(cPtr, true);
272     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
273     return ret;
274   }
275
276   public void Insert(int index, Item x) {
277     NDalicPINVOKE.ItemContainer_Insert(swigCPtr, index, Item.getCPtr(x));
278     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
279   }
280
281   public void InsertRange(int index, ItemContainer values) {
282     NDalicPINVOKE.ItemContainer_InsertRange(swigCPtr, index, ItemContainer.getCPtr(values));
283     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
284   }
285
286   public void RemoveAt(int index) {
287     NDalicPINVOKE.ItemContainer_RemoveAt(swigCPtr, index);
288     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
289   }
290
291   public void RemoveRange(int index, int count) {
292     NDalicPINVOKE.ItemContainer_RemoveRange(swigCPtr, index, count);
293     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
294   }
295
296   public static ItemContainer Repeat(Item value, int count) {
297     global::System.IntPtr cPtr = NDalicPINVOKE.ItemContainer_Repeat(Item.getCPtr(value), count);
298     ItemContainer ret = (cPtr == global::System.IntPtr.Zero) ? null : new ItemContainer(cPtr, true);
299     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
300     return ret;
301   }
302
303   public void Reverse() {
304     NDalicPINVOKE.ItemContainer_Reverse__SWIG_0(swigCPtr);
305     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
306   }
307
308   public void Reverse(int index, int count) {
309     NDalicPINVOKE.ItemContainer_Reverse__SWIG_1(swigCPtr, index, count);
310     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
311   }
312
313   public void SetRange(int index, ItemContainer values) {
314     NDalicPINVOKE.ItemContainer_SetRange(swigCPtr, index, ItemContainer.getCPtr(values));
315     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
316   }
317
318 }
319
320 }