summaryrefslogtreecommitdiff
path: root/Examples/test-suite/typemap_self.i
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/test-suite/typemap_self.i')
-rw-r--r--Examples/test-suite/typemap_self.i47
1 files changed, 47 insertions, 0 deletions
diff --git a/Examples/test-suite/typemap_self.i b/Examples/test-suite/typemap_self.i
new file mode 100644
index 0000000..3630688
--- /dev/null
+++ b/Examples/test-suite/typemap_self.i
@@ -0,0 +1,47 @@
+%module typemap_self
+
+// This typemap should be ignored for self?
+%typemap(in) A* (A* ptr) {
+ if (SWIG_ConvertPtr($input, (void**) &ptr, $1_descriptor, 0) != -1) {
+ $1 = ptr;
+ } else {
+ $1 = new A();
+ }
+ }
+
+// Simple but unsecure current fix
+//%apply SWIGTYPE* {A* self}
+
+
+%inline %{
+ class A;
+
+ int foo(A* self)
+ {
+ return 0;
+ }
+
+ struct A
+ {
+ static int bar(int, A* self)
+ {
+ return 1;
+ }
+
+ int val;
+
+
+ int foo(A* self, A* b)
+ {
+ return 1;
+ }
+ };
+
+ struct B
+ {
+ B(A*)
+ {
+ }
+ };
+
+%}