[C++-sig] Another bug in pyplusplus
roman.yakovenko at gmail.com
Sun Jun 18 19:57:43 CEST 2006
On 6/18/06, Niall Douglas <s_sourceforge at nedprod.com> wrote:
> > > 3. FXImage subclasses don't provide a working getData(). This
> > > requires custom body text insertion to be added to pyplusplus.
> > Can you send short example what pyplusplus generates now and the code you need
> > to be generated, may be I will find a solution.
> All I need is the ability to insert custom code into the body of
> class files. Put simply, I need to insert DEFINEMAKECARRAYITER at the
> top of every FXImage.pypp.cpp, FXBMPImage.pypp.cpp,
> FXJPGImage.pypp.cpp etc.
> It needs to go before or after the wrapper class. Declared inside the
> If you add an overloads section (see previous email) containing all
> the BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS declarations (which MUST
> come after the wrapper class but before the register function), then
> I could add them there as a custom text code creator.
There is a solution. You can generate all code that uses DEFINEMAKECARRAYITER
in some header file and then to include it.
mb = module_builder_t( ... )
for cls in mb.classes( lambda decl: decl.name.endswith( 'Image' ) ):
generate code to some header file
mb.build_code_creator( ... )
mb.code_creator.add_include( that header file )
I have another solution, but I don't have time to implement it or even check:
pyplusplus can divide every generated cpp file to sections:
Then, pyplusplus can define next class:
def on_include( self, declaration ):
def on_second space
Every function return some text or None. In case method returns None
pyplusplus will write the code it have to write. In case method returns some
text, this text will be written instead.
C++ Python language binding
More information about the Cplusplus-sig