2 * Copyright (c) 2022 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #include <dali-toolkit/dali-toolkit.h>
20 #include <dali-toolkit/devel-api/text/spannable.h>
21 #include <dali/dali.h>
24 #include <dali-csharp-binder/common/common.h>
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;
34 using namespace Dali::Toolkit::Text;
36 SWIGEXPORT void SWIGSTDCALL CSharp_Dali_delete_Spannable(void *refSpannable) {
37 Spannable *spannablePtr = (Spannable *)0;
38 spannablePtr = (Spannable *)refSpannable;
44 CALL_CATCH_EXCEPTION();
48 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_Spannable_AttachSpan(void *refSpannable,
54 BaseSpan *baseSpanPtr;
55 baseSpanPtr = (BaseSpan *)refSpan;
57 SWIG_CSharpSetPendingExceptionArgument(
58 SWIG_CSharpArgumentNullException,
59 "Attempt to dereference null BaseSpan", 0);
64 rangePtr = (Range *)refRange;
66 SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException,
67 "Attempt to dereference null Range",
72 Spannable *spannablePtr;
73 spannablePtr = (Spannable *)refSpannable;
75 SWIG_CSharpSetPendingExceptionArgument(
76 SWIG_CSharpArgumentNullException,
77 "Attempt to dereference null Spannable", 0);
83 result = spannablePtr->AttachSpan(*baseSpanPtr, *rangePtr);
85 CALL_CATCH_EXCEPTION(0);
91 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_Spannable_DetachSpan(void *refSpannable,
96 BaseSpan *baseSpanPtr;
97 baseSpanPtr = (BaseSpan *)refSpan;
99 SWIG_CSharpSetPendingExceptionArgument(
100 SWIG_CSharpArgumentNullException,
101 "Attempt to dereference null BaseSpan", 0);
105 Spannable *spannablePtr;
106 spannablePtr = (Spannable *)refSpannable;
108 SWIG_CSharpSetPendingExceptionArgument(
109 SWIG_CSharpArgumentNullException,
110 "Attempt to dereference null Spannable", 0);
116 result = spannablePtr->DetachSpan(*baseSpanPtr);
118 CALL_CATCH_EXCEPTION(0);