merging dali-sharp class scope with nui
[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
14     internal class ItemContainer : global::System.IDisposable, global::System.Collections.IEnumerable
15     , global::System.Collections.Generic.IEnumerable<Item>
16     {
17         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
18         protected bool swigCMemOwn;
19
20         internal ItemContainer(global::System.IntPtr cPtr, bool cMemoryOwn)
21         {
22             swigCMemOwn = cMemoryOwn;
23             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
24         }
25
26         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ItemContainer obj)
27         {
28             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
29         }
30
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;
35
36
37         ~ItemContainer()
38         {
39             if (!isDisposeQueued)
40             {
41                 isDisposeQueued = true;
42                 DisposeQueue.Instance.Add(this);
43             }
44         }
45
46         public void Dispose()
47         {
48             //Throw excpetion if Dispose() is called in separate thread.
49             if (!Window.IsInstalled())
50             {
51                 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
52             }
53
54             if (isDisposeQueued)
55             {
56                 Dispose(DisposeTypes.Implicit);
57             }
58             else
59             {
60                 Dispose(DisposeTypes.Explicit);
61                 System.GC.SuppressFinalize(this);
62             }
63         }
64
65         protected virtual void Dispose(DisposeTypes type)
66         {
67             if (disposed)
68             {
69                 return;
70             }
71
72             if (type == DisposeTypes.Explicit)
73             {
74                 //Called by User
75                 //Release your own managed resources here.
76                 //You should release all of your own disposable objects here.
77
78             }
79
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.
83
84             if (swigCPtr.Handle != global::System.IntPtr.Zero)
85             {
86                 if (swigCMemOwn)
87                 {
88                     swigCMemOwn = false;
89                     NDalicPINVOKE.delete_ItemContainer(swigCPtr);
90                 }
91                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
92             }
93
94             disposed = true;
95         }
96
97         public ItemContainer(global::System.Collections.ICollection c) : this()
98         {
99             if (c == null)
100                 throw new global::System.ArgumentNullException("c");
101             foreach (Item element in c)
102             {
103                 this.Add(element);
104             }
105         }
106
107         public bool IsFixedSize
108         {
109             get
110             {
111                 return false;
112             }
113         }
114
115         public bool IsReadOnly
116         {
117             get
118             {
119                 return false;
120             }
121         }
122
123         public Item this[int index]
124         {
125             get
126             {
127                 return getitem(index);
128             }
129             set
130             {
131                 setitem(index, value);
132             }
133         }
134
135         public int Capacity
136         {
137             get
138             {
139                 return (int)capacity();
140             }
141             set
142             {
143                 if (value < size())
144                     throw new global::System.ArgumentOutOfRangeException("Capacity");
145                 reserve((uint)value);
146             }
147         }
148
149         public int Count
150         {
151             get
152             {
153                 return (int)size();
154             }
155         }
156
157         public bool IsSynchronized
158         {
159             get
160             {
161                 return false;
162             }
163         }
164
165         public void CopyTo(Item[] array)
166         {
167             CopyTo(0, array, 0, this.Count);
168         }
169
170         public void CopyTo(Item[] array, int arrayIndex)
171         {
172             CopyTo(0, array, arrayIndex, this.Count);
173         }
174
175         public void CopyTo(int index, Item[] array, int arrayIndex, int count)
176         {
177             if (array == null)
178                 throw new global::System.ArgumentNullException("array");
179             if (index < 0)
180                 throw new global::System.ArgumentOutOfRangeException("index", "Value is less than zero");
181             if (arrayIndex < 0)
182                 throw new global::System.ArgumentOutOfRangeException("arrayIndex", "Value is less than zero");
183             if (count < 0)
184                 throw new global::System.ArgumentOutOfRangeException("count", "Value is less than zero");
185             if (array.Rank > 1)
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);
191         }
192
193         global::System.Collections.Generic.IEnumerator<Item> global::System.Collections.Generic.IEnumerable<Item>.GetEnumerator()
194         {
195             return new ItemContainerEnumerator(this);
196         }
197
198         global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
199         {
200             return new ItemContainerEnumerator(this);
201         }
202
203         public ItemContainerEnumerator GetEnumerator()
204         {
205             return new ItemContainerEnumerator(this);
206         }
207
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>
215         {
216             private ItemContainer collectionRef;
217             private int currentIndex;
218             private object currentObject;
219             private int currentSize;
220
221             public ItemContainerEnumerator(ItemContainer collection)
222             {
223                 collectionRef = collection;
224                 currentIndex = -1;
225                 currentObject = null;
226                 currentSize = collectionRef.Count;
227             }
228
229             // Type-safe iterator Current
230             public Item Current
231             {
232                 get
233                 {
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;
241                 }
242             }
243
244             // Type-unsafe IEnumerator.Current
245             object global::System.Collections.IEnumerator.Current
246             {
247                 get
248                 {
249                     return Current;
250                 }
251             }
252
253             public bool MoveNext()
254             {
255                 int size = collectionRef.Count;
256                 bool moveOkay = (currentIndex + 1 < size) && (size == currentSize);
257                 if (moveOkay)
258                 {
259                     currentIndex++;
260                     currentObject = collectionRef[currentIndex];
261                 }
262                 else
263                 {
264                     currentObject = null;
265                 }
266                 return moveOkay;
267             }
268
269             public void Reset()
270             {
271                 currentIndex = -1;
272                 currentObject = null;
273                 if (collectionRef.Count != currentSize)
274                 {
275                     throw new global::System.InvalidOperationException("Collection modified.");
276                 }
277             }
278
279             public void Dispose()
280             {
281                 currentIndex = -1;
282                 currentObject = null;
283             }
284         }
285
286         public void Clear()
287         {
288             NDalicPINVOKE.ItemContainer_Clear(swigCPtr);
289             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
290         }
291
292         public void Add(Item x)
293         {
294             NDalicPINVOKE.ItemContainer_Add(swigCPtr, Item.getCPtr(x));
295             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
296         }
297
298         private uint size()
299         {
300             uint ret = NDalicPINVOKE.ItemContainer_size(swigCPtr);
301             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
302             return ret;
303         }
304
305         private uint capacity()
306         {
307             uint ret = NDalicPINVOKE.ItemContainer_capacity(swigCPtr);
308             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
309             return ret;
310         }
311
312         private void reserve(uint n)
313         {
314             NDalicPINVOKE.ItemContainer_reserve(swigCPtr, n);
315             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
316         }
317
318         public ItemContainer() : this(NDalicPINVOKE.new_ItemContainer__SWIG_0(), true)
319         {
320             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
321         }
322
323         public ItemContainer(ItemContainer other) : this(NDalicPINVOKE.new_ItemContainer__SWIG_1(ItemContainer.getCPtr(other)), true)
324         {
325             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
326         }
327
328         public ItemContainer(int capacity) : this(NDalicPINVOKE.new_ItemContainer__SWIG_2(capacity), true)
329         {
330             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
331         }
332
333         private Item getitemcopy(int index)
334         {
335             Item ret = new Item(NDalicPINVOKE.ItemContainer_getitemcopy(swigCPtr, index), true);
336             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
337             return ret;
338         }
339
340         private Item getitem(int index)
341         {
342             Item ret = new Item(NDalicPINVOKE.ItemContainer_getitem(swigCPtr, index), false);
343             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
344             return ret;
345         }
346
347         private void setitem(int index, Item val)
348         {
349             NDalicPINVOKE.ItemContainer_setitem(swigCPtr, index, Item.getCPtr(val));
350             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
351         }
352
353         public void AddRange(ItemContainer values)
354         {
355             NDalicPINVOKE.ItemContainer_AddRange(swigCPtr, ItemContainer.getCPtr(values));
356             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
357         }
358
359         public ItemContainer GetRange(int index, int count)
360         {
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();
364             return ret;
365         }
366
367         public void Insert(int index, Item x)
368         {
369             NDalicPINVOKE.ItemContainer_Insert(swigCPtr, index, Item.getCPtr(x));
370             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
371         }
372
373         public void InsertRange(int index, ItemContainer values)
374         {
375             NDalicPINVOKE.ItemContainer_InsertRange(swigCPtr, index, ItemContainer.getCPtr(values));
376             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
377         }
378
379         public void RemoveAt(int index)
380         {
381             NDalicPINVOKE.ItemContainer_RemoveAt(swigCPtr, index);
382             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
383         }
384
385         public void RemoveRange(int index, int count)
386         {
387             NDalicPINVOKE.ItemContainer_RemoveRange(swigCPtr, index, count);
388             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
389         }
390
391         public static ItemContainer Repeat(Item value, int count)
392         {
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();
396             return ret;
397         }
398
399         public void Reverse()
400         {
401             NDalicPINVOKE.ItemContainer_Reverse__SWIG_0(swigCPtr);
402             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
403         }
404
405         public void Reverse(int index, int count)
406         {
407             NDalicPINVOKE.ItemContainer_Reverse__SWIG_1(swigCPtr, index, count);
408             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
409         }
410
411         public void SetRange(int index, ItemContainer values)
412         {
413             NDalicPINVOKE.ItemContainer_SetRange(swigCPtr, index, ItemContainer.getCPtr(values));
414             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
415         }
416
417     }
418
419 }