PageRenderTime 14ms CodeModel.GetById 12ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

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

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