[NUI] Reduce code duplication - refactor dispose codes (#1010)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / VectorUnsignedChar.cs
1 /*
2  * Copyright(c) 2017 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 namespace Tizen.NUI
19 {
20     internal class VectorUnsignedChar : Disposable
21     {
22         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
23         protected bool swigCMemOwn;
24
25         internal VectorUnsignedChar(global::System.IntPtr cPtr, bool cMemoryOwn)
26         {
27             swigCMemOwn = cMemoryOwn;
28             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
29         }
30
31         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(VectorUnsignedChar obj)
32         {
33             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
34         }
35
36         protected override void Dispose(DisposeTypes type)
37         {
38             if (disposed)
39             {
40                 return;
41             }
42
43             //Release your own unmanaged resources here.
44             //You should not access any managed member here except static instance.
45             //because the execution order of Finalizes is non-deterministic.
46
47             if (swigCPtr.Handle != global::System.IntPtr.Zero)
48             {
49                 if (swigCMemOwn)
50                 {
51                     swigCMemOwn = false;
52                     Interop.VectorUnsignedChar.delete_VectorUnsignedChar(swigCPtr);
53                 }
54                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
55             }
56
57             base.Dispose(type);
58         }
59
60         public VectorUnsignedChar() : this(Interop.VectorUnsignedChar.new_VectorUnsignedChar__SWIG_0(), true)
61         {
62             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
63         }
64
65         public VectorUnsignedChar(VectorUnsignedChar vector) : this(Interop.VectorUnsignedChar.new_VectorUnsignedChar__SWIG_1(VectorUnsignedChar.getCPtr(vector)), true)
66         {
67             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
68         }
69
70         public VectorUnsignedChar Assign(VectorUnsignedChar vector)
71         {
72             VectorUnsignedChar ret = new VectorUnsignedChar(Interop.VectorUnsignedChar.VectorUnsignedChar_Assign(swigCPtr, VectorUnsignedChar.getCPtr(vector)), false);
73             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
74             return ret;
75         }
76
77         internal SWIGTYPE_p_unsigned_char Begin()
78         {
79             global::System.IntPtr cPtr = Interop.VectorUnsignedChar.VectorUnsignedChar_Begin(swigCPtr);
80             SWIGTYPE_p_unsigned_char ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
81             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
82             return ret;
83         }
84
85         internal SWIGTYPE_p_unsigned_char End()
86         {
87             global::System.IntPtr cPtr = Interop.VectorUnsignedChar.VectorUnsignedChar_End(swigCPtr);
88             SWIGTYPE_p_unsigned_char ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
89             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
90             return ret;
91         }
92
93         internal SWIGTYPE_p_unsigned_char ValueOfIndex(uint index)
94         {
95             SWIGTYPE_p_unsigned_char ret = new SWIGTYPE_p_unsigned_char(Interop.VectorUnsignedChar.VectorUnsignedChar_ValueOfIndex__SWIG_0(swigCPtr, index), false);
96             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
97             return ret;
98         }
99
100         public void PushBack(byte element)
101         {
102             Interop.VectorUnsignedChar.VectorUnsignedChar_PushBack(swigCPtr, element);
103             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
104         }
105
106         public void Insert(byte[] at, byte element)
107         {
108             Interop.VectorUnsignedChar.VectorUnsignedChar_Insert__SWIG_0(swigCPtr, at, element);
109             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
110         }
111
112         internal void Insert(byte[] at, SWIGTYPE_p_unsigned_char from, SWIGTYPE_p_unsigned_char to)
113         {
114             Interop.VectorUnsignedChar.VectorUnsignedChar_Insert__SWIG_1(swigCPtr, at, SWIGTYPE_p_unsigned_char.getCPtr(from), SWIGTYPE_p_unsigned_char.getCPtr(to));
115             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
116         }
117
118         public void Reserve(uint count)
119         {
120             Interop.VectorUnsignedChar.VectorUnsignedChar_Reserve(swigCPtr, count);
121             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
122         }
123
124         public void Resize(uint count)
125         {
126             Interop.VectorUnsignedChar.VectorUnsignedChar_Resize__SWIG_0(swigCPtr, count);
127             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
128         }
129
130         public void Resize(uint count, byte item)
131         {
132             Interop.VectorUnsignedChar.VectorUnsignedChar_Resize__SWIG_1(swigCPtr, count, item);
133             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
134         }
135
136         internal SWIGTYPE_p_unsigned_char Erase(byte[] iterator)
137         {
138             global::System.IntPtr cPtr = Interop.VectorUnsignedChar.VectorUnsignedChar_Erase__SWIG_0(swigCPtr, iterator);
139             SWIGTYPE_p_unsigned_char ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
140             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
141             return ret;
142         }
143
144         internal SWIGTYPE_p_unsigned_char Erase(byte[] first, SWIGTYPE_p_unsigned_char last)
145         {
146             global::System.IntPtr cPtr = Interop.VectorUnsignedChar.VectorUnsignedChar_Erase__SWIG_1(swigCPtr, first, SWIGTYPE_p_unsigned_char.getCPtr(last));
147             SWIGTYPE_p_unsigned_char ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
148             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
149             return ret;
150         }
151
152         public void Remove(byte[] iterator)
153         {
154             Interop.VectorUnsignedChar.VectorUnsignedChar_Remove(swigCPtr, iterator);
155             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
156         }
157
158         public void Swap(VectorUnsignedChar vector)
159         {
160             Interop.VectorUnsignedChar.VectorUnsignedChar_Swap(swigCPtr, VectorUnsignedChar.getCPtr(vector));
161             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
162         }
163
164         public void Clear()
165         {
166             Interop.VectorUnsignedChar.VectorUnsignedChar_Clear(swigCPtr);
167             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
168         }
169
170         public void Release()
171         {
172             Interop.VectorUnsignedChar.VectorUnsignedChar_Release(swigCPtr);
173             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
174         }
175
176         public static readonly int BaseType = Interop.VectorUnsignedChar.VectorUnsignedChar_BaseType_get();
177     }
178 }