1 %module python_strict_unicode 2 3 %include <std_string.i> 4 %include <std_wstring.i> 5 6 %begin %{ 7 #define SWIG_PYTHON_STRICT_BYTE_CHAR 8 #define SWIG_PYTHON_STRICT_UNICODE_WCHAR 9 %} 10 11 %inline %{ double_str(const std::string & in)12std::string double_str(const std::string& in) 13 { 14 return in + in; 15 } 16 same_str(char * in)17char *same_str(char* in) 18 { 19 return in; 20 } 21 double_wstr(const std::wstring & in)22std::wstring double_wstr(const std::wstring& in) 23 { 24 return in + in; 25 } 26 same_wstr(wchar_t * in)27wchar_t *same_wstr(wchar_t* in) 28 { 29 return in; 30 } 31 overload(const std::wstring & in)32std::wstring overload(const std::wstring& in) 33 { 34 return L"UNICODE"; 35 } 36 overload(const std::string & in)37std::string overload(const std::string& in) 38 { 39 return "BYTES"; 40 } 41 %} 42