Re: [pygccxml-development] Adding wrappers...
Brought to you by:
mbaas,
roman_yakovenko
From: Matthias B. <ba...@ir...> - 2006-04-11 07:37:06
|
Roman Yakovenko wrote: > Good. I knew that you plan next revolution in py++. Evolution! It's evolution, not Revolution... ;-) > every class has associated class wrapper with it. file writers > guarantee that class > will see definition of it's class wrapper, otherwise it will not compile. On That's already the first problem. Currently, a class either has an entire class wrapper or no wrapper at all. But often it would already be enough to just provide wrappers for individual methods. It wouldn't be necessary to create a new C++ wrapper class for that purpose. > decl_wrappers.class_t we have add_code/add_wrapper_code functionality. > I propose to add similar functionality to decl_wrappers.calldef_t class: two > properties: replace_code and replace_wrapper_code. module_creator.creator_t > class will check those properties and will create right code creators, > that instead of > generating default code will put user code as is. But if we simply replace code then the new code must implement the functionality of the previous code. But as a user I don't know what code pyplusplus has already added to a wrapper so I can't provide its functionality. And by simply replacing it we ignore the previous code and the result might not work as expected anymore. I think adding user wrapper code must not interfere with previously added code by pyplusplus. I'm currently experimenting with a model that is similar to the existing code creators, sort of special "micro code creators" that together create one wrapper method. I'll post more about that in a separate mail. >> but it seems that adding code to a generated file is not possible. > > You can always to derive from built-in file_writer and implement your own one. > This is was my original idea. I was already toying with that idea but haven't done so yet... >> Alternatively, I could stick my new code in a separate file (.h/.cpp). >> Then the only problem is to include the header in the pyplusplus file. >> As far as I can tell this also cannot be done on a file-by-file basis, >> but I could add the header files to *all* generated files at once (not >> really a nice solution but at least it could work). > > No, the better solution is to add to code_creators.class_t list of > code_creators.include_t. Thus file writer will understand that user provided an > additional header files and will put them in a right place. I can add include_t creators to classes? ok, I'll keep that in mind and will try it out eventually... - Matthias - |