blob: d972f672589d6ba2ca0719b7273e7f670384108d (
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
%module smart_pointer_extend
%warnfilter(SWIGWARN_RUBY_WRONG_NAME) hi::CBase::z; /* Ruby, wrong const name */
%inline %{
namespace hi
{
struct CBase
{
static int hello()
{
return 1;
}
int x;
static const int z = 1;
};
class CDerived : public CBase
{
};
class CPtr
{
public:
CDerived* operator->(void) {return 0;}
};
int get_hello(CPtr ptr)
{
return ptr->hello();
}
class CPtrConst
{
public:
const CDerived* operator->() const {return 0;};
};
}
%}
%extend hi::CBase {
int foo(void) {return 1;};
int bar(void) {return 2;};
int boo(int i) {return i;};
}
%extend hi::CDerived {
int foo(void) {return 1;};
}
%extend Foo
{
int extension(int i, int j) { return i; }
int extension(int i) { return i; }
int extension() { return 1; }
}
%inline %{
struct Foo {
};
class Bar {
Foo *f;
public:
Bar(Foo *f) : f(f) { }
Foo *operator->() {
return f;
}
};
%}
%extend CFoo
{
public:
static void StatFun() {};
static void StatFun(int i) {};
static void HoHoHo(int i, int j) {};
}
%inline %{
class CFoo
{
};
class CPtrFoo
{
public:
CFoo* operator->(void) {return 0;};
};
%}
%inline %{
namespace foo {
class DFoo;
class DPtrFoo
{
DFoo *p;
public:
DPtrFoo(DFoo *ptr) : p(ptr)
{
}
DFoo* operator->(void) {return p;};
};
class DFoo
{
public:
void F(void) {};
};
}
%}
%extend foo::DFoo {
static int SExt(int i = 1) {return i;};
int Ext(int i = 2) {return i;};
}
|