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

/tags/rel-1.3.35/Examples/test-suite/rename_scope.i

#
Swig | 68 lines | 58 code | 10 blank | 0 comment | 0 complexity | 4e81574f3e184421e548a467f5c4c3aa MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. %module rename_scope
  2. %inline
  3. %{
  4. namespace oss
  5. {
  6. enum Polarization { UnaryPolarization, BinaryPolarization };
  7. template <Polarization P>
  8. struct Interface
  9. {
  10. };
  11. }
  12. %}
  13. namespace oss
  14. {
  15. // Interface
  16. %template(Interface_UP) Interface<UnaryPolarization>;
  17. %template(Interface_BP) Interface<BinaryPolarization>;
  18. }
  19. %inline
  20. %{
  21. namespace oss
  22. {
  23. namespace interfaces
  24. {
  25. template <Polarization P>
  26. struct Natural : Interface<P>
  27. {
  28. int test(void) { return 1; }
  29. };
  30. }
  31. }
  32. %}
  33. namespace oss
  34. {
  35. namespace interfaces
  36. {
  37. %rename(rtest) Natural<UnaryPolarization>::test;
  38. %rename(rtest) Natural<oss::BinaryPolarization>::test;
  39. // Natural
  40. %template(Natural_UP) Natural<UnaryPolarization>;
  41. %template(Natural_BP) Natural<BinaryPolarization>;
  42. }
  43. }
  44. %rename("equals") operator==;
  45. %inline %{
  46. namespace Utilities {
  47. class Bucket
  48. {
  49. public:
  50. Bucket() : m_left(0) {}
  51. friend bool operator==(const Bucket& lhs, const Bucket& rhs){
  52. return ( rhs.m_left == lhs.m_left );
  53. }
  54. private:
  55. int m_left;
  56. };
  57. }
  58. %}