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;
29 protected bool swigCMemOwn;
31 internal ItemIdContainer(global::System.IntPtr cPtr, bool cMemoryOwn)
33 swigCMemOwn = cMemoryOwn;
34 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
37 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ItemIdContainer obj)
39 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
42 //A Flag to check who called Dispose(). (By User or DisposeQueue)
43 private bool isDisposeQueued = false;
44 //A Flat to check if it is already disposed.
45 protected bool disposed = false;
52 isDisposeQueued = true;
53 DisposeQueue.Instance.Add(this);
57 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
58 [EditorBrowsable(EditorBrowsableState.Never)]
61 //Throw excpetion if Dispose() is called in separate thread.
62 if (!Window.IsInstalled())
64 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
69 Dispose(DisposeTypes.Implicit);
73 Dispose(DisposeTypes.Explicit);
74 System.GC.SuppressFinalize(this);
78 protected virtual void Dispose(DisposeTypes type)
85 if (type == DisposeTypes.Explicit)
88 //Release your own managed resources here.
89 //You should release all of your own disposable objects here.
93 //Release your own unmanaged resources here.
94 //You should not access any managed member here except static instance.
95 //because the execution order of Finalizes is non-deterministic.
97 if (swigCPtr.Handle != global::System.IntPtr.Zero)
102 Interop.ItemIdContainer.delete_ItemIdContainer(swigCPtr);
104 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
110 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
111 [EditorBrowsable(EditorBrowsableState.Never)]
112 public ItemIdContainer(global::System.Collections.ICollection c) : this()
115 throw new global::System.ArgumentNullException("c");
116 foreach (uint element in c)
122 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
123 [EditorBrowsable(EditorBrowsableState.Never)]
124 public bool IsFixedSize
132 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
133 [EditorBrowsable(EditorBrowsableState.Never)]
134 public bool IsReadOnly
142 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
143 [EditorBrowsable(EditorBrowsableState.Never)]
144 public uint this[int index]
148 return getitem(index);
152 setitem(index, value);
156 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
157 [EditorBrowsable(EditorBrowsableState.Never)]
162 return (int)capacity();
167 throw new global::System.ArgumentOutOfRangeException("Capacity");
168 reserve((uint)value);
172 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
173 [EditorBrowsable(EditorBrowsableState.Never)]
182 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
183 [EditorBrowsable(EditorBrowsableState.Never)]
184 public bool IsSynchronized
192 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
193 [EditorBrowsable(EditorBrowsableState.Never)]
194 public void CopyTo(uint[] array)
196 CopyTo(0, array, 0, this.Count);
199 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
200 [EditorBrowsable(EditorBrowsableState.Never)]
201 public void CopyTo(uint[] array, int arrayIndex)
203 CopyTo(0, array, arrayIndex, this.Count);
206 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
207 [EditorBrowsable(EditorBrowsableState.Never)]
208 public void CopyTo(int index, uint[] array, int arrayIndex, int count)
211 throw new global::System.ArgumentNullException("array");
213 throw new global::System.ArgumentOutOfRangeException("index", "Value is less than zero");
215 throw new global::System.ArgumentOutOfRangeException("arrayIndex", "Value is less than zero");
217 throw new global::System.ArgumentOutOfRangeException("count", "Value is less than zero");
219 throw new global::System.ArgumentException("Multi dimensional array.", "array");
220 if (index + count > this.Count || arrayIndex + count > array.Length)
221 throw new global::System.ArgumentException("Number of elements to copy is too large.");
222 for (int i = 0; i < count; i++)
223 array.SetValue(getitemcopy(index + i), arrayIndex + i);
226 global::System.Collections.Generic.IEnumerator<uint> global::System.Collections.Generic.IEnumerable<uint>.GetEnumerator()
228 return new ItemIdContainerEnumerator(this);
231 global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
233 return new ItemIdContainerEnumerator(this);
236 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
237 [EditorBrowsable(EditorBrowsableState.Never)]
238 public ItemIdContainerEnumerator GetEnumerator()
240 return new ItemIdContainerEnumerator(this);
243 // The type-safe enumerator.
244 /// Note that the IEnumerator documentation requires an InvalidOperationException to be thrown
245 /// whenever the collection is modified. This has been done for changes in the size of the
246 /// collection, but not when one of the elements of the collection is modified as it is a bit
247 /// tricky to detect unmanaged code that modifies the collection under our feet.
248 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
249 [EditorBrowsable(EditorBrowsableState.Never)]
250 public sealed class ItemIdContainerEnumerator : global::System.Collections.IEnumerator
251 , global::System.Collections.Generic.IEnumerator<uint>
253 private ItemIdContainer collectionRef;
254 private int currentIndex;
255 private object currentObject;
256 private int currentSize;
258 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
259 [EditorBrowsable(EditorBrowsableState.Never)]
260 public ItemIdContainerEnumerator(ItemIdContainer collection)
262 collectionRef = collection;
264 currentObject = null;
265 currentSize = collectionRef.Count;
268 // Type-safe iterator Current
269 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
270 [EditorBrowsable(EditorBrowsableState.Never)]
275 if (currentIndex == -1)
276 throw new global::System.InvalidOperationException("Enumeration not started.");
277 if (currentIndex > currentSize - 1)
278 throw new global::System.InvalidOperationException("Enumeration finished.");
279 if (currentObject == null)
280 throw new global::System.InvalidOperationException("Collection modified.");
281 return (uint)currentObject;
285 // Type-unsafe IEnumerator.Current
286 object global::System.Collections.IEnumerator.Current
294 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
295 [EditorBrowsable(EditorBrowsableState.Never)]
296 public bool MoveNext()
298 int size = collectionRef.Count;
299 bool moveOkay = (currentIndex + 1 < size) && (size == currentSize);
303 currentObject = collectionRef[currentIndex];
307 currentObject = null;
312 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
313 [EditorBrowsable(EditorBrowsableState.Never)]
317 currentObject = null;
318 if (collectionRef.Count != currentSize)
320 throw new global::System.InvalidOperationException("Collection modified.");
324 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
325 [EditorBrowsable(EditorBrowsableState.Never)]
326 public void Dispose()
329 currentObject = null;
333 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
334 [EditorBrowsable(EditorBrowsableState.Never)]
337 Interop.ItemIdContainer.ItemIdContainer_Clear(swigCPtr);
338 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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)]
343 public void Add(uint x)
345 Interop.ItemIdContainer.ItemIdContainer_Add(swigCPtr, x);
346 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
351 uint ret = Interop.ItemIdContainer.ItemIdContainer_size(swigCPtr);
352 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
356 private uint capacity()
358 uint ret = Interop.ItemIdContainer.ItemIdContainer_capacity(swigCPtr);
359 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
363 private void reserve(uint n)
365 Interop.ItemIdContainer.ItemIdContainer_reserve(swigCPtr, n);
366 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
369 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
370 [EditorBrowsable(EditorBrowsableState.Never)]
371 public ItemIdContainer() : this(Interop.ItemIdContainer.new_ItemIdContainer__SWIG_0(), true)
373 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
376 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
377 [EditorBrowsable(EditorBrowsableState.Never)]
378 public ItemIdContainer(ItemIdContainer other) : this(Interop.ItemIdContainer.new_ItemIdContainer__SWIG_1(ItemIdContainer.getCPtr(other)), true)
380 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
383 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
384 [EditorBrowsable(EditorBrowsableState.Never)]
385 public ItemIdContainer(int capacity) : this(Interop.ItemIdContainer.new_ItemIdContainer__SWIG_2(capacity), true)
387 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
390 private uint getitemcopy(int index)
392 uint ret = Interop.ItemIdContainer.ItemIdContainer_getitemcopy(swigCPtr, index);
393 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
397 private uint getitem(int index)
399 uint ret = Interop.ItemIdContainer.ItemIdContainer_getitem(swigCPtr, index);
400 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
404 private void setitem(int index, uint val)
406 Interop.ItemIdContainer.ItemIdContainer_setitem(swigCPtr, index, val);
407 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
410 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
411 [EditorBrowsable(EditorBrowsableState.Never)]
412 public void AddRange(ItemIdContainer values)
414 Interop.ItemIdContainer.ItemIdContainer_AddRange(swigCPtr, ItemIdContainer.getCPtr(values));
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 ItemIdContainer GetRange(int index, int count)
422 global::System.IntPtr cPtr = Interop.ItemIdContainer.ItemIdContainer_GetRange(swigCPtr, index, count);
423 ItemIdContainer ret = (cPtr == global::System.IntPtr.Zero) ? null : new ItemIdContainer(cPtr, true);
424 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
428 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
429 [EditorBrowsable(EditorBrowsableState.Never)]
430 public void Insert(int index, uint x)
432 Interop.ItemIdContainer.ItemIdContainer_Insert(swigCPtr, index, x);
433 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 InsertRange(int index, ItemIdContainer values)
440 Interop.ItemIdContainer.ItemIdContainer_InsertRange(swigCPtr, index, ItemIdContainer.getCPtr(values));
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 RemoveAt(int index)
448 Interop.ItemIdContainer.ItemIdContainer_RemoveAt(swigCPtr, index);
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 RemoveRange(int index, int count)
456 Interop.ItemIdContainer.ItemIdContainer_RemoveRange(swigCPtr, index, count);
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 static ItemIdContainer Repeat(uint value, int count)
464 global::System.IntPtr cPtr = Interop.ItemIdContainer.ItemIdContainer_Repeat(value, count);
465 ItemIdContainer ret = (cPtr == global::System.IntPtr.Zero) ? null : new ItemIdContainer(cPtr, true);
466 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
470 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
471 [EditorBrowsable(EditorBrowsableState.Never)]
472 public void Reverse()
474 Interop.ItemIdContainer.ItemIdContainer_Reverse__SWIG_0(swigCPtr);
475 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(int index, int count)
482 Interop.ItemIdContainer.ItemIdContainer_Reverse__SWIG_1(swigCPtr, index, count);
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 SetRange(int index, ItemIdContainer values)
490 Interop.ItemIdContainer.ItemIdContainer_SetRange(swigCPtr, index, ItemIdContainer.getCPtr(values));
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 bool Contains(uint value)
498 bool ret = Interop.ItemIdContainer.ItemIdContainer_Contains(swigCPtr, value);
499 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
503 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
504 [EditorBrowsable(EditorBrowsableState.Never)]
505 public int IndexOf(uint value)
507 int ret = Interop.ItemIdContainer.ItemIdContainer_IndexOf(swigCPtr, value);
508 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
512 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
513 [EditorBrowsable(EditorBrowsableState.Never)]
514 public int LastIndexOf(uint value)
516 int ret = Interop.ItemIdContainer.ItemIdContainer_LastIndexOf(swigCPtr, value);
517 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
521 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
522 [EditorBrowsable(EditorBrowsableState.Never)]
523 public bool Remove(uint value)
525 bool ret = Interop.ItemIdContainer.ItemIdContainer_Remove(swigCPtr, value);
526 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();