summaryrefslogtreecommitdiff
path: root/Examples/test-suite/director_basic.i
blob: 6d435e0c63ab020b1ffc18e65e1f4d9ed3c198d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
%module(directors="1") director_basic
%{
#include <string>

class Foo {
public:
	virtual ~Foo() {}
	virtual std::string ping() { return "Foo::ping()"; }
	virtual std::string pong() { return "Foo::pong();" + ping(); }
};

%}

%include "std_string.i"

%feature("director") Foo;


class Foo {
public:
	virtual ~Foo() {}
	virtual std::string ping() { return "Foo::ping()"; }
	virtual std::string pong() { return "Foo::pong();" + ping(); }
};

%{
#include <complex> 
%}
%feature("director");

// basic renaming
%rename(rg) A::gg;
%feature("nodirector") hi::A1::gg;

%inline %{

struct A{
    A(std::complex<int> i, double d=0.0) {}
    A(int i, bool j=false) {}
    virtual ~A() {}
    
    virtual int f(int i=0) {return i;}
    virtual int gg(int i=0) {return i;}
};

namespace hi  {

  struct A1 : public A{
    A1(std::complex<int> i, double d=0.0) : A(i, d) {}
    A1(int i, bool j=false) : A(i, j) {}
    
    virtual int ff(int i = 0) {return i;}  
  };
}
 

%}