Re: [pygccxml-development] Adding properties
Brought to you by:
mbaas,
roman_yakovenko
|
From: Roman Y. <rom...@gm...> - 2006-09-21 17:56:31
|
On 9/21/06, Kevin Bluck <kev...@gm...> wrote:
> Is there a proper way to declare properties in Py++? I've looked around
> but can't find anything apparent. The only way I can see is something like:
>
> Foo.add_code('add_property("Value", &Foo::getValue)')
>
Take a look on next examples:
A simple one:
http://svn.sourceforge.net/viewvc/pygccxml/pyplusplus_dev/examples/custom_code_creator/
More complex one:
http://python-ogre.python-hosting.com/file/trunk/python-ogre/properties.py
I know it is not as simple as you expect. If you can wait I plan to
add support for
properties in a week or two
struct Foo{
int get_x();
void set_x( int x );
};
mb = module_builder_t( ... )
foo = mb.class_( 'Foo' )
foo.property_( foo.member_function( 'get_x' ), foo.member_function( 'set_x' ) )
#or may be next interface
foo.property_( 'get_x', 'set_x' )
Thoughts?
--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
|