PageRenderTime 62ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/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. %warnfilter(801) EnumDirector::hi; /* Ruby, wrong constant name */
  3. %warnfilter(801) EnumDirector::hello; /* Ruby, wrong constant name */
  4. %warnfilter(801) EnumDirector::yo; /* Ruby, wrong constant name */
  5. %warnfilter(801) EnumDirector::awright; /* Ruby, wrong constant name */
  6. %warnfilter(801) EnumDirector::Foo::ciao; /* Ruby, wrong constant name */
  7. %warnfilter(801) EnumDirector::Foo::aufwiedersehen; /* Ruby, wrong constant name */
  8. %warnfilter(801) EnumDirector::Foo::adios; /* Ruby, wrong constant name */
  9. %warnfilter(470) EnumDirector::Foo; /* Thread/reentrant unsafe wrapping, consider returning by value instead. */
  10. %feature("director") Foo;
  11. %rename(Hallo) EnumDirector::Hello;
  12. %inline %{
  13. namespace EnumDirector {
  14. struct A;
  15. enum Hello {
  16. hi, hello, yo, awright = 10
  17. };
  18. class Foo {
  19. public:
  20. enum Bye {
  21. ciao, aufwiedersehen = 100, adios
  22. };
  23. virtual ~Foo() {}
  24. virtual Hello say_hi(Hello h){ return h;}
  25. virtual Hello say_hello(Hello){ return hello;}
  26. virtual Hello say_hi(A *a){ return hi;}
  27. virtual Bye say_bye(Bye b){ return b;}
  28. virtual const Hello & say_hi_ref(const Hello & h){ return h;}
  29. Hello ping(Hello h){ return say_hi(h);}
  30. const Hello & ping_ref(const Hello &h){ return say_hi_ref(h);}
  31. Bye ping_member_enum(Bye b){ return say_bye(b);}
  32. };
  33. }
  34. %}
  35. %feature("director");
  36. %inline %{
  37. namespace EnumDirector {
  38. enum FType{ SA = -1, NA=0, EA=1};
  39. struct A{
  40. A(const double a, const double b, const FType c)
  41. {}
  42. virtual ~A() {}
  43. virtual int f(int i=0) {return i;}
  44. };
  45. struct B : public A{
  46. B(const double a, const double b, const FType c)
  47. : A(a, b, c)
  48. {}
  49. };
  50. }
  51. %}
  52. %inline %{
  53. namespace EnumDirector {
  54. struct A2{
  55. A2(const FType c = NA) {}
  56. virtual ~A2() {}
  57. virtual int f(int i=0) {return i;}
  58. };
  59. struct B2 : public A2{
  60. B2(const FType c) : A2(c) {}
  61. };
  62. }
  63. %}