From: William S F. <ws...@fu...> - 2012-02-16 06:58:16
|
On 16/02/12 06:49, William S Fulton wrote: > On 15/02/12 20:54, mtvs wrote: >> >> I am a SWIG/JNI n00b and am trying to find a way to pick specific >> structs/classes from the included C++ header file to generate the Java >> wrapper code for. In my case, the C++ header file is generated by >> apache/thrift and has numerous class definitions in it. I want to tell >> swig >> to generate the wrapper only for one of the generated types. Using >> %ignore >> to skip everything else in the class is very painful because of the >> number >> of types I have to add to the ignore list. >> >> Is there a better way to do this? Essentially I want something similar to >> %include which can cherry pick types from the included header. >> >> Thanks for helping! > > > > %ignore ""; // ignore everything - same as: %rename($ignore) ""; > > // unignore selected class 'Circle' including constructor, destructor > and a method called 'area' > %rename("%s") Circle; > %rename("%s") Circle::Circle; > %rename("%s") Circle::~Circle; > %rename("%s") Circle::area; > > %include "example.h" // defines many classes including 'Circle' > > Take a look at http://www.swig.org/Doc2.0/SWIG.html#SWIG_rename_ignore > for more on advanced renaming and ignoring. You'll also find a bit more > info in swig.swg as well as in the CHANGES file entry dated: > "01/12/2006: mmatus". Note that the CHANGES entry is out of date. The special variables, like %isfunction, are now %$isfunction as defined in swig.swg. William |