PageRenderTime 39ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/Examples/test-suite/director_detect.i

#
Swig | 72 lines | 52 code | 20 blank | 0 comment | 0 complexity | 28391540629dcf09f6a83fd22995313a MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. %module(directors="1") director_detect
  2. #pragma SWIG nowarn=SWIGWARN_TYPEMAP_THREAD_UNSAFE,SWIGWARN_TYPEMAP_DIRECTOROUT_PTR
  3. %warnfilter(SWIGWARN_JAVA_COVARIANT_RET,
  4. SWIGWARN_CSHARP_COVARIANT_RET) cloner; /* Java, C# covariant return types */
  5. %{
  6. #include <string>
  7. #include <iostream>
  8. %}
  9. %include <std_string.i>
  10. %feature("director") Bar;
  11. %feature("director") Foo;
  12. %newobject Foo::cloner();
  13. %newobject Foo::get_class();
  14. %newobject Bar::cloner();
  15. %newobject Bar::get_class();
  16. %inline {
  17. namespace foo { typedef int Int; }
  18. struct A
  19. {
  20. };
  21. typedef A B;
  22. struct Foo {
  23. virtual ~Foo() {}
  24. virtual Foo* cloner() = 0;
  25. virtual int get_value() = 0;
  26. virtual A* get_class() = 0;
  27. virtual void just_do_it() = 0;
  28. };
  29. class Bar : public Foo
  30. {
  31. public:
  32. Foo* baseclass()
  33. {
  34. return this;
  35. }
  36. Bar* cloner()
  37. {
  38. return new Bar();
  39. }
  40. foo::Int get_value()
  41. {
  42. return 1;
  43. }
  44. B* get_class()
  45. {
  46. return new B();
  47. }
  48. void just_do_it()
  49. {
  50. }
  51. };
  52. }