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.
20 internal class TouchPointContainer : Disposable, global::System.Collections.IEnumerable,
21 global::System.Collections.Generic.IEnumerable<TouchPoint>
23 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
24 protected bool swigCMemOwn;
26 internal TouchPointContainer(global::System.IntPtr cPtr, bool cMemoryOwn)
28 swigCMemOwn = cMemoryOwn;
29 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
32 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TouchPointContainer obj)
34 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
37 protected override void Dispose(DisposeTypes type)
44 //Release your own unmanaged resources here.
45 //You should not access any managed member here except static instance.
46 //because the execution order of Finalizes is non-deterministic.
48 if (swigCPtr.Handle != global::System.IntPtr.Zero)
53 Interop.TouchPointContainer.delete_TouchPointContainer(swigCPtr);
55 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
61 public TouchPointContainer(global::System.Collections.ICollection c) : this()
64 throw new global::System.ArgumentNullException("c");
65 foreach (TouchPoint element in c)
71 public bool IsFixedSize
79 public bool IsReadOnly
87 public TouchPoint this[int index]
91 return getitem(index);
95 setitem(index, value);
103 return (int)capacity();
108 throw new global::System.ArgumentOutOfRangeException("Capacity");
109 reserve((uint)value);
121 public bool IsSynchronized
129 public void CopyTo(TouchPoint[] array)
131 CopyTo(0, array, 0, this.Count);
134 public void CopyTo(TouchPoint[] array, int arrayIndex)
136 CopyTo(0, array, arrayIndex, this.Count);
139 public void CopyTo(int index, TouchPoint[] array, int arrayIndex, int count)
142 throw new global::System.ArgumentNullException("array");
144 throw new global::System.ArgumentOutOfRangeException("index", "Value is less than zero");
146 throw new global::System.ArgumentOutOfRangeException("arrayIndex", "Value is less than zero");
148 throw new global::System.ArgumentOutOfRangeException("count", "Value is less than zero");
150 throw new global::System.ArgumentException("Multi dimensional array.", "array");
151 if (index + count > this.Count || arrayIndex + count > array.Length)
152 throw new global::System.ArgumentException("Number of elements to copy is too large.");
153 for (int i = 0; i < count; i++)
154 array.SetValue(getitemcopy(index + i), arrayIndex + i);
157 global::System.Collections.Generic.IEnumerator<TouchPoint> global::System.Collections.Generic.IEnumerable<TouchPoint>.GetEnumerator()
159 return new TouchPointContainerEnumerator(this);
162 global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
164 return new TouchPointContainerEnumerator(this);
167 public TouchPointContainerEnumerator GetEnumerator()
169 return new TouchPointContainerEnumerator(this);
172 // The type-safe enumerator.
173 /// Note that the IEnumerator documentation requires an InvalidOperationException to be thrown
174 /// whenever the collection is modified. This has been done for changes in the size of the
175 /// collection, but not when one of the elements of the collection is modified as it is a bit
176 /// tricky to detect unmanaged code that modifies the collection under our feet.
177 /// <since_tizen> 3 </since_tizen>
178 public sealed class TouchPointContainerEnumerator : global::System.Collections.IEnumerator
179 , global::System.Collections.Generic.IEnumerator<TouchPoint>
181 private TouchPointContainer collectionRef;
182 private int currentIndex;
183 private object currentObject;
184 private int currentSize;
186 /// <since_tizen> 3 </since_tizen>
187 public TouchPointContainerEnumerator(TouchPointContainer collection)
189 collectionRef = collection;
191 currentObject = null;
192 currentSize = collectionRef.Count;
195 // Type-safe iterator Current
196 /// <since_tizen> 3 </since_tizen>
197 public TouchPoint Current
201 if (currentIndex == -1)
202 throw new global::System.InvalidOperationException("Enumeration not started.");
203 if (currentIndex > currentSize - 1)
204 throw new global::System.InvalidOperationException("Enumeration finished.");
205 if (currentObject == null)
206 throw new global::System.InvalidOperationException("Collection modified.");
207 return (TouchPoint)currentObject;
211 // Type-unsafe IEnumerator.Current
212 object global::System.Collections.IEnumerator.Current
220 /// <since_tizen> 3 </since_tizen>
221 public bool MoveNext()
223 int size = collectionRef.Count;
224 bool moveOkay = (currentIndex + 1 < size) && (size == currentSize);
228 currentObject = collectionRef[currentIndex];
232 currentObject = null;
237 /// <since_tizen> 3 </since_tizen>
241 currentObject = null;
242 if (collectionRef.Count != currentSize)
244 throw new global::System.InvalidOperationException("Collection modified.");
248 /// <since_tizen> 3 </since_tizen>
249 public void Dispose()
252 currentObject = null;
258 Interop.TouchPointContainer.TouchPointContainer_Clear(swigCPtr);
259 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
262 public void Add(TouchPoint x)
264 Interop.TouchPointContainer.TouchPointContainer_Add(swigCPtr, TouchPoint.getCPtr(x));
265 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
270 uint ret = Interop.TouchPointContainer.TouchPointContainer_size(swigCPtr);
271 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
275 private uint capacity()
277 uint ret = Interop.TouchPointContainer.TouchPointContainer_capacity(swigCPtr);
278 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
282 private void reserve(uint n)
284 Interop.TouchPointContainer.TouchPointContainer_reserve(swigCPtr, n);
285 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
288 public TouchPointContainer() : this(Interop.TouchPointContainer.new_TouchPointContainer__SWIG_0(), true)
290 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
293 public TouchPointContainer(TouchPointContainer other) : this(Interop.TouchPointContainer.new_TouchPointContainer__SWIG_1(TouchPointContainer.getCPtr(other)), true)
295 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
298 public TouchPointContainer(int capacity) : this(Interop.TouchPointContainer.new_TouchPointContainer__SWIG_2(capacity), true)
300 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
303 private TouchPoint getitemcopy(int index)
305 TouchPoint ret = new TouchPoint(Interop.TouchPointContainer.TouchPointContainer_getitemcopy(swigCPtr, index), true);
306 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
310 private TouchPoint getitem(int index)
312 TouchPoint ret = new TouchPoint(Interop.TouchPointContainer.TouchPointContainer_getitem(swigCPtr, index), false);
313 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
317 private void setitem(int index, TouchPoint val)
319 Interop.TouchPointContainer.TouchPointContainer_setitem(swigCPtr, index, TouchPoint.getCPtr(val));
320 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
323 public void AddRange(TouchPointContainer values)
325 Interop.TouchPointContainer.TouchPointContainer_AddRange(swigCPtr, TouchPointContainer.getCPtr(values));
326 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
329 public TouchPointContainer GetRange(int index, int count)
331 global::System.IntPtr cPtr = Interop.TouchPointContainer.TouchPointContainer_GetRange(swigCPtr, index, count);
332 TouchPointContainer ret = (cPtr == global::System.IntPtr.Zero) ? null : new TouchPointContainer(cPtr, true);
333 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
337 public void Insert(int index, TouchPoint x)
339 Interop.TouchPointContainer.TouchPointContainer_Insert(swigCPtr, index, TouchPoint.getCPtr(x));
340 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
343 public void InsertRange(int index, TouchPointContainer values)
345 Interop.TouchPointContainer.TouchPointContainer_InsertRange(swigCPtr, index, TouchPointContainer.getCPtr(values));
346 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
349 public void RemoveAt(int index)
351 Interop.TouchPointContainer.TouchPointContainer_RemoveAt(swigCPtr, index);
352 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
355 public void RemoveRange(int index, int count)
357 Interop.TouchPointContainer.TouchPointContainer_RemoveRange(swigCPtr, index, count);
358 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
361 public static TouchPointContainer Repeat(TouchPoint value, int count)
363 global::System.IntPtr cPtr = Interop.TouchPointContainer.TouchPointContainer_Repeat(TouchPoint.getCPtr(value), count);
364 TouchPointContainer ret = (cPtr == global::System.IntPtr.Zero) ? null : new TouchPointContainer(cPtr, true);
365 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
369 public void Reverse()
371 Interop.TouchPointContainer.TouchPointContainer_Reverse__SWIG_0(swigCPtr);
372 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
375 public void Reverse(int index, int count)
377 Interop.TouchPointContainer.TouchPointContainer_Reverse__SWIG_1(swigCPtr, index, count);
378 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
381 public void SetRange(int index, TouchPointContainer values)
383 Interop.TouchPointContainer.TouchPointContainer_SetRange(swigCPtr, index, TouchPointContainer.getCPtr(values));
384 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();