test directors with classes passed by value, ref and pointer
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7436 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
cc61850448
commit
5b2e9e54ca
2 changed files with 23 additions and 8 deletions
|
|
@ -22,7 +22,9 @@ class Bar
|
||||||
public:
|
public:
|
||||||
virtual ~Bar();
|
virtual ~Bar();
|
||||||
virtual Foo_int *meth();
|
virtual Foo_int *meth();
|
||||||
virtual void foo_meth(Foo_int &, int);
|
virtual void foo_meth_ref(Foo_int &, int);
|
||||||
|
virtual void foo_meth_ptr(Foo_int *, int);
|
||||||
|
virtual void foo_meth_val(Foo_int, int);
|
||||||
};
|
};
|
||||||
|
|
||||||
Bar::~Bar()
|
Bar::~Bar()
|
||||||
|
|
@ -34,10 +36,9 @@ Bar::meth()
|
||||||
return new Foo_int();
|
return new Foo_int();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void Bar::foo_meth_ref(Foo_int &arg, int param) { }
|
||||||
Bar::foo_meth(Foo_int &arg, int param)
|
void Bar::foo_meth_ptr(Foo_int *arg, int param) { }
|
||||||
{
|
void Bar::foo_meth_val(Foo_int arg, int param) { }
|
||||||
}
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%template(Foo_integers) Foo<int>;
|
%template(Foo_integers) Foo<int>;
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,9 @@ public class director_wombat_runme
|
||||||
b.delete();
|
b.delete();
|
||||||
|
|
||||||
b = new director_wombat_Bar_derived_1();
|
b = new director_wombat_Bar_derived_1();
|
||||||
b.foo_meth(a, 0);
|
b.foo_meth_ref(a, 0);
|
||||||
|
b.foo_meth_ptr(a, 1);
|
||||||
|
b.foo_meth_val(a, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -71,10 +73,22 @@ class director_wombat_Bar_derived_1 extends Bar
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void foo_meth(Foo_integers foo_obj, int param)
|
public void foo_meth_ref(Foo_integers foo_obj, int param)
|
||||||
{
|
{
|
||||||
if (!(foo_obj instanceof director_wombat_Foo_integers_derived_2)) {
|
if (!(foo_obj instanceof director_wombat_Foo_integers_derived_2)) {
|
||||||
throw new RuntimeException ("Test failed: foo_obj is not director_wombat_Foo_integers_derived_2, got " + foo_obj);
|
throw new RuntimeException ("Test failed: foo_obj in foo_meth_ref is not director_wombat_Foo_integers_derived_2, got " + foo_obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void foo_meth_ptr(Foo_integers foo_obj, int param)
|
||||||
|
{
|
||||||
|
if (!(foo_obj instanceof director_wombat_Foo_integers_derived_2)) {
|
||||||
|
throw new RuntimeException ("Test failed: foo_obj in foo_meth_ptr is not director_wombat_Foo_integers_derived_2, got " + foo_obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void foo_meth_val(Foo_integers foo_obj, int param)
|
||||||
|
{
|
||||||
|
if (!(foo_obj instanceof director_wombat_Foo_integers_derived_2)) {
|
||||||
|
throw new RuntimeException ("Test failed: foo_obj in foo_meth_val is not director_wombat_Foo_integers_derived_2, got " + foo_obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue