add wstream case

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7140 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2005-04-03 03:15:16 +00:00
commit c1fa7c426f
3 changed files with 74 additions and 0 deletions

View file

@ -27,6 +27,7 @@ CPP_TEST_CASES += \
li_std_vectora \
li_std_map \
li_std_stream \
li_std_wstream \
li_std_wstring \
nondynamic \
primitive_types \

View 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;
}
}

View 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