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-string.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
37 CSharp_Dali_delete_SpannableString(void *refSpannableString) {
38 SpannableString *spannablePtr = (SpannableString *)0;
39 spannablePtr = (SpannableString *)refSpannableString;
45 CALL_CATCH_EXCEPTION();
49 SWIGEXPORT void *SWIGSTDCALL CSharp_Dali_SpannableString_New(char *refText) {
51 std::string text = std::string(refText);
52 SpannableString *spannableStringPtr = 0;
56 (SpannableString *)new SpannableString(SpannableString::New(text));
58 CALL_CATCH_EXCEPTION(0);
61 return (void *)spannableStringPtr;