add wstream case
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7140 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
73ac0670b0
commit
1e41bb4920
3 changed files with 74 additions and 0 deletions
|
|
@ -27,6 +27,7 @@ CPP_TEST_CASES += \
|
||||||
li_std_vectora \
|
li_std_vectora \
|
||||||
li_std_map \
|
li_std_map \
|
||||||
li_std_stream \
|
li_std_stream \
|
||||||
|
li_std_wstream \
|
||||||
li_std_wstring \
|
li_std_wstring \
|
||||||
nondynamic \
|
nondynamic \
|
||||||
primitive_types \
|
primitive_types \
|
||||||
|
|
|
||||||
59
Examples/test-suite/python/li_std_wstream.i
Normal file
59
Examples/test-suite/python/li_std_wstream.i
Normal file
|
|
@ -0,0 +1,59 @@
|
||||||
|
%module li_std_wstream
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
struct A;
|
||||||
|
%}
|
||||||
|
|
||||||
|
%include <std_wiostream.i>
|
||||||
|
%include <std_wsstream.i>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%callback(1) A::bar;
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
|
||||||
|
struct B {
|
||||||
|
virtual ~B()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
struct A : B
|
||||||
|
{
|
||||||
|
void __add__(int a)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void __add__(double a)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static int bar(int a){
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int foo(int a, int (*pf)(int a))
|
||||||
|
{
|
||||||
|
return pf(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::wostream& __rlshift__(std::wostream& out)
|
||||||
|
{
|
||||||
|
out << "A class";
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
%}
|
||||||
|
|
||||||
|
%extend std::basic_ostream<wchar_t>{
|
||||||
|
std::basic_ostream<wchar_t>&
|
||||||
|
operator<<(const A& a)
|
||||||
|
{
|
||||||
|
*self << "A class";
|
||||||
|
return *self;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
14
Examples/test-suite/python/li_std_wstream_runme.py
Normal file
14
Examples/test-suite/python/li_std_wstream_runme.py
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
import li_std_wstream as std
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
a = std.A()
|
||||||
|
|
||||||
|
o = std.wostringstream()
|
||||||
|
|
||||||
|
o << a << u" " << 2345 << u" " << 1.435
|
||||||
|
|
||||||
|
|
||||||
|
if o.str() != "A class 2345 1.435":
|
||||||
|
print "\"%s\"" % (o.str(),)
|
||||||
|
raise RuntimeError
|
||||||
Loading…
Add table
Add a link
Reference in a new issue