Change C++ code generator so that generated classes can be wrapped with SWIG
----------------------------------------------------------------------------
Key: THRIFT-676
URL: https://issues.apache.org/jira/browse/THRIFT-676
Project: Thrift
Issue Type: Improvement
Components: Compiler (C++)
Affects Versions: 0.3
Environment: Any C++
Reporter: Rush Manbert
There are times when it would be beneficial to wrap Thrift-generated C++
classes with the SWIG tool (http://www.swig.org). This is a problem, though,
because SWIG does not yet handle nested class or structure definitions and the
C++ code generator defines the __isset structure within the scope of the class
definition to which it pertains.
In order to make the Thrift-generated classes wrappable by SWIG, the __isset
structure definition needs to be moved outside of the class definition. For a
Thrift generated class called foo, the __isset definition would look like this:
typedef struct _foo__isset {
_foo__isset() : member0(false), member1(false) {}
bool member0;
bool member1;
} _foo__isset;
and the using class would contain this line:
_foo__isset __isset;
All existing code will continue to work, and can be regenerated at will.
I have a patch for this.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.