Fix svace issue : nullptr check for inputMethodContextP
[platform/core/uifw/dali-csharp-binder.git] / dali-csharp-binder / dali-physics-3d / physics-actor-3d-wrap.cpp
1 /*
2  * Copyright (c) 2023 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 // EXTERNAL INCLUDES
18 #include <dali-physics/public-api/physics-actor.h>
19 #include <dali-physics/public-api/physics-adaptor.h>
20 #include <btBulletDynamicsCommon.h>
21
22 // INTERNAL INCLUDES
23 #include <dali-csharp-binder/common/common.h>
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29   using Dali::Toolkit::Physics::PhysicsActor;
30   using Dali::Toolkit::Physics::PhysicsAdaptor;
31
32   SWIGEXPORT void* SWIGSTDCALL CSharp_Dali_new_PhysicsActor__SWIG_0()
33   {
34     void*        jresult;
35     PhysicsActor* result = 0;
36
37     {
38       try
39       {
40         result = (PhysicsActor*)new PhysicsActor();
41       }
42       CALL_CATCH_EXCEPTION(0);
43     }
44
45     jresult = (void*)result;
46     return jresult;
47   }
48
49   SWIGEXPORT void* SWIGSTDCALL CSharp_Dali_PhysicsActor_New(void* csActor, void* csBody, void* csAdaptor)
50   {
51     PhysicsActor result;
52
53     if(!csActor)
54     {
55       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "PhysicsActor const & type is null", 0);
56       return 0;
57     }
58     if(!csBody)
59     {
60       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "btRigidBody ptr is null", 0);
61       return 0;
62     }
63     if(!csAdaptor)
64     {
65       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "PhysicsAdaptor const & type is null", 0);
66       return 0;
67     }
68
69     {
70       try
71       {
72         // Stack allocate a handle
73         result = PhysicsActor::New(*(Dali::Actor*)(csActor), Dali::Any((btRigidBody*)csBody), *(PhysicsAdaptor*)csAdaptor);
74       }
75       CALL_CATCH_EXCEPTION(0);
76     }
77
78     // Heap allocate a handle using copy constructor
79     return new PhysicsActor((const PhysicsActor&)result);
80   }
81
82   SWIGEXPORT void* SWIGSTDCALL CSharp_Dali_PhysicsActor_DownCast(void* csHandle)
83   {
84     Dali::BaseHandle* handle = (Dali::BaseHandle*)csHandle;
85     PhysicsActor result;
86
87     if(!handle)
88     {
89       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::BaseHandle", 0);
90       return 0;
91     }
92     {
93       try
94       {
95         result = PhysicsActor::DownCast(*handle);
96       }
97       CALL_CATCH_EXCEPTION(0);
98     }
99     return new PhysicsActor((const PhysicsActor&)result);
100   }
101
102   SWIGEXPORT void SWIGSTDCALL CSharp_Dali_delete_PhysicsActor(void* csPhysicsActor)
103   {
104     PhysicsActor* physicsActor = (PhysicsActor*)csPhysicsActor;
105     {
106       try
107       {
108         delete physicsActor;
109       }
110       CALL_CATCH_EXCEPTION();
111     }
112   }
113
114   SWIGEXPORT void* SWIGSTDCALL CSharp_Dali_new_PhysicsActor__SWIG_1(void* csPhysicsActor)
115   {
116     PhysicsActor* physicsActor = (PhysicsActor*)csPhysicsActor;
117     PhysicsActor* result = 0;
118
119     if(!physicsActor)
120     {
121       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "PhysicsActor const & type is null", 0);
122       return 0;
123     }
124     {
125       try
126       {
127         result = (PhysicsActor*)new PhysicsActor((PhysicsActor const&)*physicsActor);
128       }
129       CALL_CATCH_EXCEPTION(0);
130     }
131
132     return (void*)result;
133   }
134
135   SWIGEXPORT void* SWIGSTDCALL CSharp_Dali_PhysicsActor_Assign(void* csDest, void* csSrc)
136   {
137     PhysicsActor* dest   = (PhysicsActor*)csDest;
138     PhysicsActor* src    = (PhysicsActor*)csSrc;
139     PhysicsActor* result = 0;
140
141     if(!src)
142     {
143       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "PhysicsActor const & type is null", 0);
144       return 0;
145     }
146     {
147       try
148       {
149         result = (PhysicsActor*)&(dest)->operator=((PhysicsActor const&)*src);
150       }
151       CALL_CATCH_EXCEPTION(0);
152     }
153
154     return (void*)result;
155   }
156
157   SWIGEXPORT unsigned int SWIGSTDCALL CSharp_Dali_PhysicsActor_GetId(void* csActor)
158   {
159     PhysicsActor* physicsActor = (PhysicsActor*)csActor;
160     if(!physicsActor)
161     {
162       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "PhysicsActor const & type is null", 0);
163       return 0;
164     }
165     unsigned int result=0;
166     {
167       try
168       {
169         result = physicsActor->GetId();
170       }
171       CALL_CATCH_EXCEPTION(0);
172     }
173     return result;
174   }
175
176   SWIGEXPORT void* SWIGSTDCALL CSharp_Dali_PhysicsActor_GetBody(void* csActor)
177   {
178     PhysicsActor* physicsActor = (PhysicsActor*)csActor;
179     if(!physicsActor)
180     {
181       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "PhysicsActor const & type is null", 0);
182       return 0;
183     }
184     Dali::Any result;
185     {
186       try
187       {
188         result = physicsActor->GetBody();
189       }
190       CALL_CATCH_EXCEPTION(0);
191     }
192     // Heap allocate a new Any wrapper
193     return new Dali::Any((const Dali::Any&)result);
194   }
195
196
197   SWIGEXPORT void SWIGSTDCALL CSharp_Dali_PhysicsActor_AsyncSetPhysicsPosition(void* csActor, void* csPosition)
198   {
199     PhysicsActor* physicsActor = (PhysicsActor*)csActor;
200     if(!physicsActor)
201     {
202       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "PhysicsActor const & type is null", 0);
203       return;
204     }
205     if(!csPosition)
206     {
207       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Dali::Vector3 const & type is null", 0);
208       return;
209     }
210     {
211       try
212       {
213         physicsActor->AsyncSetPhysicsPosition(*(Dali::Vector3*)(csPosition));
214       }
215       CALL_CATCH_EXCEPTION();
216     }
217   }
218
219   SWIGEXPORT void SWIGSTDCALL CSharp_Dali_PhysicsActor_AsyncSetPhysicsRotation(void* csActor, void* csRotation)
220   {
221     PhysicsActor* physicsActor = (PhysicsActor*)csActor;
222     if(!physicsActor)
223     {
224       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "PhysicsActor const & type is null", 0);
225       return;
226     }
227     if(!csRotation)
228     {
229       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Dali::Quaternion const & type is null", 0);
230       return;
231     }
232     {
233       try
234       {
235         physicsActor->AsyncSetPhysicsRotation(*(Dali::Quaternion*)(csRotation));
236       }
237       CALL_CATCH_EXCEPTION();
238     }
239   }
240
241   SWIGEXPORT void* SWIGSTDCALL CSharp_Dali_PhysicsActor_GetPhysicsPosition(void* csActor)
242   {
243     PhysicsActor* physicsActor = (PhysicsActor*)csActor;
244     if(!physicsActor)
245     {
246       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "PhysicsActor const & type is null", 0);
247       return 0;
248     }
249     Dali::Vector3 result;
250     {
251       try
252       {
253         result = physicsActor->GetPhysicsPosition();
254       }
255       CALL_CATCH_EXCEPTION(0);
256     }
257     return new Dali::Vector3((const Dali::Vector3&)result);
258   }
259
260   SWIGEXPORT void* SWIGSTDCALL CSharp_Dali_PhysicsActor_GetPhysicsRotation(void* csActor)
261   {
262     PhysicsActor* physicsActor = (PhysicsActor*)csActor;
263     if(!physicsActor)
264     {
265       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "PhysicsActor const & type is null", 0);
266       return 0;
267     }
268     Dali::Quaternion result;
269     {
270       try
271       {
272         result = physicsActor->GetPhysicsRotation();
273       }
274       CALL_CATCH_EXCEPTION(0);
275     }
276     return new Dali::Quaternion((const Dali::Quaternion&)result);
277   }
278
279   SWIGEXPORT void* SWIGSTDCALL CSharp_Dali_PhysicsActor_GetActorPosition(void* csActor)
280   {
281     PhysicsActor* physicsActor = (PhysicsActor*)csActor;
282     if(!physicsActor)
283     {
284       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "PhysicsActor const & type is null", 0);
285       return 0;
286     }
287     Dali::Vector3 result;
288     {
289       try
290       {
291         result = physicsActor->GetActorPosition();
292       }
293       CALL_CATCH_EXCEPTION(0);
294     }
295     return new Dali::Vector3((const Dali::Vector3&)result);
296   }
297
298   SWIGEXPORT void* SWIGSTDCALL CSharp_Dali_PhysicsActor_GetActorRotation(void* csActor)
299   {
300     PhysicsActor* physicsActor = (PhysicsActor*)csActor;
301     if(!physicsActor)
302     {
303       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "PhysicsActor const & type is null", 0);
304       return 0;
305     }
306     Dali::Quaternion result;
307     {
308       try
309       {
310         result = physicsActor->GetActorRotation();
311       }
312       CALL_CATCH_EXCEPTION(0);
313     }
314     return new Dali::Quaternion((const Dali::Quaternion&)result);
315   }
316
317 #ifdef __cplusplus
318 }
319 #endif