63cb1d1494000e4be387b7764915f6be2293c678
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / Interop / NDalicPINVOKE.cs
1 /*
2  * Copyright(c) 2018 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
21     class NDalicPINVOKE
22     {
23         public const string Lib = "libdali2-csharp-binder.so";
24         protected class SWIGExceptionHelper
25         {
26             /// <since_tizen> 3 </since_tizen>
27             public delegate void ExceptionDelegate(string message);
28             /// <since_tizen> 3 </since_tizen>
29             public delegate void ExceptionArgumentDelegate(string message, string paramName);
30             static ExceptionDelegate applicationDelegate = new ExceptionDelegate(SetPendingApplicationException);
31             static ExceptionDelegate arithmeticDelegate = new ExceptionDelegate(SetPendingArithmeticException);
32             static ExceptionDelegate divideByZeroDelegate = new ExceptionDelegate(SetPendingDivideByZeroException);
33             static ExceptionDelegate indexOutOfRangeDelegate = new ExceptionDelegate(SetPendingIndexOutOfRangeException);
34             static ExceptionDelegate invalidCastDelegate = new ExceptionDelegate(SetPendingInvalidCastException);
35             static ExceptionDelegate invalidOperationDelegate = new ExceptionDelegate(SetPendingInvalidOperationException);
36             static ExceptionDelegate ioDelegate = new ExceptionDelegate(SetPendingIOException);
37             static ExceptionDelegate nullReferenceDelegate = new ExceptionDelegate(SetPendingNullReferenceException);
38             static ExceptionDelegate outOfMemoryDelegate = new ExceptionDelegate(SetPendingOutOfMemoryException);
39             static ExceptionDelegate overflowDelegate = new ExceptionDelegate(SetPendingOverflowException);
40             static ExceptionDelegate systemDelegate = new ExceptionDelegate(SetPendingSystemException);
41             static ExceptionArgumentDelegate argumentDelegate = new ExceptionArgumentDelegate(SetPendingArgumentException);
42             static ExceptionArgumentDelegate argumentNullDelegate = new ExceptionArgumentDelegate(SetPendingArgumentNullException);
43             static ExceptionArgumentDelegate argumentOutOfRangeDelegate = new ExceptionArgumentDelegate(SetPendingArgumentOutOfRangeException);
44
45             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "SWIGRegisterExceptionCallbacks_NDalic")]
46             public static extern void SWIGRegisterExceptionCallbacksNDalic(
47                                         ExceptionDelegate applicationDelegate,
48                                         ExceptionDelegate arithmeticDelegate,
49                                         ExceptionDelegate divideByZeroDelegate,
50                                         ExceptionDelegate indexOutOfRangeDelegate,
51                                         ExceptionDelegate invalidCastDelegate,
52                                         ExceptionDelegate invalidOperationDelegate,
53                                         ExceptionDelegate ioDelegate,
54                                         ExceptionDelegate nullReferenceDelegate,
55                                         ExceptionDelegate outOfMemoryDelegate,
56                                         ExceptionDelegate overflowDelegate,
57                                         ExceptionDelegate systemExceptionDelegate);
58
59             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "SWIGRegisterExceptionArgumentCallbacks_NDalic")]
60             public static extern void SWIGRegisterExceptionArgumentCallbacksNDalic(
61                                         ExceptionArgumentDelegate argumentDelegate,
62                                         ExceptionArgumentDelegate argumentNullDelegate,
63                                         ExceptionArgumentDelegate argumentOutOfRangeDelegate);
64             static void SetPendingApplicationException(string message)
65             {
66                 SWIGPendingException.Set(new global::System.ApplicationException(message, SWIGPendingException.Retrieve()));
67             }
68             static void SetPendingArithmeticException(string message)
69             {
70                 SWIGPendingException.Set(new global::System.ArithmeticException(message, SWIGPendingException.Retrieve()));
71             }
72             static void SetPendingDivideByZeroException(string message)
73             {
74                 SWIGPendingException.Set(new global::System.DivideByZeroException(message, SWIGPendingException.Retrieve()));
75             }
76             static void SetPendingIndexOutOfRangeException(string message)
77             {
78                 SWIGPendingException.Set(new global::System.IndexOutOfRangeException(message, SWIGPendingException.Retrieve()));
79             }
80             static void SetPendingInvalidCastException(string message)
81             {
82                 SWIGPendingException.Set(new global::System.InvalidCastException(message, SWIGPendingException.Retrieve()));
83             }
84             static void SetPendingInvalidOperationException(string message)
85             {
86                 SWIGPendingException.Set(new global::System.InvalidOperationException(message, SWIGPendingException.Retrieve()));
87             }
88             static void SetPendingIOException(string message)
89             {
90                 SWIGPendingException.Set(new global::System.IO.IOException(message, SWIGPendingException.Retrieve()));
91             }
92             static void SetPendingNullReferenceException(string message)
93             {
94                 SWIGPendingException.Set(new global::System.NullReferenceException(message, SWIGPendingException.Retrieve()));
95             }
96             static void SetPendingOutOfMemoryException(string message)
97             {
98                 SWIGPendingException.Set(new global::System.OutOfMemoryException(message, SWIGPendingException.Retrieve()));
99             }
100             static void SetPendingOverflowException(string message)
101             {
102                 SWIGPendingException.Set(new global::System.OverflowException(message, SWIGPendingException.Retrieve()));
103             }
104             static void SetPendingSystemException(string message)
105             {
106                 SWIGPendingException.Set(new global::System.SystemException(message, SWIGPendingException.Retrieve()));
107             }
108
109             static void SetPendingArgumentException(string message, string paramName)
110             {
111                 SWIGPendingException.Set(new global::System.ArgumentException(message, paramName, SWIGPendingException.Retrieve()));
112             }
113             static void SetPendingArgumentNullException(string message, string paramName)
114             {
115                 global::System.Exception e = SWIGPendingException.Retrieve();
116                 if (e != null) message = message + " Inner Exception: " + e.Message;
117                 SWIGPendingException.Set(new global::System.ArgumentNullException(message, paramName));
118             }
119             static void SetPendingArgumentOutOfRangeException(string message, string paramName)
120             {
121                 global::System.Exception e = SWIGPendingException.Retrieve();
122                 if (e != null) message = message + " Inner Exception: " + e.Message;
123                 SWIGPendingException.Set(new global::System.ArgumentOutOfRangeException(paramName, message));
124             }
125             static SWIGExceptionHelper()
126             {
127                 SWIGRegisterExceptionCallbacksNDalic(
128                                           applicationDelegate,
129                                           arithmeticDelegate,
130                                           divideByZeroDelegate,
131                                           indexOutOfRangeDelegate,
132                                           invalidCastDelegate,
133                                           invalidOperationDelegate,
134                                           ioDelegate,
135                                           nullReferenceDelegate,
136                                           outOfMemoryDelegate,
137                                           overflowDelegate,
138                                           systemDelegate);
139
140                 SWIGRegisterExceptionArgumentCallbacksNDalic(
141                                           argumentDelegate,
142                                           argumentNullDelegate,
143                                           argumentOutOfRangeDelegate);
144             }
145         }
146         protected static SWIGExceptionHelper swigExceptionHelper = new SWIGExceptionHelper();
147
148         /// <since_tizen> 3 </since_tizen>
149         public class SWIGPendingException
150         {
151             [global::System.ThreadStatic]
152             private static global::System.Exception pendingException = null;
153             private static int numExceptionsPending = 0;
154             private static readonly object exceptionPendingLock = new object();
155
156             /// <since_tizen> 3 </since_tizen>
157             public static bool Pending
158             {
159                 get
160                 {
161                     bool pending = false;
162                     if (numExceptionsPending > 0)
163                         if (pendingException != null)
164                             pending = true;
165                     return pending;
166                 }
167             }
168
169             /// <since_tizen> 3 </since_tizen>
170             public static void Set(global::System.Exception e)
171             {
172                 if (pendingException != null)
173                     throw new global::System.ApplicationException("FATAL: An earlier pending exception from unmanaged code was missed and thus not thrown (" + pendingException.ToString() + ")", e);
174                 pendingException = e;
175                 lock (exceptionPendingLock)
176                 {
177                     numExceptionsPending++;
178                 }
179             }
180
181             /// <since_tizen> 3 </since_tizen>
182             public static global::System.Exception Retrieve()
183             {
184                 global::System.Exception e = null;
185                 if (numExceptionsPending > 0)
186                 {
187                     if (pendingException != null)
188                     {
189                         e = pendingException;
190                         pendingException = null;
191                         lock (exceptionPendingLock)
192                         {
193                             numExceptionsPending--;
194                         }
195                     }
196                 }
197                 if (e == null)
198                 {
199                     e = new global::System.ApplicationException($"FATAL: Exception e is null, numExceptionsPending : {numExceptionsPending}");
200                 }
201                 return e;
202             }
203         }
204         public class SWIGStringHelper
205         {
206             /// <since_tizen> 3 </since_tizen>
207             public delegate string SWIGStringDelegate(string message);
208             static SWIGStringDelegate stringDelegate = new SWIGStringDelegate(CreateString);
209
210             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "SWIGRegisterStringCallback_NDalic")]
211             public static extern void SWIGRegisterStringCallbackNDalic(SWIGStringDelegate stringDelegate);
212             static string CreateString(string cString)
213             {
214                 return cString;
215             }
216             static SWIGStringHelper()
217             {
218                 SWIGRegisterStringCallbackNDalic(stringDelegate);
219             }
220         }
221         static protected SWIGStringHelper swigStringHelper = new SWIGStringHelper();
222         static NDalicPINVOKE()
223         {
224         }
225
226         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_BaseHandle")]
227         public static extern void DeleteBaseHandle(global::System.Runtime.InteropServices.HandleRef jarg1);
228
229         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_SWIGUpcast")]
230         public static extern global::System.IntPtr ApplicationUpcast(global::System.IntPtr jarg1);
231
232         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_New__MANUAL_4")]
233         public static extern global::System.IntPtr ApplicationNewManual4(int jarg1, string jarg2, string jarg3, int jarg4);
234
235         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_New_WithWindowSizePosition")]
236         public static extern global::System.IntPtr ApplicationNewWithWindowSizePosition(int jarg1, string jarg2, string jarg3, int jarg4, global::System.Runtime.InteropServices.HandleRef jarg5);
237
238         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_MainLoop__SWIG_0")]
239         public static extern void ApplicationMainLoop(global::System.Runtime.InteropServices.HandleRef jarg1);
240
241         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_InitSignal")]
242         public static extern global::System.IntPtr ApplicationInitSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
243
244         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_TerminateSignal")]
245         public static extern global::System.IntPtr ApplicationTerminateSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
246
247         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_PauseSignal")]
248         public static extern global::System.IntPtr ApplicationPauseSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
249
250         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_ResumeSignal")]
251         public static extern global::System.IntPtr ApplicationResumeSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
252
253         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_ResetSignal")]
254         public static extern global::System.IntPtr ApplicationResetSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
255
256         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_AppControlSignal")]
257         public static extern global::System.IntPtr ApplicationAppControlSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
258
259         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_LanguageChangedSignal")]
260         public static extern global::System.IntPtr ApplicationLanguageChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
261
262         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_RegionChangedSignal")]
263         public static extern global::System.IntPtr ApplicationRegionChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
264
265         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_LowBatterySignal")]
266         public static extern global::System.IntPtr ApplicationLowBatterySignal(global::System.Runtime.InteropServices.HandleRef jarg1);
267
268         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_LowMemorySignal")]
269         public static extern global::System.IntPtr ApplicationLowMemorySignal(global::System.Runtime.InteropServices.HandleRef jarg1);
270     }
271 }