Test case for object tracking.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7624 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
85d86be4e6
commit
5818b97ffa
1 changed files with 44 additions and 0 deletions
44
SWIG/Examples/test-suite/ruby/track_objects_directors.i
Normal file
44
SWIG/Examples/test-suite/ruby/track_objects_directors.i
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
%module(directors="1") track_objects_directors
|
||||||
|
|
||||||
|
%{
|
||||||
|
#include <string>
|
||||||
|
%}
|
||||||
|
|
||||||
|
%include "std_string.i";
|
||||||
|
%feature("director") Foo;
|
||||||
|
|
||||||
|
%trackobjects;
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
|
||||||
|
class Foo {
|
||||||
|
public:
|
||||||
|
Foo() {}
|
||||||
|
virtual ~Foo() {}
|
||||||
|
virtual std::string ping()
|
||||||
|
{
|
||||||
|
return "Foo::ping()";
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual std::string pong()
|
||||||
|
{
|
||||||
|
return "Foo::pong();" + ping();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class Container {
|
||||||
|
Foo* foo_;
|
||||||
|
public:
|
||||||
|
Foo* get_foo()
|
||||||
|
{
|
||||||
|
return foo_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_foo(Foo *foo)
|
||||||
|
{
|
||||||
|
foo_ = foo;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
%}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue