PageRenderTime 51ms CodeModel.GetById 24ms RepoModel.GetById 1ms app.codeStats 0ms

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

#
Swig | 47 lines | 36 code | 11 blank | 0 comment | 0 complexity | 34f053b4cc916dea5221ec429b46049a MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. %module typemap_self
  2. // This typemap should be ignored for self?
  3. %typemap(in) A* (A* ptr) {
  4. if (SWIG_ConvertPtr($input, (void**) &ptr, $1_descriptor, 0) != -1) {
  5. $1 = ptr;
  6. } else {
  7. $1 = new A();
  8. }
  9. }
  10. // Simple but unsecure current fix
  11. //%apply SWIGTYPE* {A* self}
  12. %inline %{
  13. class A;
  14. int foo(A* self)
  15. {
  16. return 0;
  17. }
  18. struct A
  19. {
  20. static int bar(int, A* self)
  21. {
  22. return 1;
  23. }
  24. int val;
  25. int foo(A* self, A* b)
  26. {
  27. return 1;
  28. }
  29. };
  30. struct B
  31. {
  32. B(A*)
  33. {
  34. }
  35. };
  36. %}