PageRenderTime 33ms CodeModel.GetById 8ms RepoModel.GetById 1ms app.codeStats 0ms

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

#
Swig | 40 lines | 27 code | 13 blank | 0 comment | 0 complexity | da9eee0cc20321edd49ec99023af2402 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. // This file tests SWIG pass/return by value for
  2. // a class with no default constructor
  3. %module cpp_nodefault
  4. %inline %{
  5. class Foo {
  6. public:
  7. int a;
  8. Foo(int x, int y) { }
  9. ~Foo() {}
  10. };
  11. Foo create(int x, int y) {
  12. return Foo(x,y);
  13. }
  14. typedef Foo Foo_t;
  15. void consume(Foo f, Foo_t g) {}
  16. class Bar {
  17. public:
  18. void consume(Foo f, Foo_t g) {}
  19. Foo create(int x, int y) {
  20. return Foo(x,y);
  21. }
  22. };
  23. %}
  24. %{
  25. Foo gvar = Foo(3,4);
  26. %}
  27. Foo gvar;