Re: [pygccxml-development] Adding wrappers...
Brought to you by:
mbaas,
roman_yakovenko
From: Roman Y. <rom...@gm...> - 2006-04-11 07:53:20
|
On 4/11/06, Matthias Baas <ba...@ir...> wrote: > 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 compil= e. 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. If I understand you right: function can have wrapper, but it is not necessary that the wrapper belongs to the class. May be good idea. I need to check whether= it could be implemented with simple interface. > > 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.creat= or_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 have very different opinion. My rule is simple:user knows better that py+= +. > 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. Good, I'd like to see it. > >> 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 o= wn one. > > This is was my original idea. > > I was already toying with that idea but haven't done so yet... It should be simple. > >> 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 pro= vided 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... It is not implemented yet, I see it as one possible solution. > - Matthias - -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |