PageRenderTime 177ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

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

#
Swig | 56 lines | 43 code | 13 blank | 0 comment | 0 complexity | c7e892675bcf9daff91919a7f8c4b178 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. %module smart_pointer_member
  2. %warnfilter(SWIGWARN_GO_NAME_CONFLICT); /* Ignoring 'foo' due to Go name ('Foo') conflict with 'Foo' */
  3. %inline %{
  4. class Foo {
  5. public:
  6. int x[4];
  7. int y;
  8. static const int z;
  9. static const int ZZ = 3;
  10. static int zx;
  11. static int boo() { return 0;}
  12. friend int foo(Foo* foo) { return 0;}
  13. };
  14. class Bar {
  15. Foo *f;
  16. public:
  17. Bar(Foo *f) : f(f) { }
  18. Foo *operator->() {
  19. return f;
  20. }
  21. static int bua() { return 0;}
  22. };
  23. class CBar {
  24. Foo *f;
  25. public:
  26. CBar(Foo *f) : f(f) { }
  27. const Foo *operator->() {
  28. return f;
  29. }
  30. };
  31. int get_y(Bar *b)
  32. {
  33. return (*b)->y;
  34. }
  35. int get_z(Bar *b)
  36. {
  37. return (*b)->z;
  38. }
  39. %}
  40. %{
  41. const int Foo::z = 3;
  42. int Foo::zx;
  43. %}