[pygccxml-development] Re: typedef lookup feature from long ago...
Brought to you by:
mbaas,
roman_yakovenko
From: Roman Y. <rom...@gm...> - 2006-05-31 04:14:18
|
On 5/31/06, Allen Bierbaum <al...@vr...> wrote: > Roman: > > Taking into account that you will be out of contact soon, there is one > feature I know I am going to need that I used in the old prototype API. > I must apologize that I don't remember the exact details, but what it > boiled down to was being able to lookup a full resolved type from a typedef. > > So if I had something like: > > typedef really_complex< nested<int>, ugly<long>, 56> simple_t; > > I would need to be able to look it up from simple_t to get the type > information. It is the mTypeDefMap inside the old pypp_api (it is still > in experimental). > > The code to look at is in parse() at the end: > > typedef_decls = declarations.make_flatten(parsed_decls) > typedef_decls = decls = filter( lambda x: (isinstance( x, > declarations.typedef_t ) and > not > x.name.startswith('__') and > x.location.file_name != > "<internal>") > , typedef_decls ) > > self.mTypeDefMap = {} > for d in typedef_decls: > type_def_name = d.name > full_name = declarations.full_name(d) > if full_name.startswith("::"): # Remove the base namespace > full_name = full_name[2:] > real_type_name = d.type.decl_string > if real_type_name.startswith("::"): # Remove base namespace > real_type_name = real_type_name[2:] > self.mTypeDefMap[full_name] = real_type_name > > > So my question is, do I have another "easy" way to do this with the > current API? Typedef class has 2 properties: name and type. I believe type is what you are looking for. > I probably won't need it until this weekend or the beginning of next > week, but if you are going to get busy I wanted to ask before you have > better things to do then answer e-mails from pesky people like me. :) :-) > -Allen > > -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |