allow to use iostream and sstream without wchar support, as pointed by Scott
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7137 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
0d125a75b1
commit
9d50d14df3
7 changed files with 67 additions and 19 deletions
|
|
@ -4,6 +4,7 @@
|
||||||
struct A;
|
struct A;
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
%include <wchar.i>
|
||||||
%include <std_iostream.i>
|
%include <std_iostream.i>
|
||||||
%include <std_sstream.i>
|
%include <std_sstream.i>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
%include <std_common.i>
|
%include <std_common.i>
|
||||||
|
#if defined(SWIG_WCHAR)
|
||||||
%include <wchar.i>
|
%include <wchar.i>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace std
|
namespace std
|
||||||
{
|
{
|
||||||
|
|
@ -68,6 +70,7 @@ namespace std
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(SWIG_WCHAR)
|
||||||
template<>
|
template<>
|
||||||
struct char_traits<wchar_t>
|
struct char_traits<wchar_t>
|
||||||
{
|
{
|
||||||
|
|
@ -119,14 +122,19 @@ namespace std
|
||||||
static int_type
|
static int_type
|
||||||
not_eof(const int_type& __c);
|
not_eof(const int_type& __c);
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace std {
|
namespace std {
|
||||||
#ifndef SWIG_STL_WRAP_TRAITS
|
#ifndef SWIG_STL_WRAP_TRAITS
|
||||||
%template() char_traits<char>;
|
%template() char_traits<char>;
|
||||||
|
#if defined(SWIG_WCHAR)
|
||||||
%template() char_traits<wchar_t>;
|
%template() char_traits<wchar_t>;
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
%template(char_traits_c) char_traits<char>;
|
%template(char_traits_c) char_traits<char>;
|
||||||
|
#if defined(SWIG_WCHAR)
|
||||||
%template(char_traits_w) char_traits<wchar_t>;
|
%template(char_traits_w) char_traits<wchar_t>;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,21 @@
|
||||||
|
/*
|
||||||
|
For wchar support, you need to include the wchar.i file
|
||||||
|
before this file, ie:
|
||||||
|
|
||||||
|
%include <wchar.i>
|
||||||
|
%include <std_iostream.i>
|
||||||
|
|
||||||
|
or equivalently, just include
|
||||||
|
|
||||||
|
%include <std_wiostream.i>
|
||||||
|
*/
|
||||||
|
|
||||||
%include <std_ios.i>
|
%include <std_ios.i>
|
||||||
%include <std_basic_string.i>
|
%include <std_basic_string.i>
|
||||||
%include <std_string.i>
|
%include <std_string.i>
|
||||||
|
#if defined(SWIG_WCHAR)
|
||||||
%include <std_wstring.i>
|
%include <std_wstring.i>
|
||||||
|
#endif
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
@ -46,16 +60,12 @@ namespace std
|
||||||
|
|
||||||
basic_ostream<_CharT, _Traits>&
|
basic_ostream<_CharT, _Traits>&
|
||||||
operator<<(long __n);
|
operator<<(long __n);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
basic_ostream<_CharT, _Traits>&
|
basic_ostream<_CharT, _Traits>&
|
||||||
operator<<(unsigned long __n);
|
operator<<(unsigned long __n);
|
||||||
|
|
||||||
|
|
||||||
basic_ostream<_CharT, _Traits>&
|
basic_ostream<_CharT, _Traits>&
|
||||||
operator<<(bool __n);
|
operator<<(bool __n);
|
||||||
|
|
||||||
|
|
||||||
basic_ostream<_CharT, _Traits>&
|
basic_ostream<_CharT, _Traits>&
|
||||||
operator<<(short __n);
|
operator<<(short __n);
|
||||||
|
|
@ -63,11 +73,9 @@ namespace std
|
||||||
basic_ostream<_CharT, _Traits>&
|
basic_ostream<_CharT, _Traits>&
|
||||||
operator<<(unsigned short __n);
|
operator<<(unsigned short __n);
|
||||||
|
|
||||||
|
|
||||||
basic_ostream<_CharT, _Traits>&
|
basic_ostream<_CharT, _Traits>&
|
||||||
operator<<(int __n);
|
operator<<(int __n);
|
||||||
|
|
||||||
|
|
||||||
basic_ostream<_CharT, _Traits>&
|
basic_ostream<_CharT, _Traits>&
|
||||||
operator<<(unsigned int __n);
|
operator<<(unsigned int __n);
|
||||||
|
|
||||||
|
|
@ -280,19 +288,21 @@ namespace std
|
||||||
typedef basic_istream<char> istream;
|
typedef basic_istream<char> istream;
|
||||||
typedef basic_iostream<char> iostream;
|
typedef basic_iostream<char> iostream;
|
||||||
|
|
||||||
typedef basic_ostream<wchar_t> wostream;
|
|
||||||
typedef basic_istream<wchar_t> wistream;
|
|
||||||
typedef basic_iostream<wchar_t> wiostream;
|
|
||||||
|
|
||||||
extern istream cin;
|
extern istream cin;
|
||||||
extern ostream cout;
|
extern ostream cout;
|
||||||
extern ostream cerr;
|
extern ostream cerr;
|
||||||
extern ostream clog;
|
extern ostream clog;
|
||||||
|
|
||||||
|
#if defined(SWIG_WCHAR)
|
||||||
|
typedef basic_ostream<wchar_t> wostream;
|
||||||
|
typedef basic_istream<wchar_t> wistream;
|
||||||
|
typedef basic_iostream<wchar_t> wiostream;
|
||||||
|
|
||||||
extern wistream wcin;
|
extern wistream wcin;
|
||||||
extern wostream wcout;
|
extern wostream wcout;
|
||||||
extern wostream wcerr;
|
extern wostream wcerr;
|
||||||
extern wostream wclog;
|
extern wostream wclog;
|
||||||
|
#endif
|
||||||
|
|
||||||
template<typename _CharT, typename _Traits = char_traits<_CharT> >
|
template<typename _CharT, typename _Traits = char_traits<_CharT> >
|
||||||
std::basic_ostream<_CharT, _Traits>&
|
std::basic_ostream<_CharT, _Traits>&
|
||||||
|
|
@ -312,16 +322,18 @@ namespace std {
|
||||||
%template(istream) basic_istream<char>;
|
%template(istream) basic_istream<char>;
|
||||||
%template(iostream) basic_iostream<char>;
|
%template(iostream) basic_iostream<char>;
|
||||||
|
|
||||||
%template(wostream) basic_ostream<wchar_t>;
|
|
||||||
%template(wistream) basic_istream<wchar_t>;
|
|
||||||
%template(wiostream) basic_iostream<wchar_t>;
|
|
||||||
|
|
||||||
%template(endl) endl<char, std::char_traits<char> >;
|
%template(endl) endl<char, std::char_traits<char> >;
|
||||||
%template(ends) ends<char, std::char_traits<char> >;
|
%template(ends) ends<char, std::char_traits<char> >;
|
||||||
%template(flush) flush<char, std::char_traits<char> >;
|
%template(flush) flush<char, std::char_traits<char> >;
|
||||||
|
|
||||||
|
#if defined(SWIG_WCHAR)
|
||||||
|
%template(wostream) basic_ostream<wchar_t>;
|
||||||
|
%template(wistream) basic_istream<wchar_t>;
|
||||||
|
%template(wiostream) basic_iostream<wchar_t>;
|
||||||
|
|
||||||
%template(wendl) endl<wchar_t, std::char_traits<wchar_t> >;
|
%template(wendl) endl<wchar_t, std::char_traits<wchar_t> >;
|
||||||
%template(wends) ends<wchar_t, std::char_traits<wchar_t> >;
|
%template(wends) ends<wchar_t, std::char_traits<wchar_t> >;
|
||||||
%template(wflush) flush<wchar_t, std::char_traits<wchar_t> >;
|
%template(wflush) flush<wchar_t, std::char_traits<wchar_t> >;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,22 @@
|
||||||
|
/*
|
||||||
|
For wchar support, you need to include the wchar.i file
|
||||||
|
before this file, ie:
|
||||||
|
|
||||||
|
%include <wchar.i>
|
||||||
|
%include <std_sstream.i>
|
||||||
|
|
||||||
|
or equivalently, just include
|
||||||
|
|
||||||
|
%include <std_wsstream.i>
|
||||||
|
*/
|
||||||
|
|
||||||
%include <std_alloc.i>
|
%include <std_alloc.i>
|
||||||
%include <std_basic_string.i>
|
%include <std_basic_string.i>
|
||||||
%include <std_string.i>
|
%include <std_string.i>
|
||||||
%include <std_ios.i>
|
%include <std_ios.i>
|
||||||
|
#if defined(SWIG_WCHAR)
|
||||||
%include <std_wstring.i>
|
%include <std_wstring.i>
|
||||||
|
#endif
|
||||||
%include <std_streambuf.i>
|
%include <std_streambuf.i>
|
||||||
%include <std_iostream.i>
|
%include <std_iostream.i>
|
||||||
|
|
||||||
|
|
@ -173,7 +187,9 @@ namespace std {
|
||||||
%template(stringstream) basic_stringstream<char>;
|
%template(stringstream) basic_stringstream<char>;
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(SWIG_WCHAR)
|
||||||
%template(wistringstream) basic_istringstream<wchar_t>;
|
%template(wistringstream) basic_istringstream<wchar_t>;
|
||||||
%template(wostringstream) basic_ostringstream<wchar_t>;
|
%template(wostringstream) basic_ostringstream<wchar_t>;
|
||||||
%template(wstringstream) basic_stringstream<wchar_t>;
|
%template(wstringstream) basic_stringstream<wchar_t>;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
7
SWIG/Lib/std/std_wiostream.i
Normal file
7
SWIG/Lib/std/std_wiostream.i
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
/*
|
||||||
|
Provide 'std_iostream.i' with wchar support.
|
||||||
|
*/
|
||||||
|
|
||||||
|
%include <wchar.i>
|
||||||
|
%include <std_iostream.i>
|
||||||
|
|
||||||
7
SWIG/Lib/std/std_wsstream.i
Normal file
7
SWIG/Lib/std/std_wsstream.i
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
/*
|
||||||
|
Provide 'std_sstream.i' with wchar support.
|
||||||
|
*/
|
||||||
|
|
||||||
|
%include <wchar.i>
|
||||||
|
%include <std_sstream.i>
|
||||||
|
|
||||||
|
|
@ -1,12 +1,8 @@
|
||||||
%{
|
%include <wchar.i>
|
||||||
#include <cwchar>
|
|
||||||
%}
|
|
||||||
|
|
||||||
%include <std/std_basic_string.i>
|
%include <std/std_basic_string.i>
|
||||||
|
|
||||||
/* wide strings */
|
/* wide strings */
|
||||||
|
|
||||||
|
|
||||||
namespace std
|
namespace std
|
||||||
{
|
{
|
||||||
%std_comp_methods(basic_string<wchar_t>);
|
%std_comp_methods(basic_string<wchar_t>);
|
||||||
|
|
@ -14,3 +10,4 @@ namespace std
|
||||||
}
|
}
|
||||||
|
|
||||||
%template(wstring) std::basic_string<wchar_t>;
|
%template(wstring) std::basic_string<wchar_t>;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue