Bind AnimatedVectorImageVisual action : SET_DYNAMIC_PROPERTY
[platform/core/uifw/dali-csharp-binder.git] / dali-csharp-binder / dali-toolkit / text-spannable-wrap.cpp
1 /*
2  * Copyright (c) 2022 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 // EXTERNAL INCLUDES
19 #include <dali-toolkit/dali-toolkit.h>
20 #include <dali-toolkit/devel-api/text/spannable.h>
21 #include <dali/dali.h>
22
23 // INTERNAL INCLUDES
24 #include <dali-csharp-binder/common/common.h>
25
26 /* Callback for returning strings to C# without leaking memory */
27 typedef char *(SWIGSTDCALL *SWIG_CSharpStringHelperCallback)(const char *);
28 extern SWIG_CSharpStringHelperCallback SWIG_csharp_string_callback;
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
34 using namespace Dali::Toolkit::Text;
35
36 SWIGEXPORT void SWIGSTDCALL CSharp_Dali_delete_Spannable(void *refSpannable) {
37   Spannable *spannablePtr = (Spannable *)0;
38   spannablePtr = (Spannable *)refSpannable;
39
40   {
41     try {
42       delete spannablePtr;
43     }
44     CALL_CATCH_EXCEPTION();
45   }
46 }
47
48 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_Spannable_AttachSpan(void *refSpannable,
49                                                              void *refSpan,
50                                                              void *refRange) {
51
52   bool result = false;
53
54   BaseSpan *baseSpanPtr;
55   baseSpanPtr = (BaseSpan *)refSpan;
56   if (!baseSpanPtr) {
57     SWIG_CSharpSetPendingExceptionArgument(
58         SWIG_CSharpArgumentNullException,
59         "Attempt to dereference null BaseSpan", 0);
60     return result;
61   }
62
63   Range *rangePtr;
64   rangePtr = (Range *)refRange;
65   if (!rangePtr) {
66     SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException,
67                                            "Attempt to dereference null Range",
68                                            0);
69     return result;
70   }
71
72   Spannable *spannablePtr;
73   spannablePtr = (Spannable *)refSpannable;
74   if (!spannablePtr) {
75     SWIG_CSharpSetPendingExceptionArgument(
76         SWIG_CSharpArgumentNullException,
77         "Attempt to dereference null Spannable", 0);
78     return result;
79   }
80
81   {
82     try {
83       result = spannablePtr->AttachSpan(*baseSpanPtr, *rangePtr);
84     }
85     CALL_CATCH_EXCEPTION(0);
86   }
87
88   return result;
89 }
90
91 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_Spannable_DetachSpan(void *refSpannable,
92                                                              void *refSpan) {
93
94   bool result = false;
95
96   BaseSpan *baseSpanPtr;
97   baseSpanPtr = (BaseSpan *)refSpan;
98   if (!baseSpanPtr) {
99     SWIG_CSharpSetPendingExceptionArgument(
100         SWIG_CSharpArgumentNullException,
101         "Attempt to dereference null BaseSpan", 0);
102     return result;
103   }
104
105   Spannable *spannablePtr;
106   spannablePtr = (Spannable *)refSpannable;
107   if (!spannablePtr) {
108     SWIG_CSharpSetPendingExceptionArgument(
109         SWIG_CSharpArgumentNullException,
110         "Attempt to dereference null Spannable", 0);
111     return result;
112   }
113
114   {
115     try {
116       result = spannablePtr->DetachSpan(*baseSpanPtr);
117     }
118     CALL_CATCH_EXCEPTION(0);
119   }
120
121   return result;
122 }
123
124 #ifdef __cplusplus
125 }
126 #endif