PageRenderTime 82ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

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

#
Swig | 68 lines | 55 code | 13 blank | 0 comment | 0 complexity | 96b12a83d4bd90ddfc140eb9bda6cc68 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. %module(ruby_minherit="1") template_inherit_abstract
  2. %warnfilter(SWIGWARN_RUBY_WRONG_NAME) oss::test; /* Ruby, wrong class name */
  3. %warnfilter(SWIGWARN_JAVA_MULTIPLE_INHERITANCE,
  4. SWIGWARN_CSHARP_MULTIPLE_INHERITANCE,
  5. SWIGWARN_D_MULTIPLE_INHERITANCE,
  6. SWIGWARN_PHP_MULTIPLE_INHERITANCE) oss::Module; /* C#, D, Java, PHP multiple inheritance */
  7. %inline %{
  8. namespace oss
  9. {
  10. template <class C>
  11. struct Wrap
  12. {
  13. };
  14. struct ModuleBase
  15. {
  16. virtual ~ModuleBase() {}
  17. virtual int get() = 0;
  18. };
  19. template <class C>
  20. struct Module : C, ModuleBase
  21. {
  22. virtual ~Module() {}
  23. protected:
  24. Module() {}
  25. };
  26. template <class C>
  27. struct HModule : Module<Wrap<C> >
  28. {
  29. // virtual int get(); // declaration here works
  30. protected:
  31. HModule() {}
  32. };
  33. }
  34. struct B
  35. {
  36. };
  37. %}
  38. namespace oss
  39. {
  40. %template(Wrap_B) Wrap<B>;
  41. %template(Module_B) Module<Wrap<B> >;
  42. %template(HModule_B) HModule<B>;
  43. }
  44. %inline %{
  45. namespace oss
  46. {
  47. #if defined(SWIG) && (defined(SWIGCSHARP) || defined(SWIGD))
  48. %ignore HModule<B>::get(); // Work around for lack of multiple inheritance support - base ModuleBase is ignored.
  49. #endif
  50. struct test : HModule<B>
  51. {
  52. virtual int get() {return 0;} // declaration here breaks swig
  53. };
  54. }
  55. %}