1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
%module li_std_wstring
// The languages below are yet to provide std_wstring.i
#if !(defined(SWIGD) || defined(SWIGGO) || defined(SWIGGUILE) || defined(SWIGJAVASCRIPT) || defined(SWIGLUA) || defined(SWIGMZSCHEME) || defined(SWIGOCAML) || defined(SWIGOCTAVE) || defined(SWIGPERL) || defined(SWIGPHP) || defined(SWIGR) || defined(SWIGSCILAB))
%include <std_wstring.i>
// throw is invalid in C++17 and later, only SWIG to use it
#define TESTCASE_THROW1(T1) throw(T1)
%{
#define TESTCASE_THROW1(T1)
%}
%inline %{
#include <string>
wchar_t test_wcvalue(wchar_t x) {
return x;
}
const wchar_t* test_ccvalue(const wchar_t* x) {
return x;
}
wchar_t* test_cvalue(wchar_t* x) {
return x;
}
wchar_t* test_wchar_overload() {
return 0;
}
wchar_t* test_wchar_overload(wchar_t *x) {
return x;
}
std::wstring test_value(std::wstring x) {
return x;
}
const std::wstring& test_const_reference(const std::wstring &x) {
return x;
}
void test_pointer(std::wstring *x) {
}
void test_const_pointer(const std::wstring *x) {
}
void test_reference(std::wstring &x) {
}
bool test_equal_abc(const std::wstring &s) {
return L"abc" == s;
}
void test_throw() TESTCASE_THROW1(std::wstring){
static std::wstring x = L"throwing test_throw";
throw x;
}
const char * non_utf8_c_str() {
return "h\xe9llo";
}
size_t size_wstring(const std::wstring& s) {
return s.size();
}
%}
#endif
|