2 * Copyright(c) 2019 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;
22 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
23 [EditorBrowsable(EditorBrowsableState.Never)]
24 public class ItemIdCollection : Disposable, global::System.Collections.IEnumerable,
25 global::System.Collections.Generic.IList<uint>
28 internal ItemIdCollection(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
32 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ItemIdCollection obj)
34 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
37 /// This will be public opened.
38 [EditorBrowsable(EditorBrowsableState.Never)]
39 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
41 Interop.ItemIdContainer.DeleteItemIdContainer(swigCPtr);
44 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
45 [EditorBrowsable(EditorBrowsableState.Never)]
46 public ItemIdCollection(global::System.Collections.ICollection c) : this()
49 throw new global::System.ArgumentNullException(nameof(c));
50 foreach (uint element in c)
56 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
57 [EditorBrowsable(EditorBrowsableState.Never)]
58 public bool IsFixedSize
66 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
67 [EditorBrowsable(EditorBrowsableState.Never)]
68 public bool IsReadOnly
76 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
77 [EditorBrowsable(EditorBrowsableState.Never)]
78 public uint this[int index]
82 return getitem(index);
86 setitem(index, value);
90 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
91 [EditorBrowsable(EditorBrowsableState.Never)]
96 return (int)capacity();
101 throw new global::System.ArgumentOutOfRangeException("Capacity");
102 reserve((uint)value);
106 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
107 [EditorBrowsable(EditorBrowsableState.Never)]
116 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
117 [EditorBrowsable(EditorBrowsableState.Never)]
118 public bool IsSynchronized
126 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
127 [EditorBrowsable(EditorBrowsableState.Never)]
128 public void CopyTo(uint[] array)
130 CopyTo(0, array, 0, this.Count);
133 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
134 [EditorBrowsable(EditorBrowsableState.Never)]
135 public void CopyTo(uint[] array, int arrayIndex)
137 CopyTo(0, array, arrayIndex, this.Count);
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 void CopyTo(int index, uint[] array, int arrayIndex, int count)
145 throw new global::System.ArgumentNullException(nameof(array));
147 throw new global::System.ArgumentOutOfRangeException(nameof(index), "Value is less than zero");
149 throw new global::System.ArgumentOutOfRangeException(nameof(arrayIndex), "Value is less than zero");
151 throw new global::System.ArgumentOutOfRangeException(nameof(count), "Value is less than zero");
153 throw new global::System.ArgumentException("Multi dimensional array.", nameof(array));
154 if (index + count > this.Count || arrayIndex + count > array.Length)
155 throw new global::System.ArgumentException("Number of elements to copy is too large.");
156 for (int i = 0; i < count; i++)
157 array.SetValue(getitemcopy(index + i), arrayIndex + i);
160 global::System.Collections.Generic.IEnumerator<uint> global::System.Collections.Generic.IEnumerable<uint>.GetEnumerator()
162 return new ItemIdCollectionEnumerator(this);
165 global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
167 return new ItemIdCollectionEnumerator(this);
170 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
171 [EditorBrowsable(EditorBrowsableState.Never)]
172 public ItemIdCollectionEnumerator GetEnumerator()
174 return new ItemIdCollectionEnumerator(this);
177 // The type-safe enumerator.
178 /// Note that the IEnumerator documentation requires an InvalidOperationException to be thrown
179 /// whenever the collection is modified. This has been done for changes in the size of the
180 /// collection, but not when one of the elements of the collection is modified as it is a bit
181 /// tricky to detect unmanaged code that modifies the collection under our feet.
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 sealed class ItemIdCollectionEnumerator : global::System.Collections.IEnumerator
185 , global::System.Collections.Generic.IEnumerator<uint>
187 private ItemIdCollection collectionRef;
188 private int currentIndex;
189 private object currentObject;
190 private int currentSize;
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 ItemIdCollectionEnumerator(ItemIdCollection collection)
196 collectionRef = collection;
198 currentObject = null;
199 currentSize = collectionRef?.Count ?? 0;
202 // Type-safe iterator Current
203 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
204 [EditorBrowsable(EditorBrowsableState.Never)]
209 if (currentIndex == -1)
210 throw new global::System.InvalidOperationException("Enumeration not started.");
211 if (currentIndex > currentSize - 1)
212 throw new global::System.InvalidOperationException("Enumeration finished.");
213 if (currentObject == null)
214 throw new global::System.InvalidOperationException("Collection modified.");
215 return (uint)currentObject;
219 // Type-unsafe IEnumerator.Current
220 object global::System.Collections.IEnumerator.Current
228 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
229 [EditorBrowsable(EditorBrowsableState.Never)]
230 public bool MoveNext()
232 int size = collectionRef.Count;
233 bool moveOkay = (currentIndex + 1 < size) && (size == currentSize);
237 currentObject = collectionRef[currentIndex];
241 currentObject = null;
246 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
247 [EditorBrowsable(EditorBrowsableState.Never)]
251 currentObject = null;
252 if (collectionRef.Count != currentSize)
254 throw new global::System.InvalidOperationException("Collection modified.");
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 void Dispose()
263 currentObject = null;
267 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
268 [EditorBrowsable(EditorBrowsableState.Never)]
271 Interop.ItemIdContainer.Clear(swigCPtr);
272 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
275 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
276 [EditorBrowsable(EditorBrowsableState.Never)]
277 public void Add(uint x)
279 Interop.ItemIdContainer.Add(swigCPtr, x);
280 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
285 uint ret = Interop.ItemIdContainer.size(swigCPtr);
286 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
290 private uint capacity()
292 uint ret = Interop.ItemIdContainer.capacity(swigCPtr);
293 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
297 private void reserve(uint n)
299 Interop.ItemIdContainer.reserve(swigCPtr, n);
300 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
303 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
304 [EditorBrowsable(EditorBrowsableState.Never)]
305 public ItemIdCollection() : this(Interop.ItemIdContainer.NewItemIdContainer(), true)
307 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
310 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
311 [EditorBrowsable(EditorBrowsableState.Never)]
312 public ItemIdCollection(ItemIdCollection other) : this(Interop.ItemIdContainer.NewItemIdContainer(ItemIdCollection.getCPtr(other)), true)
314 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
317 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
318 [EditorBrowsable(EditorBrowsableState.Never)]
319 public ItemIdCollection(int capacity) : this(Interop.ItemIdContainer.NewItemIdContainer(capacity), true)
321 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
324 private uint getitemcopy(int index)
326 uint ret = Interop.ItemIdContainer.getitemcopy(swigCPtr, index);
327 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
331 private uint getitem(int index)
333 uint ret = Interop.ItemIdContainer.getitem(swigCPtr, index);
334 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
338 private void setitem(int index, uint val)
340 Interop.ItemIdContainer.setitem(swigCPtr, index, val);
341 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
344 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
345 [EditorBrowsable(EditorBrowsableState.Never)]
346 public void AddRange(ItemIdCollection values)
348 Interop.ItemIdContainer.AddRange(swigCPtr, ItemIdCollection.getCPtr(values));
349 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
352 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
353 [EditorBrowsable(EditorBrowsableState.Never)]
354 public ItemIdCollection GetRange(int index, int count)
356 global::System.IntPtr cPtr = Interop.ItemIdContainer.GetRange(swigCPtr, index, count);
357 ItemIdCollection ret = (cPtr == global::System.IntPtr.Zero) ? null : new ItemIdCollection(cPtr, true);
358 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
362 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
363 [EditorBrowsable(EditorBrowsableState.Never)]
364 public void Insert(int index, uint x)
366 Interop.ItemIdContainer.Insert(swigCPtr, index, x);
367 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
370 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
371 [EditorBrowsable(EditorBrowsableState.Never)]
372 public void InsertRange(int index, ItemIdCollection values)
374 Interop.ItemIdContainer.InsertRange(swigCPtr, index, ItemIdCollection.getCPtr(values));
375 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
378 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
379 [EditorBrowsable(EditorBrowsableState.Never)]
380 public void RemoveAt(int index)
382 Interop.ItemIdContainer.RemoveAt(swigCPtr, index);
383 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
386 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
387 [EditorBrowsable(EditorBrowsableState.Never)]
388 public void RemoveRange(int index, int count)
390 Interop.ItemIdContainer.RemoveRange(swigCPtr, index, count);
391 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
394 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
395 [EditorBrowsable(EditorBrowsableState.Never)]
396 public static ItemIdCollection Repeat(uint value, int count)
398 global::System.IntPtr cPtr = Interop.ItemIdContainer.Repeat(value, count);
399 ItemIdCollection ret = (cPtr == global::System.IntPtr.Zero) ? null : new ItemIdCollection(cPtr, true);
400 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
404 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
405 [EditorBrowsable(EditorBrowsableState.Never)]
406 public void Reverse()
408 Interop.ItemIdContainer.Reverse(swigCPtr);
409 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
412 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
413 [EditorBrowsable(EditorBrowsableState.Never)]
414 public void Reverse(int index, int count)
416 Interop.ItemIdContainer.Reverse(swigCPtr, index, count);
417 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
420 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
421 [EditorBrowsable(EditorBrowsableState.Never)]
422 public void SetRange(int index, ItemIdCollection values)
424 Interop.ItemIdContainer.SetRange(swigCPtr, index, ItemIdCollection.getCPtr(values));
425 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 bool Contains(uint value)
432 bool ret = Interop.ItemIdContainer.Contains(swigCPtr, value);
433 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
437 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
438 [EditorBrowsable(EditorBrowsableState.Never)]
439 public int IndexOf(uint value)
441 int ret = Interop.ItemIdContainer.IndexOf(swigCPtr, value);
442 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
446 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
447 [EditorBrowsable(EditorBrowsableState.Never)]
448 public int LastIndexOf(uint value)
450 int ret = Interop.ItemIdContainer.LastIndexOf(swigCPtr, value);
451 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
455 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
456 [EditorBrowsable(EditorBrowsableState.Never)]
457 public bool Remove(uint value)
459 bool ret = Interop.ItemIdContainer.Remove(swigCPtr, value);
460 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();