diff --git a/SWIG/Lib/python/std_basic_string.i b/SWIG/Lib/python/std_basic_string.i index 386bcafe5..9268223c7 100644 --- a/SWIG/Lib/python/std_basic_string.i +++ b/SWIG/Lib/python/std_basic_string.i @@ -1,4 +1,4 @@ -#if !defined(SWIG_STD_STRING) && !defined(SWIG_STD_WSTRING) +#if !defined(SWIG_STD_STRING) #define SWIG_STD_BASIC_STRING %include @@ -45,6 +45,13 @@ SWIGINTERNINLINE PyObject* } } +%include +%typemap_asptrfromn(SWIG_CCode(STRING), std::basic_string); + +#endif + + +#if !defined(SWIG_STD_WSTRING) %fragment(SWIG_AsPtr_frag(std::basic_string),"header", fragment="SWIG_AsWCharPtrAndSize") { @@ -87,11 +94,6 @@ SWIGINTERNINLINE PyObject* } } - - -%include - -%typemap_asptrfromn(SWIG_CCode(STRING), std::basic_string); %typemap_asptrfromn(SWIG_CCode(UNISTRING), std::basic_string); #endif diff --git a/SWIG/Lib/python/wchar.i b/SWIG/Lib/python/wchar.i index 2743b4b9b..308139a3a 100644 --- a/SWIG/Lib/python/wchar.i +++ b/SWIG/Lib/python/wchar.i @@ -1,7 +1,21 @@ +#ifdef __cplusplus + +%{ +#include +%} + +#else + %{ #include %} -%types(wchar_t *); +#endif +%types(wchar_t *); %include + +/* + Enable swig wchar support. +*/ +#define SWIG_WCHAR diff --git a/SWIG/Lib/std/std_ios.i b/SWIG/Lib/std/std_ios.i index 4fb5e4cbe..87ca38d00 100644 --- a/SWIG/Lib/std/std_ios.i +++ b/SWIG/Lib/std/std_ios.i @@ -248,7 +248,9 @@ namespace std { namespace std { %template(ios) basic_ios; +#if defined(SWIG_WCHAR) %template(wios) basic_ios; +#endif } diff --git a/SWIG/Lib/std/std_streambuf.i b/SWIG/Lib/std/std_streambuf.i index 85a8132f3..14265eb8f 100644 --- a/SWIG/Lib/std/std_streambuf.i +++ b/SWIG/Lib/std/std_streambuf.i @@ -81,5 +81,7 @@ namespace std { namespace std { %template(streambuf) basic_streambuf; +#if defined(SWIG_WCHAR) %template(wstreambuf) basic_streambuf; +#endif }