diff options
author | Marcelo Matus <mmatus@acms.arizona.edu> | 2005-10-26 07:08:18 +0000 |
---|---|---|
committer | Marcelo Matus <mmatus@acms.arizona.edu> | 2005-10-26 07:08:18 +0000 |
commit | 1fa14f74a77df4d49bfd06b41a2ac17b0331d1d9 (patch) | |
tree | 28756aa00dcb66f8d3cde26a196cb9ebbb0843fa /Examples/test-suite/disown.i | |
parent | 46c43c51cd203255aa3401c41ecc5d310b7ec9ca (diff) | |
download | swig-1fa14f74a77df4d49bfd06b41a2ac17b0331d1d9.tar.gz |
add disown.i and li_attribute.i
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7726 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'Examples/test-suite/disown.i')
-rw-r--r-- | Examples/test-suite/disown.i | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/Examples/test-suite/disown.i b/Examples/test-suite/disown.i new file mode 100644 index 000000000..b7fbb67bc --- /dev/null +++ b/Examples/test-suite/disown.i @@ -0,0 +1,47 @@ +%module disown + +%{ +#include <iostream> +%} + +#pragma SWIG nowarn=453 + +%apply SWIGTYPE *DISOWN { A *disown }; + +%inline { + struct A + { + ~A() + { + // std::cout <<"delete A" << std::endl; + } + + + }; + + class B + { + A *_a; + public: + B() : _a(0) + { + } + + ~B() + { + if (_a) { + // std::cout <<"delete A from B" << std::endl; + delete _a; + } + // std::cout <<"delete B" << std::endl; + } + + int acquire(A *disown) + { + // std::cout <<"acquire A" << std::endl; + _a = disown; + return 5; + } + + }; +} |