Trees | Indices | Help |
|
---|
|
1 # Copyright 2006 Roman Yakovenko. 2 # Distributed under the Boost Software License, Version 1.0. (See 3 # accompanying file LICENSE_1_0.txt or copy at 4 # http://www.boost.org/LICENSE_1_0.txt) 5 6 """This module contains the class L{transformer_t}. 7 """ 8 9 import sys, os.path, copy, re, types 10 from pygccxml import declarations, parser 11 12 return_ = -113 #return_ is a spacial const, which represent an index of return type 14 15 -class transformer_t(object):16 """Base class for a function transformer.""" 17 18 USE_1_BASED_INDEXING = False 1984 85 #TODO: FT for constructor 86 #~ def configure_constructor( self, controller ): 87 #~ """Transformers should overridde the method, in order to define custom 88 #~ transformation for constructor. 89 90 #~ @param controller: instance of L{constructor_controller_t} class 91 #~ """ 92 #~ raise NotImplementedError(self.__class__.__name__) 9321 """@param function: reference to function declaration""" 22 object.__init__( self ) 23 self.__function = function24 25 @property 2931 """Returns list of header files that transformer generated code depends on.""" 32 raise NotImplementedError( self.__class__.__name__ )3335 """returns reference to the desired argument 36 37 @param reference: name( str ) or index( int ) of the argument 38 """ 39 if isinstance( reference, str ): 40 found = filter( lambda arg: arg.name == reference, self.function.arguments ) 41 if len( found ) == 1: 42 return found[0] 43 raise RuntimeError( "Argument with %s was not found" % reference ) 44 else: 45 assert isinstance( reference, int ) 46 if transformer_t.USE_1_BASED_INDEXING: 47 reference += 1 48 return self.function.arguments[ reference ]4951 """returns type of the desired argument or return type of the function 52 53 @param reference: name( str ) or index( int ) of the argument 54 """ 55 global return_ 56 if isinstance( reference, int ) and reference == return_: 57 return self.function.return_type 58 else: 59 return self.get_argument( reference ).type6062 """Transformers should overridde the method, in order to define custom 63 transformation for non-virtual member function. 64 65 @param controller: instance of L{mem_fun_controller_t} class 66 """ 67 raise NotImplementedError(self.__class__.__name__)6870 """Transformers should overridde the method, in order to define custom 71 transformation for free function. 72 73 @param controller: instance of L{free_fun_controller_t} class 74 """ 75 raise NotImplementedError(self.__class__.__name__)76
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Mon Oct 20 08:51:41 2008 | http://epydoc.sourceforge.net |