PageRenderTime 43ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/rel-1-3-26/SWIG/Examples/test-suite/director_detect.i

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