PageRenderTime 37ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

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

#
Swig | 88 lines | 65 code | 23 blank | 0 comment | 0 complexity | b0e40040a5ef60b58a8cdca43153beeb MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. %module(ruby_minherit="1") using_namespace
  2. %warnfilter(SWIGWARN_RUBY_WRONG_NAME) hi::hi0; /* Ruby, wrong class name */
  3. %warnfilter(SWIGWARN_RUBY_WRONG_NAME) hi::hi1; /* Ruby, wrong class name */
  4. %warnfilter(SWIGWARN_JAVA_MULTIPLE_INHERITANCE,
  5. SWIGWARN_CSHARP_MULTIPLE_INHERITANCE,
  6. SWIGWARN_D_MULTIPLE_INHERITANCE,
  7. SWIGWARN_PHP_MULTIPLE_INHERITANCE) Hi<hello::Hello, hi::hi0>; // C#, D, Java, PHP multiple inheritance
  8. %inline %{
  9. namespace hello
  10. {
  11. struct Hello
  12. {
  13. };
  14. template <class _T1, class _T2>
  15. struct Hi : _T1, _T2
  16. {
  17. int value1() const
  18. {
  19. return 1;
  20. }
  21. int value2() const
  22. {
  23. return 2;
  24. }
  25. };
  26. }
  27. namespace hi
  28. {
  29. struct hi0
  30. {
  31. };
  32. }
  33. %}
  34. namespace hello
  35. {
  36. %template(Hi_hi0) Hi<hello::Hello, hi::hi0>;
  37. }
  38. %inline %{
  39. namespace hi
  40. {
  41. struct hi1 : private hello::Hi< hello::Hello, hi0 >
  42. {
  43. using hello::Hi< hello::Hello, hi::hi0 >::value1;
  44. using hello::Hi< hello::Hello, hi0 >::value2;
  45. };
  46. }
  47. %}
  48. %inline {
  49. namespace foo {
  50. typedef double mytype;
  51. }
  52. // global namespace
  53. typedef float mytype;
  54. using namespace foo;
  55. struct X {
  56. ::mytype d;
  57. };
  58. }
  59. %inline %{
  60. namespace SpaceMan {
  61. typedef double SpaceManDouble;
  62. }
  63. using namespace ::SpaceMan; // global namespace prefix
  64. SpaceManDouble useSpaceMan(SpaceManDouble s) { return s; }
  65. %}