2 * Copyright(c) 2017 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.ComponentModel;
23 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
24 [EditorBrowsable(EditorBrowsableState.Never)]
25 public class ItemIdContainer : global::System.IDisposable, global::System.Collections.IEnumerable
26 , global::System.Collections.Generic.IList<uint>
28 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
30 /// <summary>swigCMemOwn.</summary>
31 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
32 protected bool swigCMemOwn;
34 internal ItemIdContainer(global::System.IntPtr cPtr, bool cMemoryOwn)
36 swigCMemOwn = cMemoryOwn;
37 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
40 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ItemIdContainer obj)
42 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
45 /// <summary>A Flag to check who called Dispose(). (By User or DisposeQueue)</summary>
46 private bool isDisposeQueued = false;
48 /// <summary>A Flag to check if it is already disposed.</summary>
49 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
50 protected bool disposed = false;
52 /// <summary>Destructor.</summary>
53 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
58 isDisposeQueued = true;
59 DisposeQueue.Instance.Add(this);
63 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
64 [EditorBrowsable(EditorBrowsableState.Never)]
67 //Throw excpetion if Dispose() is called in separate thread.
68 if (!Window.IsInstalled())
70 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
75 Dispose(DisposeTypes.Implicit);
79 Dispose(DisposeTypes.Explicit);
80 System.GC.SuppressFinalize(this);
84 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
85 [EditorBrowsable(EditorBrowsableState.Never)]
86 protected virtual void Dispose(DisposeTypes type)
93 if (type == DisposeTypes.Explicit)
96 //Release your own managed resources here.
97 //You should release all of your own disposable objects here.
101 //Release your own unmanaged resources here.
102 //You should not access any managed member here except static instance.
103 //because the execution order of Finalizes is non-deterministic.
105 if (swigCPtr.Handle != global::System.IntPtr.Zero)
110 Interop.ItemIdContainer.delete_ItemIdContainer(swigCPtr);
112 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
118 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
119 [EditorBrowsable(EditorBrowsableState.Never)]
120 public ItemIdContainer(global::System.Collections.ICollection c) : this()
123 throw new global::System.ArgumentNullException("c");
124 foreach (uint element in c)
130 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
131 [EditorBrowsable(EditorBrowsableState.Never)]
132 public bool IsFixedSize
140 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
141 [EditorBrowsable(EditorBrowsableState.Never)]
142 public bool IsReadOnly
150 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
151 [EditorBrowsable(EditorBrowsableState.Never)]
152 public uint this[int index]
156 return getitem(index);
160 setitem(index, value);
164 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
165 [EditorBrowsable(EditorBrowsableState.Never)]
170 return (int)capacity();
175 throw new global::System.ArgumentOutOfRangeException("Capacity");
176 reserve((uint)value);
180 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
181 [EditorBrowsable(EditorBrowsableState.Never)]
190 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
191 [EditorBrowsable(EditorBrowsableState.Never)]
192 public bool IsSynchronized
200 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
201 [EditorBrowsable(EditorBrowsableState.Never)]
202 public void CopyTo(uint[] array)
204 CopyTo(0, array, 0, this.Count);
207 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
208 [EditorBrowsable(EditorBrowsableState.Never)]
209 public void CopyTo(uint[] array, int arrayIndex)
211 CopyTo(0, array, arrayIndex, this.Count);
214 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
215 [EditorBrowsable(EditorBrowsableState.Never)]
216 public void CopyTo(int index, uint[] array, int arrayIndex, int count)
219 throw new global::System.ArgumentNullException("array");
221 throw new global::System.ArgumentOutOfRangeException("index", "Value is less than zero");
223 throw new global::System.ArgumentOutOfRangeException("arrayIndex", "Value is less than zero");
225 throw new global::System.ArgumentOutOfRangeException("count", "Value is less than zero");
227 throw new global::System.ArgumentException("Multi dimensional array.", "array");
228 if (index + count > this.Count || arrayIndex + count > array.Length)
229 throw new global::System.ArgumentException("Number of elements to copy is too large.");
230 for (int i = 0; i < count; i++)
231 array.SetValue(getitemcopy(index + i), arrayIndex + i);
234 global::System.Collections.Generic.IEnumerator<uint> global::System.Collections.Generic.IEnumerable<uint>.GetEnumerator()
236 return new ItemIdContainerEnumerator(this);
239 global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
241 return new ItemIdContainerEnumerator(this);
244 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
245 [EditorBrowsable(EditorBrowsableState.Never)]
246 public ItemIdContainerEnumerator GetEnumerator()
248 return new ItemIdContainerEnumerator(this);
251 // The type-safe enumerator.
252 /// Note that the IEnumerator documentation requires an InvalidOperationException to be thrown
253 /// whenever the collection is modified. This has been done for changes in the size of the
254 /// collection, but not when one of the elements of the collection is modified as it is a bit
255 /// tricky to detect unmanaged code that modifies the collection under our feet.
256 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
257 [EditorBrowsable(EditorBrowsableState.Never)]
258 public sealed class ItemIdContainerEnumerator : global::System.Collections.IEnumerator
259 , global::System.Collections.Generic.IEnumerator<uint>
261 private ItemIdContainer collectionRef;
262 private int currentIndex;
263 private object currentObject;
264 private int currentSize;
266 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
267 [EditorBrowsable(EditorBrowsableState.Never)]
268 public ItemIdContainerEnumerator(ItemIdContainer collection)
270 collectionRef = collection;
272 currentObject = null;
273 currentSize = collectionRef.Count;
276 // Type-safe iterator Current
277 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
278 [EditorBrowsable(EditorBrowsableState.Never)]
283 if (currentIndex == -1)
284 throw new global::System.InvalidOperationException("Enumeration not started.");
285 if (currentIndex > currentSize - 1)
286 throw new global::System.InvalidOperationException("Enumeration finished.");
287 if (currentObject == null)
288 throw new global::System.InvalidOperationException("Collection modified.");
289 return (uint)currentObject;
293 // Type-unsafe IEnumerator.Current
294 object global::System.Collections.IEnumerator.Current
302 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
303 [EditorBrowsable(EditorBrowsableState.Never)]
304 public bool MoveNext()
306 int size = collectionRef.Count;
307 bool moveOkay = (currentIndex + 1 < size) && (size == currentSize);
311 currentObject = collectionRef[currentIndex];
315 currentObject = null;
320 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
321 [EditorBrowsable(EditorBrowsableState.Never)]
325 currentObject = null;
326 if (collectionRef.Count != currentSize)
328 throw new global::System.InvalidOperationException("Collection modified.");
332 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
333 [EditorBrowsable(EditorBrowsableState.Never)]
334 public void Dispose()
337 currentObject = null;
341 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
342 [EditorBrowsable(EditorBrowsableState.Never)]
345 Interop.ItemIdContainer.ItemIdContainer_Clear(swigCPtr);
346 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
349 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
350 [EditorBrowsable(EditorBrowsableState.Never)]
351 public void Add(uint x)
353 Interop.ItemIdContainer.ItemIdContainer_Add(swigCPtr, x);
354 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
359 uint ret = Interop.ItemIdContainer.ItemIdContainer_size(swigCPtr);
360 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
364 private uint capacity()
366 uint ret = Interop.ItemIdContainer.ItemIdContainer_capacity(swigCPtr);
367 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
371 private void reserve(uint n)
373 Interop.ItemIdContainer.ItemIdContainer_reserve(swigCPtr, n);
374 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
377 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
378 [EditorBrowsable(EditorBrowsableState.Never)]
379 public ItemIdContainer() : this(Interop.ItemIdContainer.new_ItemIdContainer__SWIG_0(), true)
381 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
384 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
385 [EditorBrowsable(EditorBrowsableState.Never)]
386 public ItemIdContainer(ItemIdContainer other) : this(Interop.ItemIdContainer.new_ItemIdContainer__SWIG_1(ItemIdContainer.getCPtr(other)), true)
388 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
391 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
392 [EditorBrowsable(EditorBrowsableState.Never)]
393 public ItemIdContainer(int capacity) : this(Interop.ItemIdContainer.new_ItemIdContainer__SWIG_2(capacity), true)
395 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
398 private uint getitemcopy(int index)
400 uint ret = Interop.ItemIdContainer.ItemIdContainer_getitemcopy(swigCPtr, index);
401 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
405 private uint getitem(int index)
407 uint ret = Interop.ItemIdContainer.ItemIdContainer_getitem(swigCPtr, index);
408 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
412 private void setitem(int index, uint val)
414 Interop.ItemIdContainer.ItemIdContainer_setitem(swigCPtr, index, val);
415 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
418 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
419 [EditorBrowsable(EditorBrowsableState.Never)]
420 public void AddRange(ItemIdContainer values)
422 Interop.ItemIdContainer.ItemIdContainer_AddRange(swigCPtr, ItemIdContainer.getCPtr(values));
423 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
426 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
427 [EditorBrowsable(EditorBrowsableState.Never)]
428 public ItemIdContainer GetRange(int index, int count)
430 global::System.IntPtr cPtr = Interop.ItemIdContainer.ItemIdContainer_GetRange(swigCPtr, index, count);
431 ItemIdContainer ret = (cPtr == global::System.IntPtr.Zero) ? null : new ItemIdContainer(cPtr, true);
432 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
436 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
437 [EditorBrowsable(EditorBrowsableState.Never)]
438 public void Insert(int index, uint x)
440 Interop.ItemIdContainer.ItemIdContainer_Insert(swigCPtr, index, x);
441 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
444 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
445 [EditorBrowsable(EditorBrowsableState.Never)]
446 public void InsertRange(int index, ItemIdContainer values)
448 Interop.ItemIdContainer.ItemIdContainer_InsertRange(swigCPtr, index, ItemIdContainer.getCPtr(values));
449 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
452 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
453 [EditorBrowsable(EditorBrowsableState.Never)]
454 public void RemoveAt(int index)
456 Interop.ItemIdContainer.ItemIdContainer_RemoveAt(swigCPtr, index);
457 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
460 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
461 [EditorBrowsable(EditorBrowsableState.Never)]
462 public void RemoveRange(int index, int count)
464 Interop.ItemIdContainer.ItemIdContainer_RemoveRange(swigCPtr, index, count);
465 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
468 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
469 [EditorBrowsable(EditorBrowsableState.Never)]
470 public static ItemIdContainer Repeat(uint value, int count)
472 global::System.IntPtr cPtr = Interop.ItemIdContainer.ItemIdContainer_Repeat(value, count);
473 ItemIdContainer ret = (cPtr == global::System.IntPtr.Zero) ? null : new ItemIdContainer(cPtr, true);
474 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
478 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
479 [EditorBrowsable(EditorBrowsableState.Never)]
480 public void Reverse()
482 Interop.ItemIdContainer.ItemIdContainer_Reverse__SWIG_0(swigCPtr);
483 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
486 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
487 [EditorBrowsable(EditorBrowsableState.Never)]
488 public void Reverse(int index, int count)
490 Interop.ItemIdContainer.ItemIdContainer_Reverse__SWIG_1(swigCPtr, index, count);
491 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
494 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
495 [EditorBrowsable(EditorBrowsableState.Never)]
496 public void SetRange(int index, ItemIdContainer values)
498 Interop.ItemIdContainer.ItemIdContainer_SetRange(swigCPtr, index, ItemIdContainer.getCPtr(values));
499 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
502 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
503 [EditorBrowsable(EditorBrowsableState.Never)]
504 public bool Contains(uint value)
506 bool ret = Interop.ItemIdContainer.ItemIdContainer_Contains(swigCPtr, value);
507 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
511 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
512 [EditorBrowsable(EditorBrowsableState.Never)]
513 public int IndexOf(uint value)
515 int ret = Interop.ItemIdContainer.ItemIdContainer_IndexOf(swigCPtr, value);
516 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
520 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
521 [EditorBrowsable(EditorBrowsableState.Never)]
522 public int LastIndexOf(uint value)
524 int ret = Interop.ItemIdContainer.ItemIdContainer_LastIndexOf(swigCPtr, value);
525 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
529 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
530 [EditorBrowsable(EditorBrowsableState.Never)]
531 public bool Remove(uint value)
533 bool ret = Interop.ItemIdContainer.ItemIdContainer_Remove(swigCPtr, value);
534 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();