/tags/rel-1-3-26/SWIG/Examples/test-suite/director_enum.i
Swig | 85 lines | 63 code | 22 blank | 0 comment | 0 complexity | 5f44e6e400d0b4ce6f95eb82b5fb98db MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
1%module(directors="1") director_enum 2 3%warnfilter(801) EnumDirector::hi; /* Ruby, wrong constant name */ 4%warnfilter(801) EnumDirector::hello; /* Ruby, wrong constant name */ 5%warnfilter(801) EnumDirector::yo; /* Ruby, wrong constant name */ 6%warnfilter(801) EnumDirector::awright; /* Ruby, wrong constant name */ 7%warnfilter(801) EnumDirector::Foo::ciao; /* Ruby, wrong constant name */ 8%warnfilter(801) EnumDirector::Foo::aufwiedersehen; /* Ruby, wrong constant name */ 9%warnfilter(801) EnumDirector::Foo::adios; /* Ruby, wrong constant name */ 10%warnfilter(470) EnumDirector::Foo; /* Thread/reentrant unsafe wrapping, consider returning by value instead. */ 11 12 13 14%feature("director") Foo; 15 16%rename(Hallo) EnumDirector::Hello; 17 18%inline %{ 19namespace EnumDirector { 20 struct A; 21 22 enum Hello { 23 hi, hello, yo, awright = 10 24 }; 25 26 class Foo { 27 public: 28 enum Bye { 29 ciao, aufwiedersehen = 100, adios 30 }; 31 virtual ~Foo() {} 32 virtual Hello say_hi(Hello h){ return h;} 33 virtual Hello say_hello(Hello){ return hello;} 34 virtual Hello say_hi(A *a){ return hi;} 35 virtual Bye say_bye(Bye b){ return b;} 36 virtual const Hello & say_hi_ref(const Hello & h){ return h;} 37 38 Hello ping(Hello h){ return say_hi(h);} 39 const Hello & ping_ref(const Hello &h){ return say_hi_ref(h);} 40 Bye ping_member_enum(Bye b){ return say_bye(b);} 41 42 }; 43} 44%} 45 46%feature("director"); 47 48%inline %{ 49namespace EnumDirector { 50enum FType{ SA = -1, NA=0, EA=1}; 51 52struct A{ 53 A(const double a, const double b, const FType c) 54 {} 55 56 virtual ~A() {} 57 58 virtual int f(int i=0) {return i;} 59}; 60 61struct B : public A{ 62 B(const double a, const double b, const FType c) 63 : A(a, b, c) 64 {} 65}; 66} 67%} 68 69 70%inline %{ 71namespace EnumDirector { 72struct A2{ 73 A2(const FType c = NA) {} 74 75 virtual ~A2() {} 76 77 virtual int f(int i=0) {return i;} 78}; 79 80struct B2 : public A2{ 81 B2(const FType c) : A2(c) {} 82}; 83} 84 85%}