PageRenderTime 41ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

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

#
Swig | 76 lines | 63 code | 13 blank | 0 comment | 0 complexity | 3170b1506647e355f87fb02b28fcb294 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. %module conversion_ns_template
  2. %{
  3. namespace oss
  4. {
  5. struct Hi
  6. {
  7. Hi(){}
  8. Hi(int){}
  9. };
  10. enum Test {One, Two};
  11. template <Test>
  12. struct Foo {
  13. Foo(){}
  14. };
  15. template <Test T>
  16. struct Bar {
  17. Bar(){ }
  18. Bar(int){ }
  19. operator int() { return 0; }
  20. operator int&() { static int num = 0; return num; }
  21. operator Foo<T>() { return Foo<T>(); }
  22. operator Foo<T>&() { return *(new Foo<T>()); }
  23. };
  24. }
  25. %}
  26. namespace oss
  27. {
  28. enum Test {One, Two};
  29. // these works
  30. %ignore Hi::Hi();
  31. %rename(create) Hi::Hi(int);
  32. struct Hi
  33. {
  34. Hi();
  35. Hi(int);
  36. };
  37. template <Test>
  38. struct Foo {
  39. Foo();
  40. };
  41. // these works
  42. %rename(hello1) Bar<One>::operator int&();
  43. %ignore Bar<One>::operator int();
  44. %rename(hello2) Bar<One>::operator Foo<oss::One>&();
  45. %ignore Bar<One>::operator Foo<oss::One>();
  46. // these don't
  47. %ignore Bar<One>::Bar();
  48. %rename(Bar_create) Bar<One>::Bar(int);
  49. template <Test T>
  50. struct Bar {
  51. Bar();
  52. Bar(int);
  53. operator int();
  54. operator int&();
  55. operator Foo<T>();
  56. operator Foo<T>&();
  57. };
  58. }
  59. namespace oss
  60. {
  61. %template(Foo_One) Foo<One>;
  62. %template(Bar_One) Bar<One>;
  63. }