pyste, patch to allow injecting code in class definition
The attached patch allows the user to inject code in the class definition code, just like declaration_code() & module_code(). Among other things, this allows us to add properties when pyste support fail (anonymous union...). Example of usage: Vector3 = Class( "Ogre::Vector3", "OgreVector3.h" ) class_code( Vector3, '.def_readwrite( "x", &Ogre::Vector3::x )' ) class_code( Vector3, '.def_readwrite( "y", &Ogre::Vector3::y )' ) class_code( Vector3, '.def_readwrite( "z", &Ogre::Vector3::z )' ) Which produces: class_< Ogre::Vector3 >("Vector3", init< >()) .def(init< Ogre::Real, Ogre::Real, Ogre::Real >()) .def_readwrite( "x", &Ogre::Vector3::x ) .def_readwrite( "y", &Ogre::Vector3::y ) .def_readwrite( "z", &Ogre::Vector3::z ) ; Baptiste.
participants (1)
-
Baptiste Lepilleur