Re: [pygccxml-development] [FT]input_t class - new vision.
Brought to you by:
mbaas,
roman_yakovenko
From: Roman Y. <rom...@gm...> - 2006-09-14 18:12:14
|
On 9/14/06, Matthias Baas <ba...@ir...> wrote: > Roman Yakovenko wrote: > > So how it is related to "input_t" ? "input_t" transformer removes > > reference or pointer > > from the argument type. In my case I want to modify the argument type > > too, but I also > > want to specify the new type. Same logic is applied on return type. > > > > May be we can change\extend input_t class ( and rename it ) so it will > > provide this functionality? > > What name and new construction arguments do you suggest? > > This might also be an example where it could actually be useful to apply > several transformers to one argument (I haven't had such a case yet). > For example, if there would be a policy remove_const_t you could apply > both, input_t and remove_const_t, to the same argument. I think this > should even work already with the current version. from pygccxml import declarations type_transformation_t ? def __init__( self, arg_id, transformation=None ): self.arg_id = arg_id if None is self.transformation: #by default just remove reference #because I expect this will be applied to immutable passed by ref self.transformation = lambda type_: declarations.remove_reference( type_ ) elif is_callable( transformation ): #let user define the transformation self.transformation = transformation else: #user already knows what he wants, so we will just use it assert isinstance( transformation, declarations.type_t ) self.transformation = lambda type_: transformation transf = type_transformation_t( 1 , lambda type_: declarations.remove_reference( declarations.remove_const( type_ ) ) ) Something like this. -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |