Re: [pygccxml-development] properties detection
Brought to you by:
mbaas,
roman_yakovenko
From: Roman Y. <rom...@gm...> - 2008-08-07 18:09:14
|
On Thu, Aug 7, 2008 at 8:47 PM, Damien Fagnou <dam...@mo...> wrote: > Hi , > > we are trying to use the Python properties , > idealy I would like to use the automatic detection : > > mb = module_builder_t( ... ) > number = mb.class_( 'myClass' ) > number.add_properties( exclude_accessors=False ) #accessors will be exposed > > our accessor are of type : > > float getRadius(); > void setRadius(float rad); > > and I would like the properties to be 'radius' > > is this form normaly detected ? No. "get" function should be const, otherwise Py++ thinks that the function has a side effect, and doesn't expose it as property. > we try to do : > self.moduleBuilder.classes().add_properties( exclude_accessors=False ) > > but nothing .. > is there a way to see more what the add_properties algo is doing ? Of course. It is open source project :-) Take a look on this file http://pygccxml.svn.sourceforge.net/viewvc/pygccxml/pyplusplus_dev/pyplusplus/decl_wrappers/properties.py?revision=842&view=markup In your case I suggest you to create new class, which derives from name_based_recognizer_t class and override "is_getter" function. Then pass instance of the new class to add_properties method: number.add_properties( recognizer=..., exclude_accessors=False ) #accessors will be exposed As for the name, you can also override "find_out_property_name" function, so it will convert "Radius" to "radius" HTH. -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |