summaryrefslogtreecommitdiff
path: root/Examples/test-suite/disown.i
diff options
context:
space:
mode:
authorMarcelo Matus <mmatus@acms.arizona.edu>2005-10-26 07:08:18 +0000
committerMarcelo Matus <mmatus@acms.arizona.edu>2005-10-26 07:08:18 +0000
commit1fa14f74a77df4d49bfd06b41a2ac17b0331d1d9 (patch)
tree28756aa00dcb66f8d3cde26a196cb9ebbb0843fa /Examples/test-suite/disown.i
parent46c43c51cd203255aa3401c41ecc5d310b7ec9ca (diff)
downloadswig-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.i47
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;
+ }
+
+ };
+}