PageRenderTime 16ms CodeModel.GetById 10ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/test-suite/typemap_self.i

#
Swig | 47 lines | 36 code | 11 blank | 0 comment | 0 complexity | 34f053b4cc916dea5221ec429b46049a MD5 | raw file
 1%module typemap_self
 2
 3// This typemap should be ignored for self?
 4%typemap(in) A* (A* ptr) {
 5  if (SWIG_ConvertPtr($input, (void**) &ptr, $1_descriptor, 0) != -1) {
 6    $1 = ptr;
 7  } else  {
 8    $1 = new A();
 9  }
10 }
11
12// Simple but unsecure current fix
13//%apply SWIGTYPE* {A* self}
14
15
16%inline %{
17  class A;
18  
19  int foo(A* self) 
20  {
21    return 0;
22  }
23  
24  struct A
25  {
26    static int bar(int, A* self)
27    {
28      return 1;
29    }
30    
31    int val;
32    
33    
34    int foo(A* self, A* b) 
35    {
36      return 1;
37    }
38  };
39  
40  struct B
41  {
42    B(A*) 
43    {
44    }
45  };
46  
47%}