blob: afcd49d3f0f5192549be0035f07aa657b20a9f6f (
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
|
%module(directors="1") director_conversion_operators
%feature("director");
%warnfilter(SWIGWARN_TYPEMAP_DIRECTOROUT_PTR) Bar;
%rename(toFoo) Bar::operator Foo();
%rename(toFooPtr) Bar::operator Foo *();
%rename(toFooRef) Bar::operator Foo &();
%rename(toFooPtrRef) Bar::operator Foo *&();
%rename(toOtherFoo) Bar::operator OtherFoo();
%rename(toOtherFooPtr) Bar::operator OtherFoo *();
%rename(toOtherFooRef) Bar::operator OtherFoo &();
%rename(toOtherFooPtrRef) Bar::operator OtherFoo *&();
%inline %{
struct Foo {
};
struct OtherFoo {
};
struct Bar {
Foo myFoo;
Foo *myFooPtr;
virtual ~Bar() { }
virtual operator Foo () { return Foo(); }
virtual operator Foo *() { return &myFoo; }
virtual operator Foo &() { return myFoo; }
virtual operator Foo *&() { return myFooPtr; }
virtual operator OtherFoo () = 0;
virtual operator OtherFoo *() = 0;
virtual operator OtherFoo &() = 0;
virtual operator OtherFoo *&() = 0;
};
%}
|