0727218d9386434c3e63db3d62608da0a8f5b185
[platform/core/uifw/dali-csharp-binder.git] / dali-csharp-binder / src / component-application-wrap.cpp
1 /*\r
2  * Copyright (c) 2020 Samsung Electronics Co., Ltd.\r
3  *\r
4  * Licensed under the Apache License, Version 2.0 (the "License");\r
5  * you may not use this file except in compliance with the License.\r
6  * You may obtain a copy of the License at\r
7  *\r
8  * http://www.apache.org/licenses/LICENSE-2.0\r
9  *\r
10  * Unless required by applicable law or agreed to in writing, software\r
11  * distributed under the License is distributed on an "AS IS" BASIS,\r
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
13  * See the License for the specific language governing permissions and\r
14  * limitations under the License.\r
15  *\r
16  */\r
17 \r
18 // EXTERNAL INCLUDES\r
19 #include <dali/dali.h>\r
20 #include <dali/devel-api/adaptor-framework/component-application.h>\r
21 \r
22 // INTERNAL INCLUDES\r
23 #include "common.h"\r
24 \r
25 #ifdef __cplusplus\r
26 extern "C" {\r
27 #endif\r
28 \r
29 int argC = 1;\r
30 char **argV = NULL;\r
31 \r
32 typedef void* (*CreateNativeSignalType)();\r
33 CreateNativeSignalType callback;\r
34 \r
35 Dali::Any CreateNativeSignalCallbackWrapper()\r
36 {\r
37   return callback();\r
38 }\r
39 \r
40 SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_new_ComponentApplication(int jarg1, char * jarg2, char * jarg3) {\r
41   void * jresult ;\r
42   int *arg1 = (int *) 0 ;\r
43   char ***arg2 ;\r
44   std::string *arg3 = 0 ;\r
45   Dali::ComponentApplication result;\r
46   {\r
47     int index = 0;\r
48     int length = 0;\r
49     char *retPtr;\r
50     char *nextPtr;\r
51     argC = jarg1;\r
52     argV = new char*[jarg1 + 1];\r
53 \r
54     retPtr = strtok_r( jarg2, " ", &nextPtr);\r
55     if( retPtr )\r
56     {\r
57       length = strlen(retPtr);\r
58     }\r
59     argV[index] = new char[length + 1];\r
60     if( retPtr )\r
61     {\r
62       strncpy(argV[index], retPtr, length);\r
63     }\r
64     argV[index][length] = '\0';\r
65     index++;\r
66 \r
67     while (index < jarg1)\r
68     {\r
69       length = 0;\r
70       retPtr = strtok_r(NULL, " ", &nextPtr);\r
71       if( retPtr )\r
72       {\r
73         length = strlen(retPtr);\r
74       }\r
75       argV[index] = new char[length + 1];\r
76       if( retPtr )\r
77       {\r
78         strncpy(argV[index], retPtr, length);\r
79       }\r
80       argV[index][length] = '\0';\r
81       index++;\r
82     }\r
83 \r
84     argV[jarg1] = NULL;\r
85     argC = jarg1;\r
86 \r
87     arg1 = &argC;\r
88     arg2 = &argV;\r
89   }\r
90 \r
91   if (!jarg3) {\r
92     SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null string", 0);\r
93     return 0;\r
94   }\r
95   std::string arg3_str(jarg3);\r
96   arg3 = &arg3_str;\r
97   {\r
98     try {\r
99       result = Dali::ComponentApplication::New(arg1,arg2,(std::string const &)*arg3);\r
100     } CALL_CATCH_EXCEPTION(0);\r
101   }\r
102   jresult = new Dali::ComponentApplication((const Dali::ComponentApplication &)result);\r
103 \r
104   return jresult;\r
105 }\r
106 \r
107 SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_new_ComponentApplication_SWIG1(void * jarg1) {\r
108   void * jresult ;\r
109   Dali::ComponentApplication *arg1 = 0 ;\r
110   Dali::ComponentApplication *result = 0 ;\r
111 \r
112   arg1 = (Dali::ComponentApplication *)jarg1;\r
113   if (!arg1) {\r
114     SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Dali::ComponentApplication const & type is null", 0);\r
115     return 0;\r
116   }\r
117   {\r
118     try {\r
119       result = (Dali::ComponentApplication *)new Dali::ComponentApplication((Dali::ComponentApplication const &)*arg1);\r
120     } CALL_CATCH_EXCEPTION(0);\r
121   }\r
122   jresult = (void *)result;\r
123   return jresult;\r
124 }\r
125 \r
126 \r
127 SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_assign_ComponentApplication(void * jarg1, void * jarg2) {\r
128   void * jresult ;\r
129   Dali::ComponentApplication *arg1 = (Dali::ComponentApplication *) 0 ;\r
130   Dali::ComponentApplication *arg2 = 0 ;\r
131   Dali::ComponentApplication *result = 0 ;\r
132 \r
133   arg1 = (Dali::ComponentApplication *)jarg1;\r
134   arg2 = (Dali::ComponentApplication *)jarg2;\r
135   if (!arg2) {\r
136     SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Dali::ComponentApplication const & type is null", 0);\r
137     return 0;\r
138   }\r
139   {\r
140     try {\r
141       result = (Dali::ComponentApplication *) &(arg1)->operator =((Dali::ComponentApplication const &)*arg2);\r
142     } CALL_CATCH_EXCEPTION(0);\r
143   }\r
144   jresult = (void *)result;\r
145   return jresult;\r
146 }\r
147 \r
148 SWIGEXPORT void SWIGSTDCALL CSharp_Dali_delete_ComponentApplication(void * jarg1) {\r
149   Dali::ComponentApplication *arg1 = (Dali::ComponentApplication *) 0 ;\r
150 \r
151   arg1 = (Dali::ComponentApplication *)jarg1;\r
152   {\r
153     try {\r
154       delete arg1;\r
155       if( argV )\r
156       {\r
157         // free string data\r
158         for( int i=0; i < argC+1; i++)\r
159         {\r
160           delete [] argV[i];\r
161         }\r
162         delete [] argV;\r
163       }\r
164     } CALL_CATCH_EXCEPTION();\r
165   }\r
166 }\r
167 \r
168 SWIGEXPORT void* SWIGSTDCALL CSharp_Dali_ComponentApplication_CreateNativeSignal(void * jarg1) {\r
169   void* jresult ;\r
170   Dali::ComponentApplication *arg1 = (Dali::ComponentApplication *) 0 ;\r
171   Dali::ComponentApplication::CreateSignalType *result = 0 ;\r
172 \r
173   arg1 = (Dali::ComponentApplication *)jarg1;\r
174   {\r
175     try {\r
176       result = (Dali::ComponentApplication::CreateSignalType *) &(arg1)->CreateSignal();\r
177     } CALL_CATCH_EXCEPTION(0);\r
178   }\r
179 \r
180   jresult = (void*)result;\r
181   return jresult;\r
182 }\r
183 \r
184 SWIGEXPORT void SWIGSTDCALL CSharp_Dali_ComponentApplication_CreateNativeSignal_Connect(void * jarg1, void * jarg2) {\r
185   Dali::ComponentApplication *arg1 = (Dali::ComponentApplication *) 0 ;\r
186   arg1 = (Dali::ComponentApplication *)jarg1;\r
187 \r
188   callback = (CreateNativeSignalType) jarg2;\r
189   {\r
190     try {\r
191       (arg1)->CreateSignal().Connect(CreateNativeSignalCallbackWrapper);\r
192     } CALL_CATCH_EXCEPTION();\r
193   }\r
194 }\r
195 \r
196 SWIGEXPORT void SWIGSTDCALL CSharp_Dali_ComponentApplication_CreateNativeSignal_Disconnect(void * jarg1, void * jarg2) {\r
197   Dali::ComponentApplication *arg1 = (Dali::ComponentApplication *) 0 ;\r
198   arg1 = (Dali::ComponentApplication *)jarg1;\r
199 \r
200   {\r
201     try {\r
202       (arg1)->CreateSignal().Disconnect(CreateNativeSignalCallbackWrapper);\r
203     } CALL_CATCH_EXCEPTION();\r
204   }\r
205 }\r
206 #ifdef __cplusplus\r
207 }\r
208 #endif\r
209 \r