Revision: 1089
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1089&view=rev
Author: roman_yakovenko
Date: 2007-07-28 10:59:35 -0700 (Sat, 28 Jul 2007)
Log Message:
-----------
adding FT for constructor as comments
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/function_transformers/controllers.py
pyplusplus_dev/pyplusplus/function_transformers/templates.py
pyplusplus_dev/pyplusplus/function_transformers/transformer.py
pyplusplus_dev/pyplusplus/function_transformers/transformers.py
Modified: pyplusplus_dev/pyplusplus/function_transformers/controllers.py
===================================================================
--- pyplusplus_dev/pyplusplus/function_transformers/controllers.py 2007-07-28 17:55:06 UTC (rev 1088)
+++ pyplusplus_dev/pyplusplus/function_transformers/controllers.py 2007-07-28 17:59:35 UTC (rev 1089)
@@ -336,3 +336,80 @@
@property
def default_controller( self ):
return self.__default_cntrl
+
+
+#TODO: FT for constructor
+
+#~ class constructor_controller_t( controller_base_t ):
+ #~ def __init__( self, function ):
+ #~ controller_base_t.__init__( self, function )
+ #~ self.__vars_manager = create_variables_manager( function )
+ #~ self.__wrapper_args = [ arg.clone() for arg in function.arguments ]
+ #~ self.__result_var = variable_t( self.wrapper_return_type
+ #~ , self.register_variable_name( 'result' ) )
+ #~ self.__pre_call = []
+ #~ self.__post_call = []
+ #~ self.__arg_expressions = [ arg.name for arg in function.arguments ]
+
+ #~ @property
+ #~ def variables( self ):
+ #~ return self.__vars_manager.variables
+
+ #~ def declare_variable( self, type, name, initialize_expr='' ):
+ #~ return self.__vars_manager.declare_variable( type, name, initialize_expr)
+
+ #~ def register_variable_name( self, name ):
+ #~ return self.__vars_manager.register_name( name )
+
+ #~ @property
+ #~ def result_variable( self ):
+ #~ return self.__result_var
+
+ #~ @property
+ #~ def template( self ):
+ #~ return templates.constructor.body
+
+ #~ @property
+ #~ def wrapper_args( self ):
+ #~ return filter( None, self.__wrapper_args )
+
+ #~ def find_wrapper_arg( self, name ):
+ #~ for arg in self.wrapper_args:
+ #~ if arg.name == name:
+ #~ return arg
+ #~ return None
+
+ #~ def remove_wrapper_arg( self, name ):
+ #~ arg = self.find_wrapper_arg( name )
+ #~ if not arg:
+ #~ raise LookupError( "Unable to remove '%s' argument - not found!" % name )
+ #~ self.__wrapper_args[ self.__wrapper_args.index(arg) ] = None
+
+ #~ @property
+ #~ def arg_expressions( self ):
+ #~ return self.__arg_expressions
+
+ #~ def modify_arg_expression( self, index, expression ):
+ #~ self.arg_expressions[ index ] = expression
+
+ #~ @property
+ #~ def wrapper_return_type( self ):
+ #~ return declarations.dummy_type_t( 'std::auto_ptr< %s >' % self.function.parent.decl_string )
+
+ #~ @property
+ #~ def pre_call( self ):
+ #~ return self.__pre_call
+
+ #~ def add_pre_call_code( self, code ):
+ #~ self.__pre_call.append( code )
+
+ #~ @property
+ #~ def post_call( self ):
+ #~ return self.__post_call
+
+ #~ def add_post_call_code( self, code ):
+ #~ self.__post_call.append( code )
+
+ #~ def apply( self, transformations ):
+ #~ map( lambda t: t.configure_mem_fun( self ), transformations )
+
Modified: pyplusplus_dev/pyplusplus/function_transformers/templates.py
===================================================================
--- pyplusplus_dev/pyplusplus/function_transformers/templates.py 2007-07-28 17:55:06 UTC (rev 1088)
+++ pyplusplus_dev/pyplusplus/function_transformers/templates.py 2007-07-28 17:59:35 UTC (rev 1089)
@@ -55,7 +55,21 @@
, '}'
]))
+#TODO: FT for constructor
+#~ class constructor:
+ #~ #User cannot apply transformation on constructor of abstract class
+ #~ #It is not possible to create an instance of such class
+ #~ body = Template( os.linesep.join([
+ #~ 'std::auto_ptr<$exposed_class> $unique_function_name( $arg_declarations ){'
+ #~ , ' $declare_variables'
+ #~ , ' $pre_call'
+ #~ , ' std::auto_ptr<$exposed_class> $result( new $exposed_class($arg_expressions) );'
+ #~ , ' $post_call'
+ #~ , ' return $result;'
+ #~ , '}'
+ #~ ]))
+
def substitute( text, **keywd ):
return Template( text ).substitute( **keywd )
Modified: pyplusplus_dev/pyplusplus/function_transformers/transformer.py
===================================================================
--- pyplusplus_dev/pyplusplus/function_transformers/transformer.py 2007-07-28 17:55:06 UTC (rev 1088)
+++ pyplusplus_dev/pyplusplus/function_transformers/transformer.py 2007-07-28 17:59:35 UTC (rev 1089)
@@ -64,7 +64,7 @@
@param controller: instance of L{mem_fun_controller_t} class
"""
- pass
+ raise NotImplementedError(self.__class__.__name__)
def configure_free_fun( self, controller ):
"""Transformers should overridde the method, in order to define custom
@@ -72,7 +72,7 @@
@param controller: instance of L{free_fun_controller_t} class
"""
- pass
+ raise NotImplementedError(self.__class__.__name__)
def configure_virtual_mem_fun( self, controller ):
"""Transformers should overridde the method, in order to define custom
@@ -80,5 +80,14 @@
@param controller: instance of L{virtual_mem_fun_controller_t} class
"""
- pass
+ raise NotImplementedError(self.__class__.__name__)
+
+#TODO: FT for constructor
+ #~ def configure_constructor( self, controller ):
+ #~ """Transformers should overridde the method, in order to define custom
+ #~ transformation for constructor.
+ #~ @param controller: instance of L{constructor_controller_t} class
+ #~ """
+ #~ raise NotImplementedError(self.__class__.__name__)
+
Modified: pyplusplus_dev/pyplusplus/function_transformers/transformers.py
===================================================================
--- pyplusplus_dev/pyplusplus/function_transformers/transformers.py 2007-07-28 17:55:06 UTC (rev 1088)
+++ pyplusplus_dev/pyplusplus/function_transformers/transformers.py 2007-07-28 17:59:35 UTC (rev 1089)
@@ -535,7 +535,11 @@
self.__configure_sealed( controller )
def configure_virtual_mem_fun( self, controller ):
- raise NotImplementedError()
+ raise NotImplementedError(self.__class__.__name__)
+
+#TODO: FT for constructor
+ #~ def configure_constructor( self, controller ):
+ #~ self.__configure_sealed( controller )
def required_headers( self ):
"""Returns list of header files that transformer generated code depends on."""
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|