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;
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 ItemContainer : Disposable, global::System.Collections.IEnumerable,
26 global::System.Collections.Generic.IEnumerable<Item>
29 internal ItemContainer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
33 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ItemContainer obj)
35 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
38 /// This will be public opened.
39 [EditorBrowsable(EditorBrowsableState.Never)]
40 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
42 Interop.ItemContainer.delete_ItemContainer(swigCPtr);
45 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
46 [EditorBrowsable(EditorBrowsableState.Never)]
47 public ItemContainer(global::System.Collections.ICollection c) : this()
50 throw new global::System.ArgumentNullException(nameof(c));
51 foreach (Item element in c)
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)]
59 public bool IsFixedSize
67 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
68 [EditorBrowsable(EditorBrowsableState.Never)]
69 public bool IsReadOnly
77 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
78 [EditorBrowsable(EditorBrowsableState.Never)]
79 public Item this[int index]
83 return getitem(index);
87 setitem(index, value);
91 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
92 [EditorBrowsable(EditorBrowsableState.Never)]
97 return (int)capacity();
102 throw new global::System.ArgumentOutOfRangeException("Capacity");
103 reserve((uint)value);
107 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
108 [EditorBrowsable(EditorBrowsableState.Never)]
117 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
118 [EditorBrowsable(EditorBrowsableState.Never)]
119 public bool IsSynchronized
127 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
128 [EditorBrowsable(EditorBrowsableState.Never)]
129 public void CopyTo(Item[] array)
131 CopyTo(0, array, 0, this.Count);
134 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
135 [EditorBrowsable(EditorBrowsableState.Never)]
136 public void CopyTo(Item[] array, int arrayIndex)
138 CopyTo(0, array, arrayIndex, this.Count);
141 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
142 [EditorBrowsable(EditorBrowsableState.Never)]
143 public void CopyTo(int index, Item[] array, int arrayIndex, int count)
146 throw new global::System.ArgumentNullException(nameof(array));
148 throw new global::System.ArgumentOutOfRangeException(nameof(index), "Value is less than zero");
150 throw new global::System.ArgumentOutOfRangeException(nameof(arrayIndex), "Value is less than zero");
152 throw new global::System.ArgumentOutOfRangeException(nameof(count), "Value is less than zero");
154 throw new global::System.ArgumentException("Multi dimensional array.", nameof(array));
155 if (index + count > this.Count || arrayIndex + count > array.Length)
156 throw new global::System.ArgumentException("Number of elements to copy is too large.");
157 for (int i = 0; i < count; i++)
158 array.SetValue(getitemcopy(index + i), arrayIndex + i);
161 global::System.Collections.Generic.IEnumerator<Item> global::System.Collections.Generic.IEnumerable<Item>.GetEnumerator()
163 return new ItemContainerEnumerator(this);
166 global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
168 return new ItemContainerEnumerator(this);
171 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
172 [EditorBrowsable(EditorBrowsableState.Never)]
173 public ItemContainerEnumerator GetEnumerator()
175 return new ItemContainerEnumerator(this);
178 // The type-safe enumerator.
179 /// Note that the IEnumerator documentation requires an InvalidOperationException to be thrown
180 /// whenever the collection is modified. This has been done for changes in the size of the
181 /// collection, but not when one of the elements of the collection is modified as it is a bit
182 /// tricky to detect unmanaged code that modifies the collection under our feet.
183 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
184 [EditorBrowsable(EditorBrowsableState.Never)]
185 public sealed class ItemContainerEnumerator : global::System.Collections.IEnumerator,
186 global::System.Collections.Generic.IEnumerator<Item>
188 private ItemContainer collectionRef;
189 private int currentIndex;
190 private object currentObject;
191 private int currentSize;
193 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
194 [EditorBrowsable(EditorBrowsableState.Never)]
195 public ItemContainerEnumerator(ItemContainer collection)
197 collectionRef = collection;
199 currentObject = null;
200 currentSize = collectionRef.Count;
203 // Type-safe iterator Current
204 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
205 [EditorBrowsable(EditorBrowsableState.Never)]
210 if (currentIndex == -1)
211 throw new global::System.InvalidOperationException("Enumeration not started.");
212 if (currentIndex > currentSize - 1)
213 throw new global::System.InvalidOperationException("Enumeration finished.");
214 if (currentObject == null)
215 throw new global::System.InvalidOperationException("Collection modified.");
216 return (Item)currentObject;
220 // Type-unsafe IEnumerator.Current
221 object global::System.Collections.IEnumerator.Current
229 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
230 [EditorBrowsable(EditorBrowsableState.Never)]
231 public bool MoveNext()
233 int size = collectionRef.Count;
234 bool moveOkay = (currentIndex + 1 < size) && (size == currentSize);
238 currentObject = collectionRef[currentIndex];
242 currentObject = null;
247 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
248 [EditorBrowsable(EditorBrowsableState.Never)]
252 currentObject = null;
253 if (collectionRef.Count != currentSize)
255 throw new global::System.InvalidOperationException("Collection modified.");
259 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
260 [EditorBrowsable(EditorBrowsableState.Never)]
261 public void Dispose()
264 currentObject = null;
268 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
269 [EditorBrowsable(EditorBrowsableState.Never)]
272 Interop.ItemContainer.ItemContainer_Clear(swigCPtr);
273 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
276 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
277 [EditorBrowsable(EditorBrowsableState.Never)]
278 public void Add(Item x)
280 Interop.ItemContainer.ItemContainer_Add(swigCPtr, Item.getCPtr(x));
281 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
286 uint ret = Interop.ItemContainer.ItemContainer_size(swigCPtr);
287 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
291 private uint capacity()
293 uint ret = Interop.ItemContainer.ItemContainer_capacity(swigCPtr);
294 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
298 private void reserve(uint n)
300 Interop.ItemContainer.ItemContainer_reserve(swigCPtr, n);
301 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
304 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
305 [EditorBrowsable(EditorBrowsableState.Never)]
306 public ItemContainer() : this(Interop.ItemContainer.new_ItemContainer__SWIG_0(), true)
308 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
311 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
312 [EditorBrowsable(EditorBrowsableState.Never)]
313 public ItemContainer(ItemContainer other) : this(Interop.ItemContainer.new_ItemContainer__SWIG_1(ItemContainer.getCPtr(other)), true)
315 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
318 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
319 [EditorBrowsable(EditorBrowsableState.Never)]
320 public ItemContainer(int capacity) : this(Interop.ItemContainer.new_ItemContainer__SWIG_2(capacity), true)
322 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
325 private Item getitemcopy(int index)
327 Item ret = new Item(Interop.ItemContainer.ItemContainer_getitemcopy(swigCPtr, index), true);
328 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
332 private Item getitem(int index)
334 Item ret = new Item(Interop.ItemContainer.ItemContainer_getitem(swigCPtr, index), false);
335 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
339 private void setitem(int index, Item val)
341 Interop.ItemContainer.ItemContainer_setitem(swigCPtr, index, Item.getCPtr(val));
342 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
345 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
346 [EditorBrowsable(EditorBrowsableState.Never)]
347 public void AddRange(ItemContainer values)
349 Interop.ItemContainer.ItemContainer_AddRange(swigCPtr, ItemContainer.getCPtr(values));
350 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
353 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
354 [EditorBrowsable(EditorBrowsableState.Never)]
355 public ItemContainer GetRange(int index, int count)
357 global::System.IntPtr cPtr = Interop.ItemContainer.ItemContainer_GetRange(swigCPtr, index, count);
358 ItemContainer ret = (cPtr == global::System.IntPtr.Zero) ? null : new ItemContainer(cPtr, true);
359 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
363 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
364 [EditorBrowsable(EditorBrowsableState.Never)]
365 public void Insert(int index, Item x)
367 Interop.ItemContainer.ItemContainer_Insert(swigCPtr, index, Item.getCPtr(x));
368 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
371 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
372 [EditorBrowsable(EditorBrowsableState.Never)]
373 public void InsertRange(int index, ItemContainer values)
375 Interop.ItemContainer.ItemContainer_InsertRange(swigCPtr, index, ItemContainer.getCPtr(values));
376 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
379 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
380 [EditorBrowsable(EditorBrowsableState.Never)]
381 public void RemoveAt(int index)
383 Interop.ItemContainer.ItemContainer_RemoveAt(swigCPtr, index);
384 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
387 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
388 [EditorBrowsable(EditorBrowsableState.Never)]
389 public void RemoveRange(int index, int count)
391 Interop.ItemContainer.ItemContainer_RemoveRange(swigCPtr, index, count);
392 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
395 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
396 [EditorBrowsable(EditorBrowsableState.Never)]
397 public static ItemContainer Repeat(Item value, int count)
399 global::System.IntPtr cPtr = Interop.ItemContainer.ItemContainer_Repeat(Item.getCPtr(value), count);
400 ItemContainer ret = (cPtr == global::System.IntPtr.Zero) ? null : new ItemContainer(cPtr, true);
401 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
405 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
406 [EditorBrowsable(EditorBrowsableState.Never)]
407 public void Reverse()
409 Interop.ItemContainer.ItemContainer_Reverse__SWIG_0(swigCPtr);
410 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
413 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
414 [EditorBrowsable(EditorBrowsableState.Never)]
415 public void Reverse(int index, int count)
417 Interop.ItemContainer.ItemContainer_Reverse__SWIG_1(swigCPtr, index, count);
418 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
421 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
422 [EditorBrowsable(EditorBrowsableState.Never)]
423 public void SetRange(int index, ItemContainer values)
425 Interop.ItemContainer.ItemContainer_SetRange(swigCPtr, index, ItemContainer.getCPtr(values));
426 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();