add support for smart pointers + %extend

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6819 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2004-12-01 11:29:17 +00:00
commit 49c6b3f14f
5 changed files with 75 additions and 36 deletions

View file

@ -1,36 +1,43 @@
%module smart_pointer_member
%extend Foo
{
int extension(int i, int j) { return i; }
int extension(int i) { return i; }
int extension() { return 1; }
}
%inline %{
class Foo {
public:
int x[4];
int y;
static const int z;
};
class Bar {
Foo *f;
public:
Bar(Foo *f) : f(f) { }
Foo *operator->() {
class Foo {
public:
int x[4];
int y;
static const int z;
};
class Bar {
Foo *f;
public:
Bar(Foo *f) : f(f) { }
Foo *operator->() {
return f;
}
};
int get_y(Bar *b)
{
return (*b)->y;
}
int get_z(Bar *b)
{
return (*b)->z;
}
}
};
int get_y(Bar *b)
{
return (*b)->y;
}
int get_z(Bar *b)
{
return (*b)->z;
}
%}
%{
const int Foo::z = 3;
%}