Re: [pygccxml-development] mdecl and methods that return values
Brought to you by:
mbaas,
roman_yakovenko
From: Allen B. <al...@vr...> - 2006-05-30 19:54:13
|
Roman Yakovenko wrote: > On 5/30/06, Allen Bierbaum <al...@vr...> wrote: > >> I think you are talking about this part of the test: >> >> mb.global_ns[ *'public_base_t'* ].exclude() > > > Right > >> Change it to something like this: >> >> mb.global_ns[ *'public_base_t'* ]['myFunction'].exclude() >> >> OR >> >> mb.global_ns[ *'public_base_t'* >> ].member_functions('myFunction').exclude() > > > Now, I don't need unit test. I see why this does not work. Thanks. > > Now I know that you want redefine call_redirector_t.__call__ method in > next way: > > #now > def __call__( self, *arguments, **keywords ): > for d in self.decls: > callable_ = getattr(d, self.name) > callable_( *arguments, **keywords ) > > #you want: > def __call__( self, *arguments, **keywords ): > results = [] > for d in self.decls: > callable_ = getattr(d, self.name) > answer = callable_( *arguments, **keywords ) > results.append( answer ) > #I assume that all functions will return same type: > if not results: > return > if isinstance( results[0], declaration_t ): > return mdecl_wrapper_t( results ) > elif isinstance( results[0], mdecl_wrapper_t ): > temp_decls = [] > for mdecl_wrapper in results: > temp_decls.extend( mdecl_wrapper.decls ) > return mdecl_wrapper_t( temp_decls ) > else: > return results > > Can you test whether this code will work for you or not? This is close, but not quite all the code is there. I have attached a diff where I fixed up the implementation and added code to the mdecl_wrapper.__getitem__ method to allow calls like I wanted to make. See attached... -Allen > |