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

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

#
Swig | 43 lines | 18 code | 8 blank | 17 comment | 0 complexity | 0b1f9a8a837f300b7959df101fc5aa2b MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. %module enum_template
  2. %warnfilter(801) eTest0; /* Ruby, wrong class name */
  3. %warnfilter(801) eTest1; /* Ruby, wrong class name */
  4. %warnfilter(801) eTest2; /* Ruby, wrong class name */
  5. /*
  6. From bug report 992329:
  7. In Python I see
  8. >>> import enum_template
  9. >>> enum_template.MakeETest()
  10. '_60561408_p_ETest'
  11. >>> enum_template.TakeETest(0)
  12. Traceback (most recent call last):
  13. File "<stdin>", line 1, in ?
  14. TypeError: Expected a pointer
  15. Without the %template, things work fine: the first
  16. function call returns an integer, and the second
  17. succeeds.
  18. */
  19. %inline %{
  20. enum ETest
  21. {
  22. eTest0,
  23. eTest1,
  24. eTest2
  25. };
  26. void TakeETest(ETest test) {};
  27. ETest MakeETest(void) {return eTest1;};
  28. template<class T> class CTempl
  29. {
  30. };
  31. %}
  32. %template(CTempl_ETest) CTempl<ETest>;