Revision: 611
http://svn.sourceforge.net/pygccxml/?rev=611&view=rev
Author: roman_yakovenko
Date: 2006-10-01 12:37:00 -0700 (Sun, 01 Oct 2006)
Log Message:
-----------
Fixing bug ingenerated code for next use case:
struct data{
enum EColor{ red, green, blue };
data(EColor c=blue){}
};
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/code_creators/calldef.py
Modified: pyplusplus_dev/pyplusplus/code_creators/calldef.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/calldef.py 2006-10-01 19:20:54 UTC (rev 610)
+++ pyplusplus_dev/pyplusplus/code_creators/calldef.py 2006-10-01 19:37:00 UTC (rev 611)
@@ -55,6 +55,18 @@
def param_sep(self):
return os.linesep + self.indent( self.PARAM_SEPARATOR )
+ def should_use_enum_wa( self, arg ):
+ global use_enum_workaround
+ if not declarations.is_enum( arg.type ):
+ return False
+ if use_enum_workaround:
+ return True
+ #enum belongs to the class we are working on
+ if self.declaration.parent is declarations.enum_declaration( arg.type ).parent \
+ and isinstance( self.declaration, declarations.constructor_t ):
+ return True
+ return False
+
def keywords_args(self):
boost_arg = algorithm.create_identifier( self, '::boost::python::arg' )
boost_obj = algorithm.create_identifier( self, '::boost::python::object' )
@@ -71,7 +83,7 @@
and declarations.is_integral( arg_type_no_alias ) \
and not arg.default_value.startswith( arg_type_no_alias.decl_string ):
result.append( '=(%s)(%s)' % ( arg_type_no_alias.decl_string, arg.default_value ) )
- elif use_enum_workaround and declarations.is_enum( arg.type ):
+ elif self.should_use_enum_wa( arg ):
#Work around for bug/missing functionality in boost.python.
#registration order
result.append( '=(long)(%s)' % arg.default_value )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|