PageRenderTime 44ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/Examples/lua/owner/example.i

#
Swig | 32 lines | 18 code | 9 blank | 5 comment | 0 complexity | 5e406352428df6d1a5e1e580f752b929 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. /* File : example.i */
  2. %module example
  3. %{
  4. #include "example.h"
  5. %}
  6. // before we grab the header file, we must warn SWIG about some of these functions.
  7. // these functions create data, so must be managed
  8. %newobject createCircle;
  9. %newobject createSquare;
  10. // this method returns as pointer which must be managed
  11. %newobject ShapeOwner::remove;
  12. // you cannot use %delobject on ShapeOwner::add()
  13. // as this disowns the ShapeOwner, not the Shape (oops)
  14. //%delobject ShapeOwner::add(Shape*); DO NOT USE
  15. // either you can use a new function (such as this)
  16. /*%delobject add_Shape;
  17. %inline %{
  18. void add_Shape(Shape* s,ShapeOwner* own){own->add(s);}
  19. %}*/
  20. // or a better solution is a typemap
  21. %apply SWIGTYPE *DISOWN {Shape* ptr};
  22. // now we can grab the header file
  23. %include "example.h"