pygccxml-commit Mailing List for C++ Python language bindings (Page 65)
Brought to you by:
mbaas,
roman_yakovenko
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
(190) |
Apr
(166) |
May
(170) |
Jun
(75) |
Jul
(105) |
Aug
(131) |
Sep
(99) |
Oct
(84) |
Nov
(67) |
Dec
(54) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(66) |
Feb
(49) |
Mar
(25) |
Apr
(62) |
May
(21) |
Jun
(34) |
Jul
(9) |
Aug
(21) |
Sep
(5) |
Oct
|
Nov
(63) |
Dec
(34) |
2008 |
Jan
(10) |
Feb
(42) |
Mar
(26) |
Apr
(25) |
May
(6) |
Jun
(40) |
Jul
(18) |
Aug
(29) |
Sep
(6) |
Oct
(32) |
Nov
(14) |
Dec
(56) |
2009 |
Jan
(127) |
Feb
(52) |
Mar
(2) |
Apr
(10) |
May
(29) |
Jun
(3) |
Jul
|
Aug
(16) |
Sep
(4) |
Oct
(11) |
Nov
(8) |
Dec
(14) |
2010 |
Jan
(31) |
Feb
(1) |
Mar
(7) |
Apr
(9) |
May
(1) |
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
(8) |
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <rom...@us...> - 2006-06-21 19:50:37
|
Revision: 241 Author: roman_yakovenko Date: 2006-06-21 12:50:27 -0700 (Wed, 21 Jun 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=241&view=rev Log Message: ----------- adding constructor to class declaration generated code Modified Paths: -------------- pyplusplus_dev/pyplusplus/code_creators/class_declaration.py pyplusplus_dev/pyplusplus/module_builder/builder.py Modified: pyplusplus_dev/pyplusplus/code_creators/class_declaration.py =================================================================== --- pyplusplus_dev/pyplusplus/code_creators/class_declaration.py 2006-06-20 13:34:35 UTC (rev 240) +++ pyplusplus_dev/pyplusplus/code_creators/class_declaration.py 2006-06-21 19:50:27 UTC (rev 241) @@ -27,7 +27,7 @@ def _generate_code_no_scope(self): result = [] - result.append( self._generate_class_definition() ) + result.append( self._generate_class_definition() + '("%s")' % self.declaration.alias ) for x in self.creators: code = x.create() tmpl = '%s.%s' @@ -47,7 +47,7 @@ typedef_name = self.class_var_name + '_t' result.append( 'typedef ' + self._generate_class_definition() + ' ' + typedef_name + ';') result.append( typedef_name + ' ' + self.class_var_name ) - result[-1] = result[-1] + ' = '+ typedef_name + '();' + result[-1] = result[-1] + ' = '+ typedef_name + '(%s);' % self.declaration.alias result.append( algorithm.create_identifier( self, '::boost::python::scope' ) ) result[-1] = result[-1] + ' ' + scope_var_name Modified: pyplusplus_dev/pyplusplus/module_builder/builder.py =================================================================== --- pyplusplus_dev/pyplusplus/module_builder/builder.py 2006-06-20 13:34:35 UTC (rev 240) +++ pyplusplus_dev/pyplusplus/module_builder/builder.py 2006-06-21 19:50:27 UTC (rev 241) @@ -472,3 +472,9 @@ , header_dir=header_dir , header_file=header_file , recursive=recursive ) + + def _get_BOOST_PYTHON_MAX_ARITY( self ): + return decl_wrappers.calldef_t.BOOST_PYTHON_MAX_ARITY + def _set_BOOST_PYTHON_MAX_ARITY( self, value ): + decl_wrappers.calldef_t.BOOST_PYTHON_MAX_ARITY = value + BOOST_PYTHON_MAX_ARITY = property( _get_BOOST_PYTHON_MAX_ARITY, _set_BOOST_PYTHON_MAX_ARITY ) \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-06-20 13:34:44
|
Revision: 240 Author: roman_yakovenko Date: 2006-06-20 06:34:35 -0700 (Tue, 20 Jun 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=240&view=rev Log Message: ----------- adding function name to the message Modified Paths: -------------- pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py Modified: pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py =================================================================== --- pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py 2006-06-20 13:33:45 UTC (rev 239) +++ pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py 2006-06-20 13:34:35 UTC (rev 240) @@ -100,10 +100,10 @@ def _exportable_impl( self ): #see http://www.boost.org/libs/python/doc/v2/faq.html#funcptr if len( self.arguments ) > calldef_t.BOOST_PYTHON_MAX_ARITY: - msg = "You have function with more then 10 arguments( %d ). " + msg = "Function '%s' with more then 10 arguments( %d ). " msg = msg + " You should adjest BOOST_PYTHON_MAX_ARITY" msg = msg + " For more information see: http://mail.python.org/pipermail/c++-sig/2002-June/001554.html" - _logging_.logger.info( msg % len( self.arguments ) ) + _logging_.logger.info( msg % ( self.decl_string, len( self.arguments ) ) ) all_types = [ arg.type for arg in self.arguments ] all_types.append( self.return_type ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-06-20 13:33:52
|
Revision: 239 Author: roman_yakovenko Date: 2006-06-20 06:33:45 -0700 (Tue, 20 Jun 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=239&view=rev Log Message: ----------- removing dead code Modified Paths: -------------- pyplusplus_dev/pyplusplus/module_creator/creator.py Modified: pyplusplus_dev/pyplusplus/module_creator/creator.py =================================================================== --- pyplusplus_dev/pyplusplus/module_creator/creator.py 2006-06-20 13:18:16 UTC (rev 238) +++ pyplusplus_dev/pyplusplus/module_creator/creator.py 2006-06-20 13:33:45 UTC (rev 239) @@ -404,9 +404,6 @@ return self.__extmodule def _create_includes(self): - for cls in self.__decls: - if not isinstance( cls, decl_wrappers.class_t ): - continue for fn in declarations.declaration_files( self.__decls ): include = code_creators.include_t( header=fn ) self.__extmodule.adopt_include(include) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-06-20 13:18:28
|
Revision: 238 Author: roman_yakovenko Date: 2006-06-20 06:18:16 -0700 (Tue, 20 Jun 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=238&view=rev Log Message: ----------- adding BOOST_PYTHON_MAX_ARITY Modified Paths: -------------- pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py Modified: pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py =================================================================== --- pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py 2006-06-20 12:48:20 UTC (rev 237) +++ pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py 2006-06-20 13:18:16 UTC (rev 238) @@ -14,7 +14,10 @@ ##return False ##return self.declaration.virtuality != declarations.VIRTUALITY_TYPES.PURE_VIRTUAL -class calldef_t(decl_wrapper.decl_wrapper_t): +class calldef_t(decl_wrapper.decl_wrapper_t): + + BOOST_PYTHON_MAX_ARITY = 10 + def __init__(self, *arguments, **keywords): decl_wrapper.decl_wrapper_t.__init__( self, *arguments, **keywords ) @@ -96,7 +99,7 @@ def _exportable_impl( self ): #see http://www.boost.org/libs/python/doc/v2/faq.html#funcptr - if len( self.arguments ) > 10: + if len( self.arguments ) > calldef_t.BOOST_PYTHON_MAX_ARITY: msg = "You have function with more then 10 arguments( %d ). " msg = msg + " You should adjest BOOST_PYTHON_MAX_ARITY" msg = msg + " For more information see: http://mail.python.org/pipermail/c++-sig/2002-June/001554.html" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-06-20 12:48:36
|
Revision: 237 Author: roman_yakovenko Date: 2006-06-20 05:48:20 -0700 (Tue, 20 Jun 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=237&view=rev Log Message: ----------- adding support to std::list Modified Paths: -------------- pygccxml_dev/pygccxml/declarations/__init__.py pygccxml_dev/pygccxml/declarations/container_traits.py pyplusplus_dev/pyplusplus/decl_wrappers/class_wrapper.py pyplusplus_dev/pyplusplus/decl_wrappers/indexing_suite.py pyplusplus_dev/pyplusplus/module_creator/types_database.py Modified: pygccxml_dev/pygccxml/declarations/__init__.py =================================================================== --- pygccxml_dev/pygccxml/declarations/__init__.py 2006-06-20 05:45:54 UTC (rev 236) +++ pygccxml_dev/pygccxml/declarations/__init__.py 2006-06-20 12:48:20 UTC (rev 237) @@ -151,6 +151,7 @@ from type_traits import smart_pointer_traits from container_traits import vector_traits +from container_traits import list_traits from container_traits import map_traits from container_traits import multimap_traits from container_traits import hash_map_traits Modified: pygccxml_dev/pygccxml/declarations/container_traits.py =================================================================== --- pygccxml_dev/pygccxml/declarations/container_traits.py 2006-06-20 05:45:54 UTC (rev 236) +++ pygccxml_dev/pygccxml/declarations/container_traits.py 2006-06-20 12:48:20 UTC (rev 237) @@ -82,6 +82,7 @@ return xxx_traits vector_traits = create_traits_class( 'vector', 0 ) +list_traits = create_traits_class( 'list', 0 ) map_traits = create_traits_class( 'map', 1 ) multimap_traits = create_traits_class( 'multimap', 1 ) hash_map_traits = create_traits_class( 'hash_map', 1 ) Modified: pyplusplus_dev/pyplusplus/decl_wrappers/class_wrapper.py =================================================================== --- pyplusplus_dev/pyplusplus/decl_wrappers/class_wrapper.py 2006-06-20 05:45:54 UTC (rev 236) +++ pyplusplus_dev/pyplusplus/decl_wrappers/class_wrapper.py 2006-06-20 12:48:20 UTC (rev 237) @@ -11,7 +11,8 @@ def guess_indexing_suite( class_ ): - if declarations.vector_traits.is_my_case( class_ ): + if declarations.vector_traits.is_my_case( class_ ) \ + or declarations.list_traits.is_my_case( class_ ): return container_suites.vector_suite_t( class_ ) if declarations.map_traits.is_my_case( class_ ) \ or declarations.hash_map_traits.is_my_case( class_ ): Modified: pyplusplus_dev/pyplusplus/decl_wrappers/indexing_suite.py =================================================================== --- pyplusplus_dev/pyplusplus/decl_wrappers/indexing_suite.py 2006-06-20 05:45:54 UTC (rev 236) +++ pyplusplus_dev/pyplusplus/decl_wrappers/indexing_suite.py 2006-06-20 12:48:20 UTC (rev 237) @@ -58,9 +58,12 @@ class vector_suite_t( indexing_suite_t ): def __init__( self, cls ): indexing_suite_t.__init__( self, cls ) + self.__traits = declarations.vector_traits + if declarations.list_traits.is_my_case( self.container_class ): + self.__traits = declarations.list_traits def value_type( self ): - return declarations.vector_traits.value_type( self.container_class ) + return self.__traits.value_type( self.container_class ) class map_suite_t( indexing_suite_t ): def __init__( self, cls ): Modified: pyplusplus_dev/pyplusplus/module_creator/types_database.py =================================================================== --- pyplusplus_dev/pyplusplus/module_creator/types_database.py 2006-06-20 05:45:54 UTC (rev 236) +++ pyplusplus_dev/pyplusplus/module_creator/types_database.py 2006-06-20 12:48:20 UTC (rev 237) @@ -60,7 +60,14 @@ vector = declarations.vector_traits.class_declaration( type ) declarations.vector_traits.value_type( vector ) self.__used_vectors.add( vector ) - return True + return True + #the patch I submitted should be accepted, before pyplusplus will generate + #the code + #~ if declarations.list_traits.is_my_case( type ): + #~ list_ = declarations.list_traits.class_declaration( type ) + #~ declarations.list_traits.value_type( list_ ) + #~ self.__used_vectors.add( list_ ) + #~ return True if declarations.map_traits.is_my_case( type ): map_ = declarations.map_traits.class_declaration( type ) declarations.map_traits.value_type( map_ ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-06-20 05:46:02
|
Revision: 236 Author: roman_yakovenko Date: 2006-06-19 22:45:54 -0700 (Mon, 19 Jun 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=236&view=rev Log Message: ----------- adding enum_declaration functionality Modified Paths: -------------- pygccxml_dev/pygccxml/declarations/__init__.py pygccxml_dev/pygccxml/declarations/type_traits.py Modified: pygccxml_dev/pygccxml/declarations/__init__.py =================================================================== --- pygccxml_dev/pygccxml/declarations/__init__.py 2006-06-20 05:15:25 UTC (rev 235) +++ pygccxml_dev/pygccxml/declarations/__init__.py 2006-06-20 05:45:54 UTC (rev 236) @@ -102,8 +102,11 @@ from type_traits import decompose_type from type_traits import decompose_class + +from type_traits import is_enum +from type_traits import enum_declaration + from type_traits import is_same -from type_traits import is_enum from type_traits import is_void from type_traits import is_void_pointer from type_traits import is_const @@ -143,6 +146,7 @@ from type_traits import has_trivial_constructor from type_traits import find_trivial_constructor from type_traits import has_any_non_copyconstructor + from type_traits import smart_pointer_traits Modified: pygccxml_dev/pygccxml/declarations/type_traits.py =================================================================== --- pygccxml_dev/pygccxml/declarations/type_traits.py 2006-06-20 05:15:25 UTC (rev 235) +++ pygccxml_dev/pygccxml/declarations/type_traits.py 2006-06-20 05:45:54 UTC (rev 236) @@ -263,12 +263,18 @@ def is_enum(type): """returns True if type represents C++ enum type""" nake_type = remove_alias( type ) - nake_type = remove_reference( nake_type ) nake_type = remove_cv( nake_type ) return isinstance( nake_type, cpptypes.declarated_t ) \ and isinstance( nake_type.declaration, enumeration.enumeration_t ) +def enum_declaration(type): + if not is_enum( type ): + raise TypeError( 'Type "%s" is not enumeration' % type.decl_string ) + nake_type = remove_alias( type ) + nake_type = remove_cv( nake_type ) + return remove_declarated( nake_type ) + def is_class(type): """returns True if type represents C++ class""" nake_type = remove_alias( type ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-06-20 05:15:35
|
Revision: 235 Author: roman_yakovenko Date: 2006-06-19 22:15:25 -0700 (Mon, 19 Jun 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=235&view=rev Log Message: ----------- small refactoring: constructor(wrapper) now derives from calldef.py( wrapper ) and not from declaration_based_t Modified Paths: -------------- pyplusplus_dev/pyplusplus/code_creators/calldef.py pyplusplus_dev/pyplusplus/module_creator/creator.py Modified: pyplusplus_dev/pyplusplus/code_creators/calldef.py =================================================================== --- pyplusplus_dev/pyplusplus/code_creators/calldef.py 2006-06-19 20:10:30 UTC (rev 234) +++ pyplusplus_dev/pyplusplus/code_creators/calldef.py 2006-06-20 05:15:25 UTC (rev 235) @@ -779,59 +779,13 @@ #return self.wclass_inst_arg_type().decl_string + ' wcls_inst' -class constructor_t( declaration_based.declaration_based_t ): +class constructor_t( calldef_t ): """ Creates boost.python code needed to expose constructor. """ def __init__(self, constructor, wrapper=None, parent=None ): - declaration_based.declaration_based_t.__init__( self - , declaration=constructor - , parent=parent ) - self._wrapper = wrapper + calldef_t.__init__( self, function=constructor, wrapper=wrapper, parent=parent ) - def _get_wrapper( self ): - return self._wrapper - def _set_wrapper( self, new_wrapper ): - self._wrapper = new_wrapper - wrapper = property( _get_wrapper, _set_wrapper ) - - def _get_call_policies(self): - return self.declaration.call_policies - def _set_call_policies(self, call_policies): - self.declaration.call_policies = call_policies - call_policies = property( _get_call_policies, _set_call_policies ) - - def _get_use_keywords(self): - return self.declaration.use_keywords - def _set_use_keywords(self, use_keywords): - self.declaration.use_keywords = use_keywords - use_keywords = property( _get_use_keywords, _set_use_keywords ) - - def _get_use_default_arguments(self): - return self.declaration.use_default_arguments - def _set_use_default_arguments(self, use_default_arguments): - self.declaration.use_default_arguments = use_default_arguments - use_default_arguments = property( _get_use_default_arguments, _set_use_default_arguments ) - - def _keywords_args(self): - if not self.declaration.arguments: - return '' - boost_arg = algorithm.create_identifier( self, '::boost::python::arg' ) - boost_obj = algorithm.create_identifier( self, '::boost::python::object' ) - result = ['( '] - for arg in self.declaration.arguments: - if 1 < len( result ): - result.append( ', ' ) - result.append( boost_arg ) - result.append( '("%s")' % arg.name ) - if self.use_default_arguments and arg.default_value: - if not declarations.is_pointer( arg.type ) or arg.default_value != '0': - result.append( '=%s' % arg.default_value ) - else: - result.append( '=%s()' % boost_obj ) - result.append( ' )' ) - return ''.join( result ) - def _create_arg_code( self, arg ): temp = arg.type if declarations.is_const( temp ): @@ -857,17 +811,16 @@ answer.append( optionals_str ) return ', '.join( answer ) - def create_init_code(self): init_identifier = algorithm.create_identifier( self, '::boost::python::init' ) args = [ self._generate_definition_args() ] answer = [ '%s' % declarations.templates.join( init_identifier, args ) ] - if self.use_keywords: - answer.append( '(%s)' % self._keywords_args() ) + if self.declaration.use_keywords: + answer.append( '(%s)' % self.keywords_args() ) else: answer.append( '()' ) - if self.call_policies: - answer.append('[%s]' % self.call_policies.create( self ) ) + if self.declaration.call_policies: + answer.append('[%s]' % self.declaration.call_policies.create( self ) ) #I think it better not to print next line #else: # answer.append( '/*[ undefined call policies ]*/' ) @@ -896,22 +849,13 @@ def _create_impl( self ): return 'staticmethod( "%s" )' % self.function_code_creator.alias -class constructor_wrapper_t( declaration_based.declaration_based_t ): +class constructor_wrapper_t( calldef_wrapper_t ): """ Creates C++ code that builds wrapper arround exposed constructor. """ def __init__( self, constructor, parent=None ): - declaration_based.declaration_based_t.__init__( self - , declaration=constructor - , parent=parent ) - - def argument_name( self, index ): - arg = self.declaration.arguments[ index ] - if arg.name: - return arg.name - else: - return 'p%d' % index + calldef_wrapper_t.__init__( self, function=constructor, parent=parent ) def _create_declaration(self): result = [] @@ -920,11 +864,9 @@ args = [] if self.parent.held_type and not self.target_configuration.boost_python_has_wrapper_held_type: args.append( 'PyObject*' ) - for index, arg in enumerate( self.declaration.arguments ): - arg_text = arg.type.decl_string + ' ' + self.argument_name(index) - if arg.default_value: - arg_text = arg_text + '=%s' % arg.default_value - args.append( arg_text ) + args_decl = self.args_declaration() + if args_decl: + args.append( args_decl ) result.append( ', '.join( args ) ) result.append( ' )' ) return ''.join( result ) Modified: pyplusplus_dev/pyplusplus/module_creator/creator.py =================================================================== --- pyplusplus_dev/pyplusplus/module_creator/creator.py 2006-06-19 20:10:30 UTC (rev 234) +++ pyplusplus_dev/pyplusplus/module_creator/creator.py 2006-06-20 05:15:25 UTC (rev 235) @@ -506,8 +506,8 @@ cwrapper = code_creators.constructor_wrapper_t( constructor=self.curr_decl ) class_wrapper.adopt_creator( cwrapper ) maker = code_creators.constructor_t( constructor=self.curr_decl, wrapper=cwrapper ) - if None is maker.call_policies: - maker.call_policies = self.__call_policies_resolver( self.curr_decl ) + if None is self.curr_decl.call_policies: + self.curr_decl.call_policies = self.__call_policies_resolver( self.curr_decl ) self.curr_code_creator.adopt_creator( maker ) def visit_destructor( self ): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-06-19 20:10:58
|
Revision: 234 Author: roman_yakovenko Date: 2006-06-19 13:10:30 -0700 (Mon, 19 Jun 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=234&view=rev Log Message: ----------- adding map_indexing_suite to generated code Modified Paths: -------------- pygccxml_dev/pygccxml/declarations/__init__.py pygccxml_dev/pygccxml/declarations/container_traits.py pygccxml_dev/unittests/data/core_cache.hpp pyplusplus_dev/examples/pyboost_dev/dev/date_time/generate_code.py pyplusplus_dev/examples/pyboost_dev/dev/date_time/include/date_time.pypp.xml pyplusplus_dev/pyplusplus/code_creators/__init__.py pyplusplus_dev/pyplusplus/code_creators/indexing_suites.py pyplusplus_dev/pyplusplus/decl_wrappers/class_wrapper.py pyplusplus_dev/pyplusplus/decl_wrappers/indexing_suite.py pyplusplus_dev/pyplusplus/module_creator/creator.py pyplusplus_dev/pyplusplus/module_creator/types_database.py Modified: pygccxml_dev/pygccxml/declarations/__init__.py =================================================================== --- pygccxml_dev/pygccxml/declarations/__init__.py 2006-06-19 14:31:22 UTC (rev 233) +++ pygccxml_dev/pygccxml/declarations/__init__.py 2006-06-19 20:10:30 UTC (rev 234) @@ -147,8 +147,11 @@ from type_traits import smart_pointer_traits from container_traits import vector_traits +from container_traits import map_traits +from container_traits import multimap_traits +from container_traits import hash_map_traits +from container_traits import hash_multimap_traits - import templates Modified: pygccxml_dev/pygccxml/declarations/container_traits.py =================================================================== --- pygccxml_dev/pygccxml/declarations/container_traits.py 2006-06-19 14:31:22 UTC (rev 233) +++ pygccxml_dev/pygccxml/declarations/container_traits.py 2006-06-19 20:10:30 UTC (rev 234) @@ -10,6 +10,7 @@ import calldef import cpptypes import namespace +import templates import class_declaration import type_traits Modified: pygccxml_dev/unittests/data/core_cache.hpp =================================================================== --- pygccxml_dev/unittests/data/core_cache.hpp 2006-06-19 14:31:22 UTC (rev 233) +++ pygccxml_dev/unittests/data/core_cache.hpp 2006-06-19 20:10:30 UTC (rev 234) @@ -22,4 +22,4 @@ #endif//__core_cache_hpp__ -//touch \ No newline at end of file +//touch//touch \ No newline at end of file Modified: pyplusplus_dev/examples/pyboost_dev/dev/date_time/generate_code.py =================================================================== --- pyplusplus_dev/examples/pyboost_dev/dev/date_time/generate_code.py 2006-06-19 14:31:22 UTC (rev 233) +++ pyplusplus_dev/examples/pyboost_dev/dev/date_time/generate_code.py 2006-06-19 20:10:30 UTC (rev 234) @@ -141,7 +141,7 @@ def beautify_code( self, mb ): def is_vector_of_strings( decl ): - if not declarations.vector_traits.is_vector( decl ): + if not declarations.vector_traits.is_my_case( decl ): return False return declarations.is_std_string( declarations.vector_traits.value_type(decl) ) Modified: pyplusplus_dev/examples/pyboost_dev/dev/date_time/include/date_time.pypp.xml =================================================================== --- pyplusplus_dev/examples/pyboost_dev/dev/date_time/include/date_time.pypp.xml 2006-06-19 14:31:22 UTC (rev 233) +++ pyplusplus_dev/examples/pyboost_dev/dev/date_time/include/date_time.pypp.xml 2006-06-19 20:10:30 UTC (rev 234) @@ -2,8 +2,8 @@ <GCC_XML cvs_revision="1.112"> <Namespace id="_1" name="::" members="_3 _4 _5 _6 _7 _8 _9 _10 _11 _12 _13 _14 _15 _16 _17 _18 _19 _20 _21 _22 _23 _24 _25 _26 _27 _28 _29 _30 _31 _32 _33 _34 _35 _36 _37 _38 _39 _40 _41 _42 _43 _44 _45 _46 _47 _48 _49 _50 _51 _52 _53 _54 _55 _56 _57 _58 _59 _60 _61 _62 _63 _64 _65 _66 _67 _68 _69 _70 _71 _72 _73 _74 _75 _76 _77 _78 _79 _80 _81 _82 _83 _84 _85 _86 _87 _88 _89 _90 _91 _92 _93 _94 _95 _96 _97 _98 _99 _100 _101 _102 _103 _104 _105 _106 _107 _108 _109 _110 _111 _112 _113 _114 _115 _116 _117 _118 _119 _120 _121 _122 _123 _124 _125 _126 _127 _128 _129 _130 _131 _132 _133 _134 _135 _136 _137 _138 _139 _140 _141 _142 _143 _144 _145 _146 _147 _148 _149 _150 _151 _152 _153 _154 _155 _156 _157 _158 _159 _160 _161 _162 _163 _164 _165 _166 _167 _168 _169 _170 _171 _172 _173 _174 _175 _176 _177 _178 _179 _180 _181 _182 _183 _184 _185 _186 _187 _188 _189 _190 _191 _192 _193 _194 _195 _196 _197 _198 _199 _200 _201 _202 _203 _204 _205 _206 _207 _208 _209 _210 _211 _212 _213 _214 _215 _216 _217 _218 _219 _220 _221 _222 _223 _224 _225 _226 _227 _228 _229 _230 _231 _232 _233 _234 _235 _236 _237 _238 _239 _240 _241 _242 _243 _244 _245 _246 _247 _248 _249 _250 _251 _252 _253 _254 _255 _256 _257 _258 _259 _260 _261 _262 _263 _264 _265 _266 _267 _268 _269 _270 _271 _272 _273 _274 _275 _276 _277 _278 _279 _280 _281 _282 _283 _284 _285 _286 _287 _288 _289 _290 _291 _292 _293 _294 _295 _296 _297 _298 _299 _300 _301 _302 _303 _304 _305 _306 _307 _308 _309 _310 _311 _312 _313 _314 _315 _316 _317 _318 _319 _320 _321 _322 _323 _324 _325 _326 _327 _328 _329 _330 _331 _332 _333 _334 _335 _336 _337 _338 _339 _340 _341 _342 _343 _344 _345 _346 _347 _348 _349 _350 _351 _352 _353 _354 _355 _356 _357 _358 _359 _360 _361 _362 _363 _364 _365 _366 _367 _368 _369 _370 _371 _372 _373 _374 _375 _376 _377 _378 _379 _380 _381 _382 _383 _384 _385 _386 _387 _388 _389 _390 _391 _392 _393 _394 _395 _396 _397 _398 _399 _400 _401 _402 _403 _404 _405 _406 _407 _408 _409 _410 _411 _412 _413 _414 _415 _416 _417 _418 _419 _420 _421 _422 _423 _424 _425 _426 _427 _428 _429 _430 _431 _432 _433 _434 _435 _436 _437 _438 _439 _440 _441 _442 _443 _444 _445 _446 _447 _448 _449 _450 _451 _452 _453 _454 _455 _456 _457 _458 _459 _460 _461 _462 _463 _464 _465 _466 _467 _468 _469 _470 _471 _472 _473 _474 _475 _476 _477 _478 _479 _480 _482 _483 _484 _485 _486 _487 _488 _489 _490 _491 _492 _493 _494 _495 _496 _497 _498 _499 _501 _502 _503 _504 _505 _506 _508 _509 _510 _511 _512 _513 _514 _515 _516 _517 _518 _519 _520 _521 _522 _523 _524 _525 _526 _527 _528 _529 _530 _531 _532 _533 _534 _535 _536 _537 _538 _539 _540 _541 _542 _543 _544 _545 _546 _547 _548 _549 _550 _551 _552 _553 _554 _555 _556 _557 _558 _559 _560 _561 _562 _563 _564 _565 _566 _567 _568 _569 _570 _571 _572 _573 _574 _575 _576 _577 _578 _579 _580 _581 _582 _583 _584 _585 _586 _587 _588 _589 _590 _591 _592 _593 _594 _595 _596 _597 _598 _599 _600 _601 _602 _603 _604 _605 _606 _607 _608 _609 _610 _611 _612 _613 _614 _615 _616 _617 _618 _619 _621 _622 _623 _624 _625 _626 _627 _628 _629 _630 _631 _632 _633 _634 _635 _636 _638 _639 _640 _641 _642 _643 _644 _645 _646 _647 _648 _649 _650 _651 _652 _653 _654 _655 _656 _657 _658 _659 _660 _661 _662 _663 _664 _665 _666 _667 _668 _669 _670 _671 _672 _673 _674 _675 _676 _677 _678 _679 _680 _681 _682 _683 _684 _685 _686 _687 _688 _689 _690 _691 _692 _693 _694 _695 _696 _697 _698 _699 _700 _701 _702 _703 _704 _705 _706 _707 _708 _709 _710 _711 _712 _713 _714 _715 _716 _717 _718 _719 _720 _721 _722 _723 _724 _725 _726 _727 _728 _729 _730 _731 _732 _733 _734 _735 _736 _737 _738 _739 _740 _741 _742 _743 _744 _745 _746 _747 _748 _749 _750 _751 _752 _753 _754 _755 _756 _757 _758 _759 _760 _761 _762 _763 _764 _766 _767 _768 _769 _770 _771 _772 _773 _774 _775 _776 _777 _778 _779 _780 _781 _782 _783 _784 _785 _786 _787 _788 _789 _790 _791 _792 _793 _794 _795 _796 _797 _798 _799 _800 _801 _802 _803 _804 _805 _806 _807 _808 _809 _810 _811 _812 _813 _814 _815 _816 _817 _819 _820 _821 _823 _824 _825 _826 _827 _828 _829 _830 _831 _832 _833 _834 _835 _836 _837 _838 _839 _840 _841 _842 _843 _844 _845 _846 _847 _848 _849 _850 _851 _852 _853 _854 _855 _856 _857 _858 _859 _860 _861 _862 _863 _864 _865 _866 _867 _868 _869 _870 _871 _872 _873 _874 _875 _876 _877 _878 _879 _880 _881 _882 _883 _884 _885 _886 _887 _888 _889 _890 _891 _892 _893 _894 _895 _896 _897 _898 _899 _900 _901 _902 _903 _904 _905 _906 _907 _908 _909 _910 _911 _912 _913 _914 _915 _916 _917 _918 _919 _920 _921 _922 _923 _924 _925 _926 _927 _928 _929 _930 _931 _932 _933 _934 _935 _936 _937 _938 _939 _940 _941 _942 _943 _944 _945 _946 _947 _948 _949 _950 _951 _952 _953 _954 _955 _956 _957 _958 _959 _960 _961 _962 _963 _964 _965 _966 _967 _968 _969 _970 _971 _972 _973 _974 _975 _976 _977 _978 _979 _980 _981 _982 _983 _984 _985 _986 _987 _988 _989 _990 _991 _992 _993 _994 _995 _996 _997 _998 _999 _1000 _1001 _1002 _1003 _1005 _1006 _1007 _1008 _1009 _1010 _1011 _1012 _1013 _1014 _1015 _1016 _1017 _1018 _1019 _1020 _1021 _1022 _1023 _1024 _1025 _1026 _1027 _1028 _1029 _1030 _1031 _1032 _1033 _1034 _1035 _1036 _1037 _1038 _1039 _1040 _1041 _1042 _1043 _1044 _1045 _1046 _1047 _1048 _1049 _1050 _1051 _1052 _1053 _1054 _1055 _1056 _1057 _1058 _1059 _1060 _1061 _1062 _1063 _1064 _1065 _1066 _1067 _1068 _1069 _1070 _1071 _1072 _1073 _1074 _1075 _1076 _1077 _1078 _1079 _1080 _1081 _1082 _1083 _1084 _1085 _1086 _1087 _1088 _1089 _1090 _1091 _1092 _1093 _1094 _1095 _1096 _1097 _1098 _1099 _1100 _1101 _1102 _1103 _1104 _1106 _1108 _1110 _1111 _1112 _1113 _1114 _1115 _1116 _1117 _1118 _1119 _1120 _1121 _1122 _1123 _1124 _1125 _1126 _1127 _1128 _1129 _1130 _1131 _1132 _1133 _1135 _1134 _1137 _1139 _1141 _1143 _1144 _1145 _1146 _1147 _1148 _1149 _1150 _1151 _1152 _1153 _1155 _1156 _1157 _1158 _1160 _1161 _1163 _1164 _1166 _1167 _1169 _1171 _1173 _1175 _1177 _1179 _1181 _1183 _1185 _1186 _1187 _1188 _1189 _1190 _1191 _1105 _1107 _765 _1192 _1194 _1195 _1193 _1196 _1197 _1198 _1199 _1200 _1201 _1202 _1203 _1204 _1205 _1206 _1207 _1208 _1209 _1210 _1211 _1212 _1213 _1214 _1215 _1216 _1217 _1218 _1219 _1220 _1221 _1222 _1223 _1224 _1225 _1226 _1227 _1228 _1229 _1230 _1231 _1232 _1233 _1234 _1235 _1236 _1237 _1238 _1239 _1241 _1242 _1243 _1244 _1245 _1247 _1249 _1250 _1251 _1252 _1253 _1255 _1256 _1257 _1258 _1260 _1261 _1262 _1263 _1264 _1265 _1266 _1267 _1268 _1269 _1270 _1271 _1272 _1273 _1274 _1275 _1276 _1277 _1278 _1279 _1280 _1281 _1282 _1283 _1284 _1285 _1286 _1287 _1288 _1289 _1290 _1291 _1292 _1293 _1294 _1295 _1296 _1297 _1298 _1299 _1300 _1301 _1302 _1303 _1304 _1305 _1306 _1307 _1308 _1309 _1310 _1311 _1312 _1313 _1314 _1315 _1316 _1317 _1318 _1319 _1320 _1321 _1322 _1323 _1324 _1325 _1326 _1327 _1328 _1329 _1330 _1331 _1332 _1333 _1334 _1335 _1336 _1337 _1338 _1339 _1340 _1341 _1342 _1343 _1344 _1345 _1346 _1347 _1348 _1349 _1350 _1351 _1352 _1353 _1354 _1355 _1356 _1357 _1358 _1359 _1360 _1361 _1362 _1363 _1364 _1365 _1366 _1367 _1368 _1369 _1370 _1371 _1372 _1373 _1374 _1375 _1376 _1377 _1378 _1379 _1380 _1381 _1382 _1383 _1384 _1385 _1386 _1387 _1388 _1389 _1390 _1391 _1392 _1393 _1394 _1395 _1396 _1397 _1398 _1399 _1400 _1401 _1402 _1403 _1404 _1405 _1406 _1407 _1408 _1409 _1410 _1411 _1412 _1413 _1414 _1415 _1416 _1417 _1418 _1419 _1420 _1421 _1422 _1423 _1424 _1425 _1426 _1427 _1428 _1430 _1431 _1432 _1433 _1434 _1435 _1436 _1437 _1438 _1439 _1440 _1441 _1442 _1443 _1444 _1445 _1446 _1447 _1448 _1449 _1450 _1451 _1452 _1453 _1454 _1455 _1456 _1457 _1458 _1459 _1460 _1461 _1462 _1463 _1464 _1465 _1466 _1467 _1468 _1469 _1470 _1471 _1472 _1473 _1474 _1475 _1476 _1477 _1478 _1479 _1480 _1481 _1482 _1483 _1484 _1485 _1486 _1487 _1488 _1489 _1491 _1490 _1492 _1493 _818 _1494 _1495 _1496 _1497 _1499 _1498 _1501 _1502 _1503 _1504 _1505 _1506 _1507 _1508 _1509 _1510 _1512 _1513 _1514 _1515 _1516 _1517 _1518 _1519 _1520 _1521 _1522 _1523 _1525 _1524 _1526 _1527 _1528 _1529 _1530 _1531 _1532 _1533 _1534 _1535 _1536 _1537 _1538 _1539 _1540 _1541 _1542 _1543 _1544 _1545 _1546 _1547 _1548 _1549 _1550 _1551 _1552 _1553 _1554 _1555 _1556 _1557 _1558 _1559 _1560 _1562 _1563 _1564 _1565 _1566 _1567 _1568 _1569 _1570 _1571 _1573 _1574 _1575 _1576 _1577 _1578 _1579 _1580 _1581 _1582 _1583 _1584 _1585 _1586 _1587 _1588 _1589 _1590 _1591 _1592 _1593 _1594 _1561 _1595 _1596 _1597 _1598 _1599 _1600 _1601 _1602 _1603 _1604 _1605 _1606 _1607 _1608 _1609 _1610 _1611 _1612 _1613 _1614 _1615 _1616 _1617 _1618 _1619 _1620 _1621 _1622 _1623 _1624 _1625 _1626 _1627 _1628 _1629 _1630 _1631 _1632 _1633 _1634 _1635 _1636 _1637 _1638 _1639 _1640 _1641 _1642 _1643 _1644 _1645 _1646 _1647 _1648 _1649 _1650 _1651 _1652 _1653 _1654 _1655 _1656 _1657 _1658 _1659 _1660 _1661 _1662 _1663 _1664 _1665 _1666 _1667 _1668 _1669 _1670 _1671 _1672 _1673 _1674 _1675 _1676 _1677 _1678 _1679 _1680 _1681 _1682 _1683 _1684 _1685 _1686 _1687 _1688 _1689 _1690 _1691 _1692 _1693 _1694 _1695 _1696 _1697 _1698 _1699 _1700 _1701 _1702 _1703 _1704 _1705 _1706 _1707 _1708 _1709 _1710 _1711 _1712 _1713 _1714 _1715 _1716 _1717 _1718 _1719 _1720 _1721 _1722 _1723 _1724 _1725 _1726 _1727 _1728 _1729 _1730 _1731 _1732 _1733 _1734 _1735 _1736 _1737 _1738 _1739 _1740 _1741 _1742 _1743 _1744 _1745 _1746 _1747 _1748 _1749 _1750 _1751 _1752 _1753 _1754 _1755 _1756 _1757 _1758 _1759 _1760 _1761 _1762 _1763 _1764 _1765 _1766 _1767 _1768 _1769 _1770 _1771 _1772 _1773 _1774 _1775 _1776 _1777 _1778 _1779 _1780 _1781 _1782 _1783 _1784 _1785 _1786 _1787 _1788 _1789 _1790 _1791 _1792 _1793 _1794 _1795 _1796 _1797 _1798 _1799 _1800 _1801 _1802 _1803 _1804 _1805 _1806 _1807 _1808 _1809 _1810 _1811 _1812 _1813 _1814 _1815 _1816 _1817 _1818 _1819 _1820 _1821 _1822 _1823 _1824 _1825 _1826 _1827 _1828 _1829 _1830 _1831 _1832 _1833 _1834 _1835 _1836 _1837 _1838 _1839 _1840 _1841 _1842 _1843 _1844 _1845 _1846 _1847 _1848 _1849 _1850 " mangled="_Z2::" demangled="::"/> <Namespace id="_2" name="std" context="_1" members="_1852 _1853 _1854 _1855 _1856 _1857 _1858 _1859 _1860 _1861 _1862 _1863 _1864 _1865 _1866 _1867 _1868 _1869 _1870 _1871 _1872 _1873 _1874 _1875 _1876 _1877 _1878 _1879 _1880 _1881 _1882 _1883 _1884 _1885 _1886 _1887 _1888 _1889 _1890 _1891 _1892 _1893 _1894 _1895 _1896 _1897 _1898 _1899 _1900 _1901 _1906 _1907 _1912 _1913 _1926 _1927 _1932 _1933 _1938 _1939 _1940 _1941 _1942 _1943 _1944 _1945 _1946 _1947 _1948 _1962 _1963 _1964 _1965 _1966 _1967 _1968 _1969 _1970 _1971 _1974 _1979 _1980 _1981 _1982 _1987 _1988 _1989 _1990 _1993 _1994 _1995 _1996 _1997 _1998 _1999 _2000 _2001 _2002 _2003 _2012 _2013 _2014 _2045 _2054 _2055 _2056 _2057 _2058 _2059 _2060 _2061 _2062 _2063 _2064 _2065 _2066 _2067 _2068 _2069 _2070 _2071 _2072 _2073 _2074 _2075 _2076 _2077 _2078 _2079 _2080 _2081 _2082 _2083 _2084 _2085 _2086 _2087 _2088 _2089 _2090 _2091 _2092 _2093 _2094 _2095 _2096 _2097 _2098 _2099 _2100 _2106 _2107 _2148 _2149 _2150 _2168 _2169 _2209 _2211 _2212 _2213 _2274 _2287 _2296 _2313 _2314 _2319 _2321 _2322 _2323 _2330 _2331 _2332 _2455 _2456 _2457 _2458 _2459 _2460 _2461 _2462 _2463 _2465 _2467 _2469 _2471 _2473 _2475 _2477 _2479 _2481 _2483 _2485 _2487 _2489 _2491 _2493 _2495 _2497 _2499 _2501 _2503 _2505 _2507 _2509 _2511 _2513 _2515 _2516 _2521 _2522 _2523 _2524 _2525 _2526 _2527 _2528 _2529 _2530 _2531 _2532 _2533 _2534 _2536 _2537 _2538 _2539 _2540 _2541 _2542 _2543 _2544 _2546 _2548 _2567 _2568 _2569 _2570 _2571 _2572 _2573 _2574 _2575 _2638 _2639 _2640 _2641 _2642 _2643 _2644 _2653 _2654 _2655 " mangled="_Z3std" demangled="std"/> - <Function id="_3" name="_GLOBAL__D__home_roman_pygccxml_sources_sources_pyplusplus_dev_examples_pyboost_dev_dev_date_time_include_date_time.pypp.hpp5J35cd" returns="_1154" context="_1" location="f0:131" file="f0" line="131" endline="131"/> - <Function id="_4" name="_GLOBAL__I__home_roman_pygccxml_sources_sources_pyplusplus_dev_examples_pyboost_dev_dev_date_time_include_date_time.pypp.hpp5J35cd" returns="_1154" context="_1" location="f0:131" file="f0" line="131" endline="131"/> + <Function id="_3" name="_GLOBAL__D__home_roman_pygccxml_sources_sources_pyplusplus_dev_examples_pyboost_dev_dev_date_time_include_date_time.pypp.hppEAQ8Wa" returns="_1154" context="_1" location="f0:131" file="f0" line="131" endline="131"/> + <Function id="_4" name="_GLOBAL__I__home_roman_pygccxml_sources_sources_pyplusplus_dev_examples_pyboost_dev_dev_date_time_include_date_time.pypp.hppEAQ8Wa" returns="_1154" context="_1" location="f0:131" file="f0" line="131" endline="131"/> <Variable id="_5" name="_ZGVN5boost9date_time10date_facetINS_9gregorian4dateEcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE2idE" type="_1248" context="_1" location="f1:372" file="f1" line="372" artificial="1"/> <Function id="_6" name="__static_initialization_and_destruction_0" returns="_1154" context="_1" mangled="_Z41__static_initialization_and_destruction_0ii" demangled="__static_initialization_and_destruction_0(int, int)" location="f0:131" file="f0" line="131" endline="76"> <Argument name="__initialize_p" type="_500" location="f0:131" file="f0" line="131"/> Modified: pyplusplus_dev/pyplusplus/code_creators/__init__.py =================================================================== --- pyplusplus_dev/pyplusplus/code_creators/__init__.py 2006-06-19 14:31:22 UTC (rev 233) +++ pyplusplus_dev/pyplusplus/code_creators/__init__.py 2006-06-19 20:10:30 UTC (rev 234) @@ -106,4 +106,5 @@ from array_1_registrator import array_1_registrator_t -from indexing_suites import vector_indexing_suite_t \ No newline at end of file +from indexing_suites import vector_indexing_suite_t +from indexing_suites import map_indexing_suite_t \ No newline at end of file Modified: pyplusplus_dev/pyplusplus/code_creators/indexing_suites.py =================================================================== --- pyplusplus_dev/pyplusplus/code_creators/indexing_suites.py 2006-06-19 14:31:22 UTC (rev 233) +++ pyplusplus_dev/pyplusplus/code_creators/indexing_suites.py 2006-06-19 20:10:30 UTC (rev 234) @@ -10,8 +10,9 @@ from pygccxml import declarations class indexing_suite_t( code_creator.code_creator_t ): - def __init__(self, parent=None ): + def __init__(self, suite_name, parent=None ): code_creator.code_creator_t.__init__( self, parent=parent ) + self.__suite_name = suite_name def _get_configuration( self ): return self.parent.declaration.indexing_suite @@ -20,20 +21,9 @@ def _get_container( self ): return self.parent.declaration container = property( _get_container ) - -class vector_indexing_suite_t( indexing_suite_t ): - """ - Creates boost.python code that needed to export a vector of some class - """ - #class_< std::vector<X> >("XVec") - # .def(vector_indexing_suite<std::vector<X> >()) - #; - def __init__(self, parent=None ): - indexing_suite_t.__init__( self, parent=parent ) - - def _create_indexing_suite_declaration( self ): - vector_indexing_suite = algorithm.create_identifier( self, 'boost::python::vector_indexing_suite' ) + def _create_suite_declaration( self ): + suite_identifier = algorithm.create_identifier( self, self.__suite_name ) args = [ self.container.decl_string ] if self.configuration.derived_policies: if self.configuration.no_proxy: @@ -44,9 +34,31 @@ else: if self.configuration.no_proxy: args.append( 'true' ) - return declarations.templates.join( vector_indexing_suite, args ) + return declarations.templates.join( suite_identifier, args ) def _create_impl(self): - return "def( %s() )" % self._create_indexing_suite_declaration() + return "def( %s() )" % self._create_suite_declaration() - \ No newline at end of file +class vector_indexing_suite_t( indexing_suite_t ): + """ + Creates boost.python code that needed to export a vector of some class + """ + #class_< std::vector<X> >("XVec") + # .def(vector_indexing_suite<std::vector<X> >()) + #; + + def __init__(self, parent=None ): + indexing_suite_t.__init__( self, 'boost::python::vector_indexing_suite', parent=parent ) + +class map_indexing_suite_t( indexing_suite_t ): + """ + Creates boost.python code that needed to export a vector of some class + """ + #class_< std::vector<X> >("XVec") + # .def(vector_indexing_suite<std::vector<X> >()) + #; + + def __init__(self, parent=None ): + indexing_suite_t.__init__( self, 'boost::python::map_indexing_suite', parent=parent ) + + \ No newline at end of file Modified: pyplusplus_dev/pyplusplus/decl_wrappers/class_wrapper.py =================================================================== --- pyplusplus_dev/pyplusplus/decl_wrappers/class_wrapper.py 2006-06-19 14:31:22 UTC (rev 233) +++ pyplusplus_dev/pyplusplus/decl_wrappers/class_wrapper.py 2006-06-19 20:10:30 UTC (rev 234) @@ -13,6 +13,9 @@ def guess_indexing_suite( class_ ): if declarations.vector_traits.is_my_case( class_ ): return container_suites.vector_suite_t( class_ ) + if declarations.map_traits.is_my_case( class_ ) \ + or declarations.hash_map_traits.is_my_case( class_ ): + return container_suites.map_suite_t( class_ ) #this will only be exported if indexing suite is not None and only when needed class class_declaration_t(decl_wrapper.decl_wrapper_t, declarations.class_declaration_t): Modified: pyplusplus_dev/pyplusplus/decl_wrappers/indexing_suite.py =================================================================== --- pyplusplus_dev/pyplusplus/decl_wrappers/indexing_suite.py 2006-06-19 14:31:22 UTC (rev 233) +++ pyplusplus_dev/pyplusplus/decl_wrappers/indexing_suite.py 2006-06-19 20:10:30 UTC (rev 234) @@ -61,3 +61,13 @@ def value_type( self ): return declarations.vector_traits.value_type( self.container_class ) + +class map_suite_t( indexing_suite_t ): + def __init__( self, cls ): + indexing_suite_t.__init__( self, cls ) + self.__traits = declarations.map_traits + if declarations.hash_map_traits.is_my_case( self.container_class ): + self.__traits = declarations.hash_map_traits + + def value_type( self ): + return self.__traits.value_type( self.container_class ) Modified: pyplusplus_dev/pyplusplus/module_creator/creator.py =================================================================== --- pyplusplus_dev/pyplusplus/module_creator/creator.py 2006-06-19 14:31:22 UTC (rev 233) +++ pyplusplus_dev/pyplusplus/module_creator/creator.py 2006-06-19 20:10:30 UTC (rev 234) @@ -353,19 +353,29 @@ pass def _treat_indexing_suite( self ): + def create_cls_cc( cls ): + if isinstance( cls, declarations.class_t ): + return code_creators.class_t( class_inst=cls ) + else: + return code_creators.class_declaration_t( class_inst=cls ) + if self.__types_db.used_vectors: header = "boost/python/suite/indexing/vector_indexing_suite.hpp" self.__extmodule.add_system_header( header ) self.__extmodule.add_include( header=header ) for cls in self.__types_db.used_vectors: - cls_creator = None - if isinstance( cls, declarations.class_t ): - cls_creator = code_creators.class_t( class_inst=cls ) - else: - cls_creator = code_creators.class_declaration_t( class_inst=cls ) + cls_creator = create_cls_cc( cls ) cls_creator.adopt_creator( code_creators.vector_indexing_suite_t() ) self.__module_body.adopt_creator( cls_creator ) - + if self.__types_db.used_maps: + header = "boost/python/suite/indexing/map_indexing_suite.hpp" + self.__extmodule.add_system_header( header ) + self.__extmodule.add_include( header=header ) + for cls in self.__types_db.used_maps: + cls_creator = create_cls_cc( cls ) + cls_creator.adopt_creator( code_creators.map_indexing_suite_t() ) + self.__module_body.adopt_creator( cls_creator ) + def create(self, decl_headers=None): """Create and return the module for the extension. Modified: pyplusplus_dev/pyplusplus/module_creator/types_database.py =================================================================== --- pyplusplus_dev/pyplusplus/module_creator/types_database.py 2006-06-19 14:31:22 UTC (rev 233) +++ pyplusplus_dev/pyplusplus/module_creator/types_database.py 2006-06-19 20:10:30 UTC (rev 234) @@ -19,6 +19,7 @@ self.__fundamental_strs = declarations.FUNDAMENTAL_TYPES.keys() self.__normalize_data = [ ',', '<', '>', '*', '&', '(', ')', '::' ] self.__used_vectors = set() + self.__used_maps = set() def update( self, decl ): if isinstance( decl, declarations.calldef_t ): @@ -54,18 +55,28 @@ type = declarations.remove_alias( type ) type = declarations.remove_pointer( type ) type = declarations.remove_reference( type ) - if declarations.vector_traits.is_my_case( type ): - vector = declarations.vector_traits.class_declaration( type ) - try: + try: + if declarations.vector_traits.is_my_case( type ): + vector = declarations.vector_traits.class_declaration( type ) declarations.vector_traits.value_type( vector ) self.__used_vectors.add( vector ) return True - except RuntimeError, error: - msg = 'WARNING: pyplusplus found std::vector instantiation declaration, ' - msg = msg + 'but can not find out value type!' - msg = msg + os.linesep + 'This class will not be exported!' - msg = msg + os.linesep + 'std::vector instantiation is: ' + vector.decl_string - _logging_.logger.warn( msg ) + if declarations.map_traits.is_my_case( type ): + map_ = declarations.map_traits.class_declaration( type ) + declarations.map_traits.value_type( map_ ) + self.__used_maps.add( map_ ) + return True + if declarations.hash_map_traits.is_my_case( type ): + map_ = declarations.hash_map_traits.class_declaration( type ) + declarations.hash_map_traits.value_type( map_ ) + self.__used_maps.add( map_ ) + return True + except RuntimeError, error: + msg = 'WARNING: pyplusplus found std::vector instantiation declaration, ' + msg = msg + 'but can not find out value type!' + msg = msg + os.linesep + 'This class will not be exported!' + msg = msg + os.linesep + 'std::vector instantiation is: ' + vector.decl_string + _logging_.logger.warn( msg ) return False def _update_db( self, db, type_ ): @@ -166,3 +177,6 @@ return self.__used_vectors used_vectors = property( _get_used_vectors ) + def _get_used_maps( self ): + return self.__used_maps + used_maps = property( _get_used_maps ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-06-19 14:31:48
|
Revision: 233 Author: roman_yakovenko Date: 2006-06-19 07:31:22 -0700 (Mon, 19 Jun 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=233&view=rev Log Message: ----------- big refactoring to container traits to make it easy to add another container Modified Paths: -------------- pygccxml_dev/pygccxml/declarations/container_traits.py pygccxml_dev/unittests/vector_traits_tester.py pyplusplus_dev/pyplusplus/decl_wrappers/class_wrapper.py pyplusplus_dev/pyplusplus/module_creator/types_database.py pyplusplus_dev/unittests/indexing_suites_tester.py Modified: pygccxml_dev/pygccxml/declarations/container_traits.py =================================================================== --- pygccxml_dev/pygccxml/declarations/container_traits.py 2006-06-19 13:24:30 UTC (rev 232) +++ pygccxml_dev/pygccxml/declarations/container_traits.py 2006-06-19 14:31:22 UTC (rev 233) @@ -12,10 +12,13 @@ import namespace import class_declaration import type_traits + +class container_traits_impl_t: + def __init__( self, container_name, value_type_index ): + self.name = container_name + self.value_type_index = value_type_index -class impl_details: - @staticmethod - def get_container_or_none( type, container_name ): + def get_container_or_none( self, type ): """returns reference to the class declaration or None""" type = type_traits.remove_alias( type ) type = type_traits.remove_cv( type ) @@ -30,40 +33,55 @@ else: return - if not cls.name.startswith( container_name + '<' ): + if not cls.name.startswith( self.name + '<' ): return if not type_traits.impl_details.is_defined_in_xxx( 'std', cls ): return return cls - -class vector_traits: - CONTAINER_NAME = 'vector' - - @staticmethod - def is_vector( type ): - """ - Returns True if type represents instantiation of std class vector, otherwise False.""" - return not( None is impl_details.get_container_or_none( type, vector_traits.CONTAINER_NAME ) ) - - @staticmethod - def class_declaration( type ): - """returns reference to the class declaration, """ - cls = impl_details.get_container_or_none( type, vector_traits.CONTAINER_NAME ) - if not cls: - raise TypeError( 'Type "%s" is not instantiation of std::vector' % type.decl_string ) - return cls - - @staticmethod - def value_type( type ): - """returns reference to value_type of the vector""" - cls = vector_traits.class_declaration( type ) - if isinstance( cls, class_declaration.class_t ): - return type_traits.remove_declarated( cls.typedef( "value_type", recursive=False ).type ) - else: - value_type_str = templates.args( cls.name )[0] + + def is_my_case( self, type ): + return bool( self.get_container_or_none( type ) ) + + def class_declaration( self, type ): + cls = self.get_container_or_none( type ) + if not cls: + raise TypeError( 'Type "%s" is not instantiation of std::%s' % ( type.decl_string, self.name ) ) + return cls + + def value_type( self, type ): + cls = self.class_declaration( type ) + if isinstance( cls, class_declaration.class_t ): + value_type = cls.typedef( "value_type", recursive=False ).type + return type_traits.remove_declarated( value_type ) + else: + value_type_str = templates.args( cls.name )[self.value_type_index] ref = type_traits.impl_details.find_value_type( cls.top_parent, value_type_str ) - if None is ref: - raise RuntimeError( "Unable to find out vector value type. vector class is: %s" % cls.decl_string ) - return ref + if None is ref: + raise RuntimeError( "Unable to find out %s '%s' value type." + % ( self.name, cls.decl_string ) ) + return ref +def create_traits_class( container_name, value_type_index ): + class xxx_traits: + impl = container_traits_impl_t( container_name, value_type_index ) + + @staticmethod + def is_my_case( type ): + return xxx_traits.impl.is_my_case( type ) + + @staticmethod + def class_declaration( type ): + return xxx_traits.impl.class_declaration( type ) + + @staticmethod + def value_type( type ): + return xxx_traits.impl.value_type( type ) + + return xxx_traits + +vector_traits = create_traits_class( 'vector', 0 ) +map_traits = create_traits_class( 'map', 1 ) +multimap_traits = create_traits_class( 'multimap', 1 ) +hash_map_traits = create_traits_class( 'hash_map', 1 ) +hash_multimap_traits = create_traits_class( 'hash_multimap', 1 ) \ No newline at end of file Modified: pygccxml_dev/unittests/vector_traits_tester.py =================================================================== --- pygccxml_dev/unittests/vector_traits_tester.py 2006-06-19 13:24:30 UTC (rev 232) +++ pygccxml_dev/unittests/vector_traits_tester.py 2006-06-19 14:31:22 UTC (rev 233) @@ -27,7 +27,7 @@ def validate_yes( self, value_type, container ): traits = declarations.vector_traits - self.failUnless( traits.is_vector( container ) ) + self.failUnless( traits.is_my_case( container ) ) self.failUnless( declarations.is_same( value_type, traits.value_type( container ) ) ) def test_global_ns( self ): @@ -53,7 +53,7 @@ continue if not struct.name.endswith( '_' ): continue - self.failUnless( not traits.is_vector( struct.typedef( 'container' ) ) ) + self.failUnless( not traits.is_my_case( struct.typedef( 'container' ) ) ) def create_suite(): suite = unittest.TestSuite() Modified: pyplusplus_dev/pyplusplus/decl_wrappers/class_wrapper.py =================================================================== --- pyplusplus_dev/pyplusplus/decl_wrappers/class_wrapper.py 2006-06-19 13:24:30 UTC (rev 232) +++ pyplusplus_dev/pyplusplus/decl_wrappers/class_wrapper.py 2006-06-19 14:31:22 UTC (rev 233) @@ -11,7 +11,7 @@ def guess_indexing_suite( class_ ): - if declarations.vector_traits.is_vector( class_ ): + if declarations.vector_traits.is_my_case( class_ ): return container_suites.vector_suite_t( class_ ) #this will only be exported if indexing suite is not None and only when needed Modified: pyplusplus_dev/pyplusplus/module_creator/types_database.py =================================================================== --- pyplusplus_dev/pyplusplus/module_creator/types_database.py 2006-06-19 13:24:30 UTC (rev 232) +++ pyplusplus_dev/pyplusplus/module_creator/types_database.py 2006-06-19 14:31:22 UTC (rev 233) @@ -54,7 +54,7 @@ type = declarations.remove_alias( type ) type = declarations.remove_pointer( type ) type = declarations.remove_reference( type ) - if declarations.vector_traits.is_vector( type ): + if declarations.vector_traits.is_my_case( type ): vector = declarations.vector_traits.class_declaration( type ) try: declarations.vector_traits.value_type( vector ) Modified: pyplusplus_dev/unittests/indexing_suites_tester.py =================================================================== --- pyplusplus_dev/unittests/indexing_suites_tester.py 2006-06-19 13:24:30 UTC (rev 232) +++ pyplusplus_dev/unittests/indexing_suites_tester.py 2006-06-19 14:31:22 UTC (rev 233) @@ -22,7 +22,7 @@ @staticmethod def matcher( item, decl ): - if not declarations.vector_traits.is_vector( decl ): + if not declarations.vector_traits.is_my_case( decl ): return False value_type = declarations.vector_traits.value_type(decl) if item is value_type: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-06-19 13:24:47
|
Revision: 232 Author: roman_yakovenko Date: 2006-06-19 06:24:30 -0700 (Mon, 19 Jun 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=232&view=rev Log Message: ----------- small refactoring to container traits to make it easy to add another container Modified Paths: -------------- pygccxml_dev/pygccxml/declarations/container_traits.py pygccxml_dev/pygccxml/declarations/type_traits.py pygccxml_dev/unittests/vector_traits_tester.py pyplusplus_dev/pyplusplus/module_creator/types_database.py Modified: pygccxml_dev/pygccxml/declarations/container_traits.py =================================================================== --- pygccxml_dev/pygccxml/declarations/container_traits.py 2006-06-19 12:30:09 UTC (rev 231) +++ pygccxml_dev/pygccxml/declarations/container_traits.py 2006-06-19 13:24:30 UTC (rev 232) @@ -7,81 +7,49 @@ defines few algorithms, that deals with different properties of std containers """ -#import typedef import calldef import cpptypes -#import variable -#import algorithm import namespace -#import templates -#import enumeration import class_declaration -#from sets import Set as set -#import types as build_in_types import type_traits -def is_defined_in_xxx( xxx, cls ): - if not cls.parent: - return False +class impl_details: + @staticmethod + def get_container_or_none( type, container_name ): + """returns reference to the class declaration or None""" + type = type_traits.remove_alias( type ) + type = type_traits.remove_cv( type ) + + cls = None + if isinstance( type, cpptypes.declarated_t ): + cls = type_traits.remove_alias( type.declaration ) + elif isinstance( type, class_declaration.class_t ): + cls = type + elif isinstance( type, class_declaration.class_declaration_t ): + cls = type + else: + return + + if not cls.name.startswith( container_name + '<' ): + return + + if not type_traits.impl_details.is_defined_in_xxx( 'std', cls ): + return + return cls - if not isinstance( cls.parent, namespace.namespace_t ): - return False +class vector_traits: + CONTAINER_NAME = 'vector' - if xxx != cls.parent.name: - return False - - xxx_ns = cls.parent - if not xxx_ns.parent: - return False - - if not isinstance( xxx_ns.parent, namespace.namespace_t ): - return False - - if '::' != xxx_ns.parent.name: - return False - - global_ns = xxx_ns.parent - return None is global_ns.parent - -class vector_traits: - @staticmethod - def declaration_or_none( type ): - global is_defined_in_std - """returns reference to the class declaration or None""" - type = type_traits.remove_alias( type ) - type = type_traits.remove_cv( type ) - - cls = None - if isinstance( type, cpptypes.declarated_t ): - cls = type_traits.remove_alias( type.declaration ) - elif isinstance( type, class_declaration.class_t ): - cls = type - elif isinstance( type, class_declaration.class_declaration_t ): - cls = type - else: - return - - if not cls.name.startswith( 'vector<' ): - return - - if not is_defined_in_xxx( 'std', cls ): - return - return cls - - @staticmethod def is_vector( type ): """ - Returns True if type represents instantiation of std class vector, - otherwise False. - """ - return not( None is vector_traits.declaration_or_none( type ) ) - + Returns True if type represents instantiation of std class vector, otherwise False.""" + return not( None is impl_details.get_container_or_none( type, vector_traits.CONTAINER_NAME ) ) @staticmethod def class_declaration( type ): """returns reference to the class declaration, """ - cls = vector_traits.declaration_or_none( type ) + cls = impl_details.get_container_or_none( type, vector_traits.CONTAINER_NAME ) if not cls: raise TypeError( 'Type "%s" is not instantiation of std::vector' % type.decl_string ) return cls @@ -93,17 +61,9 @@ if isinstance( cls, class_declaration.class_t ): return type_traits.remove_declarated( cls.typedef( "value_type", recursive=False ).type ) else: - value_type_str = templates.args( cls.name )[0] - if not value_type_str.startswith( '::' ): - value_type_str = '::' + value_type_str - found = cls.top_parent.decls( name=value_type_str - , function=lambda decl: not isinstance( decl, calldef.calldef_t ) - , allow_empty=True ) - if not found: - if cpptypes.FUNDAMENTAL_TYPES.has_key( value_type_str ): - return cpptypes.FUNDAMENTAL_TYPES[value_type_str] - if len( found ) == 1: - return found[0] - else: - raise RuntimeError( "Unable to find out vector value type. vector class is: %s" % cls.decl_string ) + value_type_str = templates.args( cls.name )[0] + ref = type_traits.impl_details.find_value_type( cls.top_parent, value_type_str ) + if None is ref: + raise RuntimeError( "Unable to find out vector value type. vector class is: %s" % cls.decl_string ) + return ref Modified: pygccxml_dev/pygccxml/declarations/type_traits.py =================================================================== --- pygccxml_dev/pygccxml/declarations/type_traits.py 2006-06-19 12:30:09 UTC (rev 231) +++ pygccxml_dev/pygccxml/declarations/type_traits.py 2006-06-19 13:24:30 UTC (rev 232) @@ -753,6 +753,46 @@ global_ns = xxx_ns.parent return None is global_ns.parent + +class impl_details: + @staticmethod + def is_defined_in_xxx( xxx, cls ): + if not cls.parent: + return False + + if not isinstance( cls.parent, namespace.namespace_t ): + return False + + if xxx != cls.parent.name: + return False + + xxx_ns = cls.parent + if not xxx_ns.parent: + return False + + if not isinstance( xxx_ns.parent, namespace.namespace_t ): + return False + + if '::' != xxx_ns.parent.name: + return False + + global_ns = xxx_ns.parent + return None is global_ns.parent + + @staticmethod + def find_value_type( global_ns, value_type_str ): + if not value_type_str.startswith( '::' ): + value_type_str = '::' + value_type_str + found = global_ns.decls( name=value_type_str + , function=lambda decl: not isinstance( decl, calldef.calldef_t ) + , allow_empty=True ) + if not found: + if cpptypes.FUNDAMENTAL_TYPES.has_key( value_type_str ): + return cpptypes.FUNDAMENTAL_TYPES[value_type_str] + if len( found ) == 1: + return found[0] + else: + return None class smart_pointer_traits: @staticmethod @@ -762,7 +802,7 @@ type = remove_declarated( type ) if not isinstance( type, ( class_declaration.class_declaration_t, class_declaration.class_t ) ): return False - if not is_defined_in_xxx( 'boost', type ): + if not impl_details.is_defined_in_xxx( 'boost', type ): return False return type.decl_string.startswith( '::boost::shared_ptr<' ) @@ -779,16 +819,11 @@ raise RuntimeError( "Unable to find out shared_ptr value type. shared_ptr class is: %s" % cls.decl_string ) else: value_type_str = templates.args( cls.name )[0] - found = cls.top_parent.classes( value_type_str, allow_empty=True ) - if not found: - if cpptypes.FUNDAMENTAL_TYPES.has_key( value_type_str ): - return cpptypes.FUNDAMENTAL_TYPES[value_type_str] - if len( found ) == 1: - return found[0] - else: + ref = impl_details.find_value_type( cls.top_parent, value_type_str ) + if None is ref: raise RuntimeError( "Unable to find out shared_ptr value type. shared_ptr class is: %s" % cls.decl_string ) - - + return ref + def is_std_string( type ): decl_strings = [ '::std::basic_string<char,std::char_traits<char>,std::allocator<char> >' Modified: pygccxml_dev/unittests/vector_traits_tester.py =================================================================== --- pygccxml_dev/unittests/vector_traits_tester.py 2006-06-19 12:30:09 UTC (rev 231) +++ pygccxml_dev/unittests/vector_traits_tester.py 2006-06-19 13:24:30 UTC (rev 232) @@ -27,7 +27,6 @@ def validate_yes( self, value_type, container ): traits = declarations.vector_traits - self.failUnless( traits.declaration_or_none( container ) ) self.failUnless( traits.is_vector( container ) ) self.failUnless( declarations.is_same( value_type, traits.value_type( container ) ) ) Modified: pyplusplus_dev/pyplusplus/module_creator/types_database.py =================================================================== --- pyplusplus_dev/pyplusplus/module_creator/types_database.py 2006-06-19 12:30:09 UTC (rev 231) +++ pyplusplus_dev/pyplusplus/module_creator/types_database.py 2006-06-19 13:24:30 UTC (rev 232) @@ -53,18 +53,18 @@ #will return True is type was treated type = declarations.remove_alias( type ) type = declarations.remove_pointer( type ) - type = declarations.remove_reference( type ) - may_be_vector = declarations.vector_traits.declaration_or_none( type ) - if not ( None is may_be_vector ): + type = declarations.remove_reference( type ) + if declarations.vector_traits.is_vector( type ): + vector = declarations.vector_traits.class_declaration( type ) try: - declarations.vector_traits.value_type( may_be_vector ) - self.__used_vectors.add( may_be_vector ) + declarations.vector_traits.value_type( vector ) + self.__used_vectors.add( vector ) return True except RuntimeError, error: msg = 'WARNING: pyplusplus found std::vector instantiation declaration, ' msg = msg + 'but can not find out value type!' msg = msg + os.linesep + 'This class will not be exported!' - msg = msg + os.linesep + 'std::vector instantiation is: ' + may_be_vector.decl_string + msg = msg + os.linesep + 'std::vector instantiation is: ' + vector.decl_string _logging_.logger.warn( msg ) return False This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-06-19 12:30:24
|
Revision: 231 Author: roman_yakovenko Date: 2006-06-19 05:30:09 -0700 (Mon, 19 Jun 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=231&view=rev Log Message: ----------- moving container traits to a separate file Modified Paths: -------------- pygccxml_dev/pygccxml/declarations/__init__.py pygccxml_dev/pygccxml/declarations/type_traits.py Added Paths: ----------- pygccxml_dev/pygccxml/declarations/container_traits.py Modified: pygccxml_dev/pygccxml/declarations/__init__.py =================================================================== --- pygccxml_dev/pygccxml/declarations/__init__.py 2006-06-18 20:07:05 UTC (rev 230) +++ pygccxml_dev/pygccxml/declarations/__init__.py 2006-06-19 12:30:09 UTC (rev 231) @@ -143,10 +143,12 @@ from type_traits import has_trivial_constructor from type_traits import find_trivial_constructor from type_traits import has_any_non_copyconstructor + +from type_traits import smart_pointer_traits -from type_traits import vector_traits -from type_traits import smart_pointer_traits +from container_traits import vector_traits + import templates Added: pygccxml_dev/pygccxml/declarations/container_traits.py =================================================================== --- pygccxml_dev/pygccxml/declarations/container_traits.py (rev 0) +++ pygccxml_dev/pygccxml/declarations/container_traits.py 2006-06-19 12:30:09 UTC (rev 231) @@ -0,0 +1,109 @@ +# Copyright 2004 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +""" +defines few algorithms, that deals with different properties of std containers +""" + +#import typedef +import calldef +import cpptypes +#import variable +#import algorithm +import namespace +#import templates +#import enumeration +import class_declaration +#from sets import Set as set +#import types as build_in_types +import type_traits + +def is_defined_in_xxx( xxx, cls ): + if not cls.parent: + return False + + if not isinstance( cls.parent, namespace.namespace_t ): + return False + + if xxx != cls.parent.name: + return False + + xxx_ns = cls.parent + if not xxx_ns.parent: + return False + + if not isinstance( xxx_ns.parent, namespace.namespace_t ): + return False + + if '::' != xxx_ns.parent.name: + return False + + global_ns = xxx_ns.parent + return None is global_ns.parent + +class vector_traits: + + @staticmethod + def declaration_or_none( type ): + global is_defined_in_std + """returns reference to the class declaration or None""" + type = type_traits.remove_alias( type ) + type = type_traits.remove_cv( type ) + + cls = None + if isinstance( type, cpptypes.declarated_t ): + cls = type_traits.remove_alias( type.declaration ) + elif isinstance( type, class_declaration.class_t ): + cls = type + elif isinstance( type, class_declaration.class_declaration_t ): + cls = type + else: + return + + if not cls.name.startswith( 'vector<' ): + return + + if not is_defined_in_xxx( 'std', cls ): + return + return cls + + @staticmethod + def is_vector( type ): + """ + Returns True if type represents instantiation of std class vector, + otherwise False. + """ + return not( None is vector_traits.declaration_or_none( type ) ) + + + @staticmethod + def class_declaration( type ): + """returns reference to the class declaration, """ + cls = vector_traits.declaration_or_none( type ) + if not cls: + raise TypeError( 'Type "%s" is not instantiation of std::vector' % type.decl_string ) + return cls + + @staticmethod + def value_type( type ): + """returns reference to value_type of the vector""" + cls = vector_traits.class_declaration( type ) + if isinstance( cls, class_declaration.class_t ): + return type_traits.remove_declarated( cls.typedef( "value_type", recursive=False ).type ) + else: + value_type_str = templates.args( cls.name )[0] + if not value_type_str.startswith( '::' ): + value_type_str = '::' + value_type_str + found = cls.top_parent.decls( name=value_type_str + , function=lambda decl: not isinstance( decl, calldef.calldef_t ) + , allow_empty=True ) + if not found: + if cpptypes.FUNDAMENTAL_TYPES.has_key( value_type_str ): + return cpptypes.FUNDAMENTAL_TYPES[value_type_str] + if len( found ) == 1: + return found[0] + else: + raise RuntimeError( "Unable to find out vector value type. vector class is: %s" % cls.decl_string ) + Modified: pygccxml_dev/pygccxml/declarations/type_traits.py =================================================================== --- pygccxml_dev/pygccxml/declarations/type_traits.py 2006-06-18 20:07:05 UTC (rev 230) +++ pygccxml_dev/pygccxml/declarations/type_traits.py 2006-06-19 12:30:09 UTC (rev 231) @@ -754,70 +754,6 @@ global_ns = xxx_ns.parent return None is global_ns.parent -class vector_traits: - - @staticmethod - def declaration_or_none( type ): - global is_defined_in_std - """returns reference to the class declaration or None""" - type = remove_alias( type ) - type = remove_cv( type ) - - cls = None - if isinstance( type, cpptypes.declarated_t ): - cls = remove_alias( type.declaration ) - elif isinstance( type, class_declaration.class_t ): - cls = type - elif isinstance( type, class_declaration.class_declaration_t ): - cls = type - else: - return - - if not cls.name.startswith( 'vector<' ): - return - - if not is_defined_in_xxx( 'std', cls ): - return - return cls - - @staticmethod - def is_vector( type ): - """ - Returns True if type represents instantiation of std class vector, - otherwise False. - """ - return not( None is vector_traits.declaration_or_none( type ) ) - - - @staticmethod - def class_declaration( type ): - """returns reference to the class declaration, """ - cls = vector_traits.declaration_or_none( type ) - if not cls: - raise TypeError( 'Type "%s" is not instantiation of std::vector' % type.decl_string ) - return cls - - @staticmethod - def value_type( type ): - """returns reference to value_type of the vector""" - cls = vector_traits.class_declaration( type ) - if isinstance( cls, class_declaration.class_t ): - return remove_declarated( cls.typedef( "value_type", recursive=False ).type ) - else: - value_type_str = templates.args( cls.name )[0] - if not value_type_str.startswith( '::' ): - value_type_str = '::' + value_type_str - found = cls.top_parent.decls( name=value_type_str - , function=lambda decl: not isinstance( decl, calldef.calldef_t ) - , allow_empty=True ) - if not found: - if cpptypes.FUNDAMENTAL_TYPES.has_key( value_type_str ): - return cpptypes.FUNDAMENTAL_TYPES[value_type_str] - if len( found ) == 1: - return found[0] - else: - raise RuntimeError( "Unable to find out vector value type. vector class is: %s" % cls.decl_string ) - class smart_pointer_traits: @staticmethod def is_smart_pointer( type ): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-06-18 20:07:11
|
Revision: 230 Author: roman_yakovenko Date: 2006-06-18 13:07:05 -0700 (Sun, 18 Jun 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=230&view=rev Log Message: ----------- improving rbustness of indexing suite Modified Paths: -------------- pyplusplus_dev/pyplusplus/module_creator/types_database.py Modified: pyplusplus_dev/pyplusplus/module_creator/types_database.py =================================================================== --- pyplusplus_dev/pyplusplus/module_creator/types_database.py 2006-06-18 17:32:31 UTC (rev 229) +++ pyplusplus_dev/pyplusplus/module_creator/types_database.py 2006-06-18 20:07:05 UTC (rev 230) @@ -3,8 +3,10 @@ # accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) +import os from pygccxml import declarations from pyplusplus import code_creators +from pyplusplus import _logging_ templates = declarations.templates class types_database_t( object ): @@ -54,8 +56,16 @@ type = declarations.remove_reference( type ) may_be_vector = declarations.vector_traits.declaration_or_none( type ) if not ( None is may_be_vector ): - self.__used_vectors.add( may_be_vector ) - return True + try: + declarations.vector_traits.value_type( may_be_vector ) + self.__used_vectors.add( may_be_vector ) + return True + except RuntimeError, error: + msg = 'WARNING: pyplusplus found std::vector instantiation declaration, ' + msg = msg + 'but can not find out value type!' + msg = msg + os.linesep + 'This class will not be exported!' + msg = msg + os.linesep + 'std::vector instantiation is: ' + may_be_vector.decl_string + _logging_.logger.warn( msg ) return False def _update_db( self, db, type_ ): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-06-18 17:32:44
|
Revision: 229 Author: roman_yakovenko Date: 2006-06-18 10:32:31 -0700 (Sun, 18 Jun 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=229&view=rev Log Message: ----------- adding test for default args Added Paths: ----------- pyplusplus_dev/unittests/data/default_args_to_be_exported.hpp pyplusplus_dev/unittests/default_args_tester.py Added: pyplusplus_dev/unittests/data/default_args_to_be_exported.hpp =================================================================== --- pyplusplus_dev/unittests/data/default_args_to_be_exported.hpp (rev 0) +++ pyplusplus_dev/unittests/data/default_args_to_be_exported.hpp 2006-06-18 17:32:31 UTC (rev 229) @@ -0,0 +1,18 @@ +// Copyright 2004 Roman Yakovenko. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef __default_args_to_be_exported_hpp__ +#define __default_args_to_be_exported_hpp__ + +namespace default_args{ + +struct data{ + int sum( int i=0 ){ return i; } + int sum( int i, int j, int k=3 ){ return i + j + k; } +}; + +} + +#endif//__default_args_to_be_exported_hpp__ Added: pyplusplus_dev/unittests/default_args_tester.py =================================================================== --- pyplusplus_dev/unittests/default_args_tester.py (rev 0) +++ pyplusplus_dev/unittests/default_args_tester.py 2006-06-18 17:32:31 UTC (rev 229) @@ -0,0 +1,37 @@ +# Copyright 2004 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +import os +import sys +import unittest +import fundamental_tester_base +from pygccxml import declarations +from pyplusplus import module_builder + + +class tester_t(fundamental_tester_base.fundamental_tester_base_t): + EXTENSION_NAME = 'default_args' + + def __init__( self, *args ): + fundamental_tester_base.fundamental_tester_base_t.__init__( + self + , tester_t.EXTENSION_NAME + , *args ) + + def run_tests( self, module): + d = module.data() + self.failUnless( d.sum() == 0 ) + self.failUnless( d.sum( 1, 2 ) == 6 ) + +def create_suite(): + suite = unittest.TestSuite() + suite.addTest( unittest.makeSuite(tester_t)) + return suite + +def run_suite(): + unittest.TextTestRunner(verbosity=2).run( create_suite() ) + +if __name__ == "__main__": + run_suite() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-06-18 17:31:22
|
Revision: 228 Author: roman_yakovenko Date: 2006-06-18 10:31:12 -0700 (Sun, 18 Jun 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=228&view=rev Log Message: ----------- adding test for default args Modified Paths: -------------- pygccxml_dev/pygccxml/declarations/filters.py pyplusplus_dev/unittests/test_all.py Modified: pygccxml_dev/pygccxml/declarations/filters.py =================================================================== --- pygccxml_dev/pygccxml/declarations/filters.py 2006-06-18 13:33:59 UTC (rev 227) +++ pygccxml_dev/pygccxml/declarations/filters.py 2006-06-18 17:31:12 UTC (rev 228) @@ -202,8 +202,6 @@ if not isinstance( decl, self.decl_type ): return False if not None is self.name: - if 'SubMeshLodGeometryLink' in decl.decl_string: - i = 0 if not self.check_name( decl ): return False if not None is self.header_dir and decl.location: Modified: pyplusplus_dev/unittests/test_all.py =================================================================== --- pyplusplus_dev/unittests/test_all.py 2006-06-18 13:33:59 UTC (rev 227) +++ pyplusplus_dev/unittests/test_all.py 2006-06-18 17:31:12 UTC (rev 228) @@ -53,6 +53,7 @@ import indexing_suites_tester import hierarchy3_tester import vector3_tester +import default_args_tester def create_suite(times): testers = [ @@ -102,7 +103,8 @@ , protected_tester , indexing_suites_tester , hierarchy3_tester - , vector3_tester + , vector3_tester + , default_args_tester ] main_suite = unittest.TestSuite() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-06-18 13:34:06
|
Revision: 227 Author: roman_yakovenko Date: 2006-06-18 06:33:59 -0700 (Sun, 18 Jun 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=227&view=rev Log Message: ----------- fixing generation of default args 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-06-18 13:33:21 UTC (rev 226) +++ pyplusplus_dev/pyplusplus/code_creators/calldef.py 2006-06-18 13:33:59 UTC (rev 227) @@ -75,24 +75,12 @@ else: return 'p%d' % index - #def args_declaration( self ): - #args = [] - #for index, arg in enumerate( self.declaration.arguments ): - #args.append( arg.type.decl_string + ' ' + self.argument_name(index) ) - #if len( args ) == 1: - #return args[ 0 ] - #return ', '.join( args ) - def args_declaration( self ): args = [] - boost_obj = algorithm.create_identifier( self, '::boost::python::object' ) for index, arg in enumerate( self.declaration.arguments ): result = arg.type.decl_string + ' ' + self.argument_name(index) if arg.default_value: - if not declarations.is_pointer( arg.type ) or arg.default_value != '0': - result += '=%s' % arg.default_value - else: - result += '=%s()' % boost_obj + result += '=%s' % arg.default_value args.append( result ) if len( args ) == 1: return args[ 0 ] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-06-18 13:33:30
|
Revision: 226 Author: roman_yakovenko Date: 2006-06-18 06:33:21 -0700 (Sun, 18 Jun 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=226&view=rev Log Message: ----------- adding windows setup for pyboost Modified Paths: -------------- pyplusplus_dev/examples/pyboost_dev/setup.py Modified: pyplusplus_dev/examples/pyboost_dev/setup.py =================================================================== --- pyplusplus_dev/examples/pyboost_dev/setup.py 2006-06-18 06:44:26 UTC (rev 225) +++ pyplusplus_dev/examples/pyboost_dev/setup.py 2006-06-18 13:33:21 UTC (rev 226) @@ -0,0 +1,34 @@ +#!/usr/bin/env python +# Copyright 2004 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +import sys, os, os.path +from distutils import sysconfig +from distutils.core import setup + +__version__ = "0.2" + +setup( + name = "pyboost" + , version = __version__ + , description = "" + , author = "Roman Yakovenko" + , author_email = "rom...@gm..." + , url = 'http://www.language-binding.net/pygccxml/pygccxml.html' + , packages = [ 'pyboost' + , 'pyboost.boost_random' + , 'pyboost.crc' + , 'pyboost.date_time' + , 'pyboost.rational' ] + , package_data = { + 'pyboost.boost_random' : [ '_random_.dll', 'boost_python.dll' ] + , 'pyboost.crc' : [ '_crc_.dll', 'boost_python.dll' ] + , 'pyboost.date_time' : [ '_date_time_.dll' + , 'boost_python.dll' + , 'boost_date_time-vc71-mt-1_34.dll' + , 'date_time_zonespec.csv' ] + , 'pyboost.rational' : [ '_rational_.dll', 'boost_python.dll' ] + } +) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-06-18 06:44:40
|
Revision: 225 Author: roman_yakovenko Date: 2006-06-17 23:44:26 -0700 (Sat, 17 Jun 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=225&view=rev Log Message: ----------- integrating constructor body patch from Niall Modified Paths: -------------- pyplusplus_dev/pyplusplus/code_creators/__init__.py pyplusplus_dev/pyplusplus/code_creators/calldef.py pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py pyplusplus_dev/pyplusplus/decl_wrappers/class_wrapper.py pyplusplus_dev/pyplusplus/module_creator/creator.py Modified: pyplusplus_dev/pyplusplus/code_creators/__init__.py =================================================================== --- pyplusplus_dev/pyplusplus/code_creators/__init__.py 2006-06-18 05:44:03 UTC (rev 224) +++ pyplusplus_dev/pyplusplus/code_creators/__init__.py 2006-06-18 06:44:26 UTC (rev 225) @@ -68,8 +68,8 @@ from calldef import casting_constructor_t from calldef import constructor_wrapper_t from calldef import casting_member_operator_t -from calldef import special_constructor_wrapper_t -from calldef import trivial_constructor_wrapper_t +from calldef import copy_constructor_wrapper_t +from calldef import null_constructor_wrapper_t from global_variable import global_variable_base_t from global_variable import global_variable_t Modified: pyplusplus_dev/pyplusplus/code_creators/calldef.py =================================================================== --- pyplusplus_dev/pyplusplus/code_creators/calldef.py 2006-06-18 05:44:03 UTC (rev 224) +++ pyplusplus_dev/pyplusplus/code_creators/calldef.py 2006-06-18 06:44:26 UTC (rev 225) @@ -957,14 +957,16 @@ answer = [ self._create_declaration() ] answer.append( ': ' + self._create_constructor_call() ) answer.append( ' , ' + self.parent.boost_wrapper_identifier + '()' ) - answer.append( '{}' ) + answer.append( '{ // Normal constructor' ) + answer.append( self.declaration.body ) + answer.append( '}' ) return os.linesep.join( answer ) #There is something I don't understand #There are usecases when boost.python requeres #constructor for wrapper class from exposed class #I should understand this more -class special_constructor_wrapper_t( declaration_based.declaration_based_t ): +class copy_constructor_wrapper_t( declaration_based.declaration_based_t ): """ Creates wrapper class constructor from wrapped class instance. """ @@ -995,13 +997,16 @@ def _create_impl(self): answer = [ self._create_declaration() ] answer.append( ': ' + self._create_constructor_call() ) - answer.append( ' , ' + self.parent.boost_wrapper_identifier + '()' ) - answer.append( '{}' ) + answer.append( ' , ' + self.parent.boost_wrapper_identifier + '(){' ) + answer.append( self.indent( '// copy constructor' ) ) + answer.append( self.indent( self.declaration.copy_constructor_body ) ) + answer.append( '}' ) return os.linesep.join( answer ) -class trivial_constructor_wrapper_t( declaration_based.declaration_based_t ): + +class null_constructor_wrapper_t( declaration_based.declaration_based_t ): """ - Creates trivial wrapper class constructor. + Creates wrapper for compiler generated null constructor. """ def __init__( self, class_inst, parent=None ): declaration_based.declaration_based_t.__init__( self @@ -1017,8 +1022,10 @@ answer[0] = answer[0] + 'PyObject*' answer[0] = answer[0] + ')' answer.append( ': ' + self._create_constructor_call() ) - answer.append( ' , ' + self.parent.boost_wrapper_identifier + '()' ) - answer.append( '{}' ) + answer.append( ' , ' + self.parent.boost_wrapper_identifier + '(){' ) + answer.append( self.indent( '// null constructor' ) ) + answer.append( self.indent( self.declaration.null_constructor_body ) ) + answer.append( '}' ) return os.linesep.join( answer ) #in python all operators are members of class, while in C++ Modified: pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py =================================================================== --- pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py 2006-06-18 05:44:03 UTC (rev 224) +++ pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py 2006-06-18 06:44:26 UTC (rev 225) @@ -155,7 +155,14 @@ def __init__(self, *arguments, **keywords): declarations.constructor_t.__init__( self, *arguments, **keywords ) calldef_t.__init__( self ) + self._body = '' + def _get_body(self): + return self._body + def _set_body(self, body): + self._body = body + body = property( _get_body, _set_body ) + def _exportable_impl_derived( self ): if self.is_artificial: return 'pyplusplus does not exports compiler generated constructors' Modified: pyplusplus_dev/pyplusplus/decl_wrappers/class_wrapper.py =================================================================== --- pyplusplus_dev/pyplusplus/decl_wrappers/class_wrapper.py 2006-06-18 05:44:03 UTC (rev 224) +++ pyplusplus_dev/pyplusplus/decl_wrappers/class_wrapper.py 2006-06-18 06:44:26 UTC (rev 225) @@ -47,7 +47,9 @@ self._user_code = [] self._wrapper_user_code = [] self._indexing_suite = None - + self._null_constructor_body = '' + self._copy_constructor_body = '' + def _get_always_expose_using_scope( self ): return self._always_expose_using_scope def _set_always_expose_using_scope( self, value ): @@ -108,6 +110,18 @@ return self._indexing_suite indexing_suite = property( _get_indexing_suite ) + def _get_null_constructor_body(self): + return self._null_constructor_body + def _set_null_constructor_body(self, body): + self._null_constructor_body = body + null_constructor_body = property( _get_null_constructor_body, _set_null_constructor_body ) + + def _get_copy_constructor_body(self): + return self._copy_constructor_body + def _set_copy_constructor_body(self, body): + self._copy_constructor_body = body + copy_constructor_body = property( _get_copy_constructor_body, _set_copy_constructor_body ) + def add_code( self, code, works_on_instance=True ): """works_on_instance: If true, the custom code can be applied directly to obj inst. Ex: ObjInst."CustomCode" @@ -116,6 +130,12 @@ def add_wrapper_code( self, code ): self.wrapper_user_code.append( user_text.user_text_t( code ) ) + + def set_constructors_body( self, body ): + """Sets the body for all constructors""" + self.constructors().body = body + self.null_constructor_body = body + self.copy_constructor_body = body def _exportable_impl( self ): if not self.name: Modified: pyplusplus_dev/pyplusplus/module_creator/creator.py =================================================================== --- pyplusplus_dev/pyplusplus/module_creator/creator.py 2006-06-18 05:44:03 UTC (rev 224) +++ pyplusplus_dev/pyplusplus/module_creator/creator.py 2006-06-18 06:44:26 UTC (rev 225) @@ -579,12 +579,12 @@ #I don't know but sometimes boost.python requieres #to construct wrapper from wrapped classe if not self.curr_decl.noncopyable: - scons = code_creators.special_constructor_wrapper_t( class_inst=self.curr_decl ) - wrapper.adopt_creator( scons ) - trivial_constr = declarations.find_trivial_constructor(self.curr_decl) - if trivial_constr and trivial_constr.is_artificial: + copy_constr = code_creators.copy_constructor_wrapper_t( class_inst=self.curr_decl ) + wrapper.adopt_creator( copy_constr ) + null_constr = declarations.find_trivial_constructor(self.curr_decl) + if null_constr and null_constr.is_artificial: #this constructor is not going to be exposed - tcons = code_creators.trivial_constructor_wrapper_t( class_inst=self.curr_decl ) + tcons = code_creators.null_constructor_wrapper_t( class_inst=self.curr_decl ) wrapper.adopt_creator( tcons ) self.curr_code_creator.adopt_creator( class_inst ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-06-18 05:44:10
|
Revision: 224 Author: roman_yakovenko Date: 2006-06-17 22:44:03 -0700 (Sat, 17 Jun 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=224&view=rev Log Message: ----------- adding default arguments to wrappers removing "virtual" from default function 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-06-18 05:23:18 UTC (rev 223) +++ pyplusplus_dev/pyplusplus/code_creators/calldef.py 2006-06-18 05:44:03 UTC (rev 224) @@ -75,12 +75,27 @@ else: return 'p%d' % index + #def args_declaration( self ): + #args = [] + #for index, arg in enumerate( self.declaration.arguments ): + #args.append( arg.type.decl_string + ' ' + self.argument_name(index) ) + #if len( args ) == 1: + #return args[ 0 ] + #return ', '.join( args ) + def args_declaration( self ): args = [] + boost_obj = algorithm.create_identifier( self, '::boost::python::object' ) for index, arg in enumerate( self.declaration.arguments ): - args.append( arg.type.decl_string + ' ' + self.argument_name(index) ) + result = arg.type.decl_string + ' ' + self.argument_name(index) + if arg.default_value: + if not declarations.is_pointer( arg.type ) or arg.default_value != '0': + result += '=%s' % arg.default_value + else: + result += '=%s()' % boost_obj + args.append( result ) if len( args ) == 1: - return args[ 0 ] + return args[ 0 ] return ', '.join( args ) def override_identifier(self): @@ -306,15 +321,20 @@ , arguments_types=map( lambda arg: arg.type, self.declaration.arguments ) , has_const=self.declaration.has_const ) - def create_declaration(self, name): - template = 'virtual %(return_type)s %(name)s( %(args)s )%(constness)s %(throw)s' + def create_declaration(self, name, has_virtual=True): + template = '%(virtual)s%(return_type)s %(name)s( %(args)s )%(constness)s %(throw)s' + + virtual = 'virtual ' + if not has_virtual: + virtual = '' constness = '' if self.declaration.has_const: constness = ' const ' return template % { - 'return_type' : self.declaration.return_type.decl_string + 'virtual' : virtual + , 'return_type' : self.declaration.return_type.decl_string , 'name' : name , 'args' : self.args_declaration() , 'constness' : constness @@ -357,7 +377,7 @@ return os.linesep.join( answer ) def create_default_function( self ): - answer = [ self.create_declaration('default_' + self.declaration.alias) + '{' ] + answer = [ self.create_declaration('default_' + self.declaration.alias, False) + '{' ] answer.append( self.indent( self.create_default_body() ) ) answer.append( '}' ) return os.linesep.join( answer ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-06-18 05:23:26
|
Revision: 223 Author: roman_yakovenko Date: 2006-06-17 22:23:18 -0700 (Sat, 17 Jun 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=223&view=rev Log Message: ----------- Committing changes from Janes, Matthias adding treatment for Java native types Modified Paths: -------------- pygccxml_dev/pygccxml/declarations/type_visitor.py pygccxml_dev/pygccxml/parser/linker.py Modified: pygccxml_dev/pygccxml/declarations/type_visitor.py =================================================================== --- pygccxml_dev/pygccxml/declarations/type_visitor.py 2006-06-18 05:22:04 UTC (rev 222) +++ pygccxml_dev/pygccxml/declarations/type_visitor.py 2006-06-18 05:23:18 UTC (rev 223) @@ -72,7 +72,31 @@ def visit_complex_float(self): raise NotImplementedError() + + def visit_jbyte(self): + raise NotImplementedError() + def visit_jshort(self): + raise NotImplementedError() + + def visit_jint(self): + raise NotImplementedError() + + def visit_jlong(self): + raise NotImplementedError() + + def visit_jfloat(self): + raise NotImplementedError() + + def visit_jdouble(self): + raise NotImplementedError() + + def visit_jchar(self): + raise NotImplementedError() + + def visit_jboolean(self): + raise NotImplementedError() + def visit_volatile( self ): raise NotImplementedError() Modified: pygccxml_dev/pygccxml/parser/linker.py =================================================================== --- pygccxml_dev/pygccxml/parser/linker.py 2006-06-18 05:22:04 UTC (rev 222) +++ pygccxml_dev/pygccxml/parser/linker.py 2006-06-18 05:23:18 UTC (rev 223) @@ -193,6 +193,30 @@ def visit_complex_float(self): pass + def visit_jbyte(self): + pass + + def visit_jshort(self): + pass + + def visit_jint(self): + pass + + def visit_jlong(self): + pass + + def visit_jfloat(self): + pass + + def visit_jdouble(self): + pass + + def visit_jchar(self): + pass + + def visit_jboolean(self): + pass + def visit_volatile( self ): self.__link_compound_type() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-06-18 05:22:10
|
Revision: 222 Author: roman_yakovenko Date: 2006-06-17 22:22:04 -0700 (Sat, 17 Jun 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=222&view=rev Log Message: ----------- Porting indexing suite to Windows Modified Paths: -------------- pygccxml_dev/pygccxml/declarations/type_traits.py Modified: pygccxml_dev/pygccxml/declarations/type_traits.py =================================================================== --- pygccxml_dev/pygccxml/declarations/type_traits.py 2006-06-17 18:11:32 UTC (rev 221) +++ pygccxml_dev/pygccxml/declarations/type_traits.py 2006-06-18 05:22:04 UTC (rev 222) @@ -802,7 +802,7 @@ """returns reference to value_type of the vector""" cls = vector_traits.class_declaration( type ) if isinstance( cls, class_declaration.class_t ): - return remove_declarated( cls.typedef( "value_type" ).type ) + return remove_declarated( cls.typedef( "value_type", recursive=False ).type ) else: value_type_str = templates.args( cls.name )[0] if not value_type_str.startswith( '::' ): @@ -838,7 +838,7 @@ cls = remove_cv( type ) cls = remove_declarated( type ) if isinstance( cls, class_declaration.class_t ): - return remove_declarated( cls.typedef( "value_type" ).type ) + return remove_declarated( cls.typedef( "value_type", recursive=False ).type ) elif not isinstance( cls, ( class_declaration.class_declaration_t, class_declaration.class_t ) ): raise RuntimeError( "Unable to find out shared_ptr value type. shared_ptr class is: %s" % cls.decl_string ) else: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-06-17 18:12:06
|
Revision: 221 Author: roman_yakovenko Date: 2006-06-17 11:11:32 -0700 (Sat, 17 Jun 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=221&view=rev Log Message: ----------- adding indexing suite - first release Modified Paths: -------------- pyplusplus_dev/examples/pyboost_dev/dev/date_time/generate_code.py pyplusplus_dev/examples/pyboost_dev/dev/date_time/include/date_time.pypp.xml pyplusplus_dev/pyplusplus/code_creators/__init__.py pyplusplus_dev/pyplusplus/code_creators/class_declaration.py pyplusplus_dev/pyplusplus/code_creators/indexing_suites.py pyplusplus_dev/pyplusplus/decl_wrappers/__init__.py pyplusplus_dev/pyplusplus/decl_wrappers/class_wrapper.py pyplusplus_dev/pyplusplus/decl_wrappers/indexing_suite.py pyplusplus_dev/pyplusplus/module_builder/__init__.py pyplusplus_dev/pyplusplus/module_creator/creator.py pyplusplus_dev/pyplusplus/module_creator/types_database.py pyplusplus_dev/unittests/data/indexing_suites_to_be_exported.hpp pyplusplus_dev/unittests/indexing_suites_tester.py Modified: pyplusplus_dev/examples/pyboost_dev/dev/date_time/generate_code.py =================================================================== --- pyplusplus_dev/examples/pyboost_dev/dev/date_time/generate_code.py 2006-06-17 18:09:21 UTC (rev 220) +++ pyplusplus_dev/examples/pyboost_dev/dev/date_time/generate_code.py 2006-06-17 18:11:32 UTC (rev 221) @@ -138,13 +138,22 @@ for operator in [ '>', '>=', '<=', '<', '-' ]: ptime.add_code( 'def( bp::self %s bp::self )' % operator ) - def beautify_code( self, mb ): + def beautify_code( self, mb ): + + def is_vector_of_strings( decl ): + if not declarations.vector_traits.is_vector( decl ): + return False + return declarations.is_std_string( declarations.vector_traits.value_type(decl) ) + + str_vec = mb.class_( is_vector_of_strings ) + str_vec.alias = "strings" + extmodule = mb.code_creator extmodule.add_namespace_usage( 'boost' ) extmodule.add_namespace_usage( 'boost::date_time' ) for full_ns_name, alias in customization_data.ns_aliases.items(): extmodule.add_namespace_alias( alias, full_ns_name ) - + def customize_extmodule( self, mb ): extmodule = mb.code_creator #beautifying include code generation Modified: pyplusplus_dev/examples/pyboost_dev/dev/date_time/include/date_time.pypp.xml =================================================================== --- pyplusplus_dev/examples/pyboost_dev/dev/date_time/include/date_time.pypp.xml 2006-06-17 18:09:21 UTC (rev 220) +++ pyplusplus_dev/examples/pyboost_dev/dev/date_time/include/date_time.pypp.xml 2006-06-17 18:11:32 UTC (rev 221) @@ -2,8 +2,8 @@ <GCC_XML cvs_revision="1.112"> <Namespace id="_1" name="::" members="_3 _4 _5 _6 _7 _8 _9 _10 _11 _12 _13 _14 _15 _16 _17 _18 _19 _20 _21 _22 _23 _24 _25 _26 _27 _28 _29 _30 _31 _32 _33 _34 _35 _36 _37 _38 _39 _40 _41 _42 _43 _44 _45 _46 _47 _48 _49 _50 _51 _52 _53 _54 _55 _56 _57 _58 _59 _60 _61 _62 _63 _64 _65 _66 _67 _68 _69 _70 _71 _72 _73 _74 _75 _76 _77 _78 _79 _80 _81 _82 _83 _84 _85 _86 _87 _88 _89 _90 _91 _92 _93 _94 _95 _96 _97 _98 _99 _100 _101 _102 _103 _104 _105 _106 _107 _108 _109 _110 _111 _112 _113 _114 _115 _116 _117 _118 _119 _120 _121 _122 _123 _124 _125 _126 _127 _128 _129 _130 _131 _132 _133 _134 _135 _136 _137 _138 _139 _140 _141 _142 _143 _144 _145 _146 _147 _148 _149 _150 _151 _152 _153 _154 _155 _156 _157 _158 _159 _160 _161 _162 _163 _164 _165 _166 _167 _168 _169 _170 _171 _172 _173 _174 _175 _176 _177 _178 _179 _180 _181 _182 _183 _184 _185 _186 _187 _188 _189 _190 _191 _192 _193 _194 _195 _196 _197 _198 _199 _200 _201 _202 _203 _204 _205 _206 _207 _208 _209 _210 _211 _212 _213 _214 _215 _216 _217 _218 _219 _220 _221 _222 _223 _224 _225 _226 _227 _228 _229 _230 _231 _232 _233 _234 _235 _236 _237 _238 _239 _240 _241 _242 _243 _244 _245 _246 _247 _248 _249 _250 _251 _252 _253 _254 _255 _256 _257 _258 _259 _260 _261 _262 _263 _264 _265 _266 _267 _268 _269 _270 _271 _272 _273 _274 _275 _276 _277 _278 _279 _280 _281 _282 _283 _284 _285 _286 _287 _288 _289 _290 _291 _292 _293 _294 _295 _296 _297 _298 _299 _300 _301 _302 _303 _304 _305 _306 _307 _308 _309 _310 _311 _312 _313 _314 _315 _316 _317 _318 _319 _320 _321 _322 _323 _324 _325 _326 _327 _328 _329 _330 _331 _332 _333 _334 _335 _336 _337 _338 _339 _340 _341 _342 _343 _344 _345 _346 _347 _348 _349 _350 _351 _352 _353 _354 _355 _356 _357 _358 _359 _360 _361 _362 _363 _364 _365 _366 _367 _368 _369 _370 _371 _372 _373 _374 _375 _376 _377 _378 _379 _380 _381 _382 _383 _384 _385 _386 _387 _388 _389 _390 _391 _392 _393 _394 _395 _396 _397 _398 _399 _400 _401 _402 _403 _404 _405 _406 _407 _408 _409 _410 _411 _412 _413 _414 _415 _416 _417 _418 _419 _420 _421 _422 _423 _424 _425 _426 _427 _428 _429 _430 _431 _432 _433 _434 _435 _436 _437 _438 _439 _440 _441 _442 _443 _444 _445 _446 _447 _448 _449 _450 _451 _452 _453 _454 _455 _456 _457 _458 _459 _460 _461 _462 _463 _464 _465 _466 _467 _468 _469 _470 _471 _472 _473 _474 _475 _476 _477 _478 _479 _480 _482 _483 _484 _485 _486 _487 _488 _489 _490 _491 _492 _493 _494 _495 _496 _497 _498 _499 _501 _502 _503 _504 _505 _506 _508 _509 _510 _511 _512 _513 _514 _515 _516 _517 _518 _519 _520 _521 _522 _523 _524 _525 _526 _527 _528 _529 _530 _531 _532 _533 _534 _535 _536 _537 _538 _539 _540 _541 _542 _543 _544 _545 _546 _547 _548 _549 _550 _551 _552 _553 _554 _555 _556 _557 _558 _559 _560 _561 _562 _563 _564 _565 _566 _567 _568 _569 _570 _571 _572 _573 _574 _575 _576 _577 _578 _579 _580 _581 _582 _583 _584 _585 _586 _587 _588 _589 _590 _591 _592 _593 _594 _595 _596 _597 _598 _599 _600 _601 _602 _603 _604 _605 _606 _607 _608 _609 _610 _611 _612 _613 _614 _615 _616 _617 _618 _619 _621 _622 _623 _624 _625 _626 _627 _628 _629 _630 _631 _632 _633 _634 _635 _636 _638 _639 _640 _641 _642 _643 _644 _645 _646 _647 _648 _649 _650 _651 _652 _653 _654 _655 _656 _657 _658 _659 _660 _661 _662 _663 _664 _665 _666 _667 _668 _669 _670 _671 _672 _673 _674 _675 _676 _677 _678 _679 _680 _681 _682 _683 _684 _685 _686 _687 _688 _689 _690 _691 _692 _693 _694 _695 _696 _697 _698 _699 _700 _701 _702 _703 _704 _705 _706 _707 _708 _709 _710 _711 _712 _713 _714 _715 _716 _717 _718 _719 _720 _721 _722 _723 _724 _725 _726 _727 _728 _729 _730 _731 _732 _733 _734 _735 _736 _737 _738 _739 _740 _741 _742 _743 _744 _745 _746 _747 _748 _749 _750 _751 _752 _753 _754 _755 _756 _757 _758 _759 _760 _761 _762 _763 _764 _766 _767 _768 _769 _770 _771 _772 _773 _774 _775 _776 _777 _778 _779 _780 _781 _782 _783 _784 _785 _786 _787 _788 _789 _790 _791 _792 _793 _794 _795 _796 _797 _798 _799 _800 _801 _802 _803 _804 _805 _806 _807 _808 _809 _810 _811 _812 _813 _814 _815 _816 _817 _819 _820 _821 _823 _824 _825 _826 _827 _828 _829 _830 _831 _832 _833 _834 _835 _836 _837 _838 _839 _840 _841 _842 _843 _844 _845 _846 _847 _848 _849 _850 _851 _852 _853 _854 _855 _856 _857 _858 _859 _860 _861 _862 _863 _864 _865 _866 _867 _868 _869 _870 _871 _872 _873 _874 _875 _876 _877 _878 _879 _880 _881 _882 _883 _884 _885 _886 _887 _888 _889 _890 _891 _892 _893 _894 _895 _896 _897 _898 _899 _900 _901 _902 _903 _904 _905 _906 _907 _908 _909 _910 _911 _912 _913 _914 _915 _916 _917 _918 _919 _920 _921 _922 _923 _924 _925 _926 _927 _928 _929 _930 _931 _932 _933 _934 _935 _936 _937 _938 _939 _940 _941 _942 _943 _944 _945 _946 _947 _948 _949 _950 _951 _952 _953 _954 _955 _956 _957 _958 _959 _960 _961 _962 _963 _964 _965 _966 _967 _968 _969 _970 _971 _972 _973 _974 _975 _976 _977 _978 _979 _980 _981 _982 _983 _984 _985 _986 _987 _988 _989 _990 _991 _992 _993 _994 _995 _996 _997 _998 _999 _1000 _1001 _1002 _1003 _1005 _1006 _1007 _1008 _1009 _1010 _1011 _1012 _1013 _1014 _1015 _1016 _1017 _1018 _1019 _1020 _1021 _1022 _1023 _1024 _1025 _1026 _1027 _1028 _1029 _1030 _1031 _1032 _1033 _1034 _1035 _1036 _1037 _1038 _1039 _1040 _1041 _1042 _1043 _1044 _1045 _1046 _1047 _1048 _1049 _1050 _1051 _1052 _1053 _1054 _1055 _1056 _1057 _1058 _1059 _1060 _1061 _1062 _1063 _1064 _1065 _1066 _1067 _1068 _1069 _1070 _1071 _1072 _1073 _1074 _1075 _1076 _1077 _1078 _1079 _1080 _1081 _1082 _1083 _1084 _1085 _1086 _1087 _1088 _1089 _1090 _1091 _1092 _1093 _1094 _1095 _1096 _1097 _1098 _1099 _1100 _1101 _1102 _1103 _1104 _1106 _1108 _1110 _1111 _1112 _1113 _1114 _1115 _1116 _1117 _1118 _1119 _1120 _1121 _1122 _1123 _1124 _1125 _1126 _1127 _1128 _1129 _1130 _1131 _1132 _1133 _1135 _1134 _1137 _1139 _1141 _1143 _1144 _1145 _1146 _1147 _1148 _1149 _1150 _1151 _1152 _1153 _1155 _1156 _1157 _1158 _1160 _1161 _1163 _1164 _1166 _1167 _1169 _1171 _1173 _1175 _1177 _1179 _1181 _1183 _1185 _1186 _1187 _1188 _1189 _1190 _1191 _1105 _1107 _765 _1192 _1194 _1195 _1193 _1196 _1197 _1198 _1199 _1200 _1201 _1202 _1203 _1204 _1205 _1206 _1207 _1208 _1209 _1210 _1211 _1212 _1213 _1214 _1215 _1216 _1217 _1218 _1219 _1220 _1221 _1222 _1223 _1224 _1225 _1226 _1227 _1228 _1229 _1230 _1231 _1232 _1233 _1234 _1235 _1236 _1237 _1238 _1239 _1241 _1242 _1243 _1244 _1245 _1247 _1249 _1250 _1251 _1252 _1253 _1255 _1256 _1257 _1258 _1260 _1261 _1262 _1263 _1264 _1265 _1266 _1267 _1268 _1269 _1270 _1271 _1272 _1273 _1274 _1275 _1276 _1277 _1278 _1279 _1280 _1281 _1282 _1283 _1284 _1285 _1286 _1287 _1288 _1289 _1290 _1291 _1292 _1293 _1294 _1295 _1296 _1297 _1298 _1299 _1300 _1301 _1302 _1303 _1304 _1305 _1306 _1307 _1308 _1309 _1310 _1311 _1312 _1313 _1314 _1315 _1316 _1317 _1318 _1319 _1320 _1321 _1322 _1323 _1324 _1325 _1326 _1327 _1328 _1329 _1330 _1331 _1332 _1333 _1334 _1335 _1336 _1337 _1338 _1339 _1340 _1341 _1342 _1343 _1344 _1345 _1346 _1347 _1348 _1349 _1350 _1351 _1352 _1353 _1354 _1355 _1356 _1357 _1358 _1359 _1360 _1361 _1362 _1363 _1364 _1365 _1366 _1367 _1368 _1369 _1370 _1371 _1372 _1373 _1374 _1375 _1376 _1377 _1378 _1379 _1380 _1381 _1382 _1383 _1384 _1385 _1386 _1387 _1388 _1389 _1390 _1391 _1392 _1393 _1394 _1395 _1396 _1397 _1398 _1399 _1400 _1401 _1402 _1403 _1404 _1405 _1406 _1407 _1408 _1409 _1410 _1411 _1412 _1413 _1414 _1415 _1416 _1417 _1418 _1419 _1420 _1421 _1422 _1423 _1424 _1425 _1426 _1427 _1428 _1430 _1431 _1432 _1433 _1434 _1435 _1436 _1437 _1438 _1439 _1440 _1441 _1442 _1443 _1444 _1445 _1446 _1447 _1448 _1449 _1450 _1451 _1452 _1453 _1454 _1455 _1456 _1457 _1458 _1459 _1460 _1461 _1462 _1463 _1464 _1465 _1466 _1467 _1468 _1469 _1470 _1471 _1472 _1473 _1474 _1475 _1476 _1477 _1478 _1479 _1480 _1481 _1482 _1483 _1484 _1485 _1486 _1487 _1488 _1489 _1491 _1490 _1492 _1493 _818 _1494 _1495 _1496 _1497 _1499 _1498 _1501 _1502 _1503 _1504 _1505 _1506 _1507 _1508 _1509 _1510 _1512 _1513 _1514 _1515 _1516 _1517 _1518 _1519 _1520 _1521 _1522 _1523 _1525 _1524 _1526 _1527 _1528 _1529 _1530 _1531 _1532 _1533 _1534 _1535 _1536 _1537 _1538 _1539 _1540 _1541 _1542 _1543 _1544 _1545 _1546 _1547 _1548 _1549 _1550 _1551 _1552 _1553 _1554 _1555 _1556 _1557 _1558 _1559 _1560 _1562 _1563 _1564 _1565 _1566 _1567 _1568 _1569 _1570 _1571 _1573 _1574 _1575 _1576 _1577 _1578 _1579 _1580 _1581 _1582 _1583 _1584 _1585 _1586 _1587 _1588 _1589 _1590 _1591 _1592 _1593 _1594 _1561 _1595 _1596 _1597 _1598 _1599 _1600 _1601 _1602 _1603 _1604 _1605 _1606 _1607 _1608 _1609 _1610 _1611 _1612 _1613 _1614 _1615 _1616 _1617 _1618 _1619 _1620 _1621 _1622 _1623 _1624 _1625 _1626 _1627 _1628 _1629 _1630 _1631 _1632 _1633 _1634 _1635 _1636 _1637 _1638 _1639 _1640 _1641 _1642 _1643 _1644 _1645 _1646 _1647 _1648 _1649 _1650 _1651 _1652 _1653 _1654 _1655 _1656 _1657 _1658 _1659 _1660 _1661 _1662 _1663 _1664 _1665 _1666 _1667 _1668 _1669 _1670 _1671 _1672 _1673 _1674 _1675 _1676 _1677 _1678 _1679 _1680 _1681 _1682 _1683 _1684 _1685 _1686 _1687 _1688 _1689 _1690 _1691 _1692 _1693 _1694 _1695 _1696 _1697 _1698 _1699 _1700 _1701 _1702 _1703 _1704 _1705 _1706 _1707 _1708 _1709 _1710 _1711 _1712 _1713 _1714 _1715 _1716 _1717 _1718 _1719 _1720 _1721 _1722 _1723 _1724 _1725 _1726 _1727 _1728 _1729 _1730 _1731 _1732 _1733 _1734 _1735 _1736 _1737 _1738 _1739 _1740 _1741 _1742 _1743 _1744 _1745 _1746 _1747 _1748 _1749 _1750 _1751 _1752 _1753 _1754 _1755 _1756 _1757 _1758 _1759 _1760 _1761 _1762 _1763 _1764 _1765 _1766 _1767 _1768 _1769 _1770 _1771 _1772 _1773 _1774 _1775 _1776 _1777 _1778 _1779 _1780 _1781 _1782 _1783 _1784 _1785 _1786 _1787 _1788 _1789 _1790 _1791 _1792 _1793 _1794 _1795 _1796 _1797 _1798 _1799 _1800 _1801 _1802 _1803 _1804 _1805 _1806 _1807 _1808 _1809 _1810 _1811 _1812 _1813 _1814 _1815 _1816 _1817 _1818 _1819 _1820 _1821 _1822 _1823 _1824 _1825 _1826 _1827 _1828 _1829 _1830 _1831 _1832 _1833 _1834 _1835 _1836 _1837 _1838 _1839 _1840 _1841 _1842 _1843 _1844 _1845 _1846 _1847 _1848 _1849 _1850 " mangled="_Z2::" demangled="::"/> <Namespace id="_2" name="std" context="_1" members="_1852 _1853 _1854 _1855 _1856 _1857 _1858 _1859 _1860 _1861 _1862 _1863 _1864 _1865 _1866 _1867 _1868 _1869 _1870 _1871 _1872 _1873 _1874 _1875 _1876 _1877 _1878 _1879 _1880 _1881 _1882 _1883 _1884 _1885 _1886 _1887 _1888 _1889 _1890 _1891 _1892 _1893 _1894 _1895 _1896 _1897 _1898 _1899 _1900 _1901 _1906 _1907 _1912 _1913 _1926 _1927 _1932 _1933 _1938 _1939 _1940 _1941 _1942 _1943 _1944 _1945 _1946 _1947 _1948 _1962 _1963 _1964 _1965 _1966 _1967 _1968 _1969 _1970 _1971 _1974 _1979 _1980 _1981 _1982 _1987 _1988 _1989 _1990 _1993 _1994 _1995 _1996 _1997 _1998 _1999 _2000 _2001 _2002 _2003 _2012 _2013 _2014 _2045 _2054 _2055 _2056 _2057 _2058 _2059 _2060 _2061 _2062 _2063 _2064 _2065 _2066 _2067 _2068 _2069 _2070 _2071 _2072 _2073 _2074 _2075 _2076 _2077 _2078 _2079 _2080 _2081 _2082 _2083 _2084 _2085 _2086 _2087 _2088 _2089 _2090 _2091 _2092 _2093 _2094 _2095 _2096 _2097 _2098 _2099 _2100 _2106 _2107 _2148 _2149 _2150 _2168 _2169 _2209 _2211 _2212 _2213 _2274 _2287 _2296 _2313 _2314 _2319 _2321 _2322 _2323 _2330 _2331 _2332 _2455 _2456 _2457 _2458 _2459 _2460 _2461 _2462 _2463 _2465 _2467 _2469 _2471 _2473 _2475 _2477 _2479 _2481 _2483 _2485 _2487 _2489 _2491 _2493 _2495 _2497 _2499 _2501 _2503 _2505 _2507 _2509 _2511 _2513 _2515 _2516 _2521 _2522 _2523 _2524 _2525 _2526 _2527 _2528 _2529 _2530 _2531 _2532 _2533 _2534 _2536 _2537 _2538 _2539 _2540 _2541 _2542 _2543 _2544 _2546 _2548 _2567 _2568 _2569 _2570 _2571 _2572 _2573 _2574 _2575 _2638 _2639 _2640 _2641 _2642 _2643 _2644 _2653 _2654 _2655 " mangled="_Z3std" demangled="std"/> - <Function id="_3" name="_GLOBAL__D__home_roman_pygccxml_sources_sources_pyplusplus_dev_examples_pyboost_dev_dev_date_time_include_date_time.pypp.hppB25SPb" returns="_1154" context="_1" location="f0:131" file="f0" line="131" endline="131"/> - <Function id="_4" name="_GLOBAL__I__home_roman_pygccxml_sources_sources_pyplusplus_dev_examples_pyboost_dev_dev_date_time_include_date_time.pypp.hppB25SPb" returns="_1154" context="_1" location="f0:131" file="f0" line="131" endline="131"/> + <Function id="_3" name="_GLOBAL__D__home_roman_pygccxml_sources_sources_pyplusplus_dev_examples_pyboost_dev_dev_date_time_include_date_time.pypp.hpp5J35cd" returns="_1154" context="_1" location="f0:131" file="f0" line="131" endline="131"/> + <Function id="_4" name="_GLOBAL__I__home_roman_pygccxml_sources_sources_pyplusplus_dev_examples_pyboost_dev_dev_date_time_include_date_time.pypp.hpp5J35cd" returns="_1154" context="_1" location="f0:131" file="f0" line="131" endline="131"/> <Variable id="_5" name="_ZGVN5boost9date_time10date_facetINS_9gregorian4dateEcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE2idE" type="_1248" context="_1" location="f1:372" file="f1" line="372" artificial="1"/> <Function id="_6" name="__static_initialization_and_destruction_0" returns="_1154" context="_1" mangled="_Z41__static_initialization_and_destruction_0ii" demangled="__static_initialization_and_destruction_0(int, int)" location="f0:131" file="f0" line="131" endline="76"> <Argument name="__initialize_p" type="_500" location="f0:131" file="f0" line="131"/> Modified: pyplusplus_dev/pyplusplus/code_creators/__init__.py =================================================================== --- pyplusplus_dev/pyplusplus/code_creators/__init__.py 2006-06-17 18:09:21 UTC (rev 220) +++ pyplusplus_dev/pyplusplus/code_creators/__init__.py 2006-06-17 18:11:32 UTC (rev 221) @@ -88,6 +88,7 @@ from class_declaration import class_t from class_declaration import class_wrapper_t +from class_declaration import class_declaration_t from instruction import instruction_t Modified: pyplusplus_dev/pyplusplus/code_creators/class_declaration.py =================================================================== --- pyplusplus_dev/pyplusplus/code_creators/class_declaration.py 2006-06-17 18:09:21 UTC (rev 220) +++ pyplusplus_dev/pyplusplus/code_creators/class_declaration.py 2006-06-17 18:11:32 UTC (rev 221) @@ -12,10 +12,71 @@ import smart_pointers import declaration_based import array_1_registrator -import indexing_suites import member_variable from pygccxml import declarations +class class_declaration_t( scoped.scoped_t ): + def __init__(self, class_inst, parent=None ): + scoped.scoped_t.__init__( self + , parent=parent + , declaration=class_inst ) + + def _generate_class_definition(self): + class_identifier = algorithm.create_identifier( self, '::boost::python::class_' ) + return declarations.templates.join( class_identifier, [self.decl_identifier] ) + + def _generate_code_no_scope(self): + result = [] + result.append( self._generate_class_definition() ) + for x in self.creators: + code = x.create() + tmpl = '%s.%s' + if self.is_comment( code ): + tmpl = '%s%s' + result.append( self.indent( tmpl % ( os.linesep, code ) ) ) + result.append( ';' ) + return ''.join( result ) + + def _get_class_var_name(self): + return self.alias + '_exposer' + class_var_name = property( _get_class_var_name ) + + def _generate_code_with_scope(self): + result = [] + scope_var_name = self.alias + '_scope' + typedef_name = self.class_var_name + '_t' + result.append( 'typedef ' + self._generate_class_definition() + ' ' + typedef_name + ';') + result.append( typedef_name + ' ' + self.class_var_name ) + result[-1] = result[-1] + ' = '+ typedef_name + '();' + + result.append( algorithm.create_identifier( self, '::boost::python::scope' ) ) + result[-1] = result[-1] + ' ' + scope_var_name + result[-1] = result[-1] + '( %s );' % self.class_var_name + + for x in self.creators: + if not ( x is used_init ): + if self._should_creator_be_exported_under_scope( x ): + result.append( x.create() ) + elif isinstance( x, custom.custom_t ) and x.works_on_instance == False: + result.append( '%s;' % x.create() ) + else: + result.append( '%s.%s;' % ( self.class_var_name, x.create() ) ) + + code = os.linesep.join( result ) + + result = [ 'if( true ){' ] + result.append( self.indent( code ) ) + result.append( '}' ) + + return os.linesep.join( result ) + + def _create_impl(self): + if self.declaration.always_expose_using_scope: + return self._generate_code_with_scope() + else: + return self._generate_code_no_scope() + + class class_t( scoped.scoped_t ): """ Creates boost.python code that needed to export a class @@ -146,6 +207,8 @@ used_init = inits[0] result.append( ", " ) result.append( used_init.create_init_code() ) + elif self.declaration.indexing_suite: + pass #in this case all constructors are exposed by indexing suite else:#it is possible to class to have public accessed constructor #that could not be exported by boost.python library #for example constructor takes as argument pointer to function @@ -187,9 +250,6 @@ if isinstance( inst, array_1_registrator.array_1_registrator_t ): return True - if isinstance( inst, indexing_suites.indexing_suite_t ): - return True - if isinstance( inst, member_variable.mem_var_ref_t ): return True Modified: pyplusplus_dev/pyplusplus/code_creators/indexing_suites.py =================================================================== --- pyplusplus_dev/pyplusplus/code_creators/indexing_suites.py 2006-06-17 18:09:21 UTC (rev 220) +++ pyplusplus_dev/pyplusplus/code_creators/indexing_suites.py 2006-06-17 18:11:32 UTC (rev 221) @@ -5,26 +5,22 @@ import os import types -import scoped -import custom -import calldef import algorithm -import smart_pointers -import declaration_based -import array_1_registrator +import code_creator from pygccxml import declarations -class indexing_suite_t( scoped.scoped_t ): - def __init__(self, class_inst, suite_configuration, parent=None ): - scoped.scoped_t.__init__( self - , parent=parent - , declaration=class_inst ) - self._suite_configuration = suite_configuration +class indexing_suite_t( code_creator.code_creator_t ): + def __init__(self, parent=None ): + code_creator.code_creator_t.__init__( self, parent=parent ) - def _get_suite_configuration( self ): - return self._suite_configuration - suite_configuration = property( _get_suite_configuration ) + def _get_configuration( self ): + return self.parent.declaration.indexing_suite + configuration = property( _get_configuration ) + def _get_container( self ): + return self.parent.declaration + container = property( _get_container ) + class vector_indexing_suite_t( indexing_suite_t ): """ Creates boost.python code that needed to export a vector of some class @@ -33,39 +29,24 @@ # .def(vector_indexing_suite<std::vector<X> >()) #; - def __init__(self, class_inst, suite_configuration, parent=None ): - indexing_suite_t.__init__( self - , class_inst=class_inst - , suite_configuration=suite_configuration - , parent=parent ) + def __init__(self, parent=None ): + indexing_suite_t.__init__( self, parent=parent ) def _create_indexing_suite_declaration( self ): vector_indexing_suite = algorithm.create_identifier( self, 'boost::python::vector_indexing_suite' ) - container_identifier = algorithm.create_identifier( self, self.suite_configuration.container ) - container = declarations.templates.join( container_identifier, [ self.decl_identifier ] ) - args = [container] - if self.suite_configuration.derived_policies: - if self.suite_configuration.no_proxy: + args = [ self.container.decl_string ] + if self.configuration.derived_policies: + if self.configuration.no_proxy: args.append( 'true' ) else: args.append( 'false' ) - args.append( self.suite_configuration.derived_policies ) + args.append( self.configuration.derived_policies ) else: - if self.suite_configuration.no_proxy: + if self.configuration.no_proxy: args.append( 'true' ) return declarations.templates.join( vector_indexing_suite, args ) - def _create_class_declaration( self ): - class_ = algorithm.create_identifier( self, 'boost::python::class_' ) - container_identifier = algorithm.create_identifier( self, self.suite_configuration.container ) - container = declarations.templates.join( container_identifier, [ self.decl_identifier ] ) - return declarations.templates.join( class_, [ container ] ) - def _create_impl(self): - result = [] - result.append( self._create_class_declaration() + '("%s")' % self.suite_configuration.name ) - result.append( self.indent( ".def( %s() )" % self._create_indexing_suite_declaration() ) ) - result.append( ';' ) - return os.linesep.join( result ) - + return "def( %s() )" % self._create_indexing_suite_declaration() + \ No newline at end of file Modified: pyplusplus_dev/pyplusplus/decl_wrappers/__init__.py =================================================================== --- pyplusplus_dev/pyplusplus/decl_wrappers/__init__.py 2006-06-17 18:09:21 UTC (rev 220) +++ pyplusplus_dev/pyplusplus/decl_wrappers/__init__.py 2006-06-17 18:11:32 UTC (rev 221) @@ -44,7 +44,6 @@ from calldef_wrapper import free_function_t from calldef_wrapper import free_operator_t -from class_wrapper import vector_indexing_suite_t from class_wrapper import class_declaration_t from class_wrapper import class_t @@ -58,8 +57,6 @@ from scopedef_wrapper import scopedef_t - - from pygccxml import declarations from call_policies import call_policy_t @@ -89,6 +86,10 @@ from user_text import user_text_t from user_text import class_user_text_t +from indexing_suite import indexing_suite_t +from indexing_suite import vector_suite_t + + class dwfactory_t( declarations.decl_factory_t ): """ declarations factory class Modified: pyplusplus_dev/pyplusplus/decl_wrappers/class_wrapper.py =================================================================== --- pyplusplus_dev/pyplusplus/decl_wrappers/class_wrapper.py 2006-06-17 18:09:21 UTC (rev 220) +++ pyplusplus_dev/pyplusplus/decl_wrappers/class_wrapper.py 2006-06-17 18:11:32 UTC (rev 221) @@ -3,24 +3,37 @@ # accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) +import user_text import decl_wrapper import scopedef_wrapper from pygccxml import declarations -import user_text +import indexing_suite as container_suites + + +def guess_indexing_suite( class_ ): + if declarations.vector_traits.is_vector( class_ ): + return container_suites.vector_suite_t( class_ ) -class vector_indexing_suite_t( object ): - def __init__( self, name, container='std::vector', no_proxy=False, derived_policies='' ): - object.__init__( self ) - self.name = name - self.container = container - self.no_proxy = no_proxy - self.derived_policies = derived_policies - +#this will only be exported if indexing suite is not None and only when needed class class_declaration_t(decl_wrapper.decl_wrapper_t, declarations.class_declaration_t): def __init__(self, *arguments, **keywords): declarations.class_declaration_t.__init__(self, *arguments, **keywords ) decl_wrapper.decl_wrapper_t.__init__( self ) + self._always_expose_using_scope = False + self._indexing_suite = None + def _get_always_expose_using_scope( self ): + return self._always_expose_using_scope + def _set_always_expose_using_scope( self, value ): + self._always_expose_using_scope = value + always_expose_using_scope = property( _get_always_expose_using_scope, _set_always_expose_using_scope ) + + def _get_indexing_suite( self ): + if self._indexing_suite is None: + self._indexing_suite = guess_indexing_suite( self ) + return self._indexing_suite + indexing_suite = property( _get_indexing_suite ) + class class_t(scopedef_wrapper.scopedef_t, declarations.class_t): def __init__(self, *arguments, **keywords): declarations.class_t.__init__(self, *arguments, **keywords ) @@ -33,7 +46,7 @@ self._wrapper_alias = self._generate_valid_name() + "_wrapper" self._user_code = [] self._wrapper_user_code = [] - self._indexing_suites = [] + self._indexing_suite = None def _get_always_expose_using_scope( self ): return self._always_expose_using_scope @@ -89,11 +102,11 @@ self._wrapper_user_code = value wrapper_user_code = property( _get_wrapper_user_code, _set_wrapper_user_code ) - def _get_indexing_suites( self ): - return self._indexing_suites - def _set_indexing_suites( self, value ): - self._indexing_suites = value - indexing_suites = property( _get_indexing_suites, _set_indexing_suites ) + def _get_indexing_suite( self ): + if self._indexing_suite is None: + self._indexing_suite = guess_indexing_suite( self ) + return self._indexing_suite + indexing_suite = property( _get_indexing_suite ) def add_code( self, code, works_on_instance=True ): """works_on_instance: If true, the custom code can be applied directly to obj inst. Modified: pyplusplus_dev/pyplusplus/decl_wrappers/indexing_suite.py =================================================================== --- pyplusplus_dev/pyplusplus/decl_wrappers/indexing_suite.py 2006-06-17 18:09:21 UTC (rev 220) +++ pyplusplus_dev/pyplusplus/decl_wrappers/indexing_suite.py 2006-06-17 18:11:32 UTC (rev 221) @@ -17,23 +17,47 @@ # 5. shared_ptr class indexing_suite_t( object ): - def __init__( self, no_proxy=None, derived_policies=None ): + def __init__( self, container_class, no_proxy=None, derived_policies=None ): object.__init__( self ) self.__no_proxy = no_proxy self.__derived_policies = None + self.__container_class = container_class + def _get_container_class( self ): + return self.__container_class + container_class = property( _get_container_class ) + def value_type(self): raise NotImplementedError() def _get_no_proxy( self ): if self.__no_proxy is None: value_type = self.value_type() - if declaration.is_fundamental( value_type ): + if declarations.is_fundamental( value_type ) \ + or declarations.is_enum( value_type ) \ + or declarations.is_std_string( value_type ) \ + or declarations.is_std_wstring( value_type ) \ + or declarations.smart_pointer_traits.is_smart_pointer( value_type ): self.__no_proxy = True - elif declarations.is_enum( value_type ): - self.__no_proxy = True + else: + self.__no_proxy = False + return self.__no_proxy + def _set_no_proxy( self, no_proxy ): + self.__no_proxy = no_proxy + + no_proxy = property( _get_no_proxy, _set_no_proxy ) - - - \ No newline at end of file + def _get_derived_policies( self ): + return self.__derived_policies + def _set_derived_policied( self, derived_policies ): + self.__derived_policies = derived_policies + derived_policies = property( _get_derived_policies, _set_derived_policied ) + + +class vector_suite_t( indexing_suite_t ): + def __init__( self, cls ): + indexing_suite_t.__init__( self, cls ) + + def value_type( self ): + return declarations.vector_traits.value_type( self.container_class ) Modified: pyplusplus_dev/pyplusplus/module_builder/__init__.py =================================================================== --- pyplusplus_dev/pyplusplus/module_builder/__init__.py 2006-06-17 18:09:21 UTC (rev 220) +++ pyplusplus_dev/pyplusplus/module_builder/__init__.py 2006-06-17 18:11:32 UTC (rev 221) @@ -43,8 +43,6 @@ from pyplusplus.decl_wrappers import variable_t from pyplusplus.decl_wrappers import scopedef_t -from pyplusplus.decl_wrappers import vector_indexing_suite_t - from pyplusplus.decl_wrappers import print_declarations import call_policies Modified: pyplusplus_dev/pyplusplus/module_creator/creator.py =================================================================== --- pyplusplus_dev/pyplusplus/module_creator/creator.py 2006-06-17 18:09:21 UTC (rev 220) +++ pyplusplus_dev/pyplusplus/module_creator/creator.py 2006-06-17 18:11:32 UTC (rev 221) @@ -352,6 +352,20 @@ else: pass + def _treat_indexing_suite( self ): + if self.__types_db.used_vectors: + header = "boost/python/suite/indexing/vector_indexing_suite.hpp" + self.__extmodule.add_system_header( header ) + self.__extmodule.add_include( header=header ) + for cls in self.__types_db.used_vectors: + cls_creator = None + if isinstance( cls, declarations.class_t ): + cls_creator = code_creators.class_t( class_inst=cls ) + else: + cls_creator = code_creators.class_declaration_t( class_inst=cls ) + cls_creator.adopt_creator( code_creators.vector_indexing_suite_t() ) + self.__module_body.adopt_creator( cls_creator ) + def create(self, decl_headers=None): """Create and return the module for the extension. @@ -372,6 +386,7 @@ for operator in self.__free_operators: self._adopt_free_operator( operator ) self._treat_smart_pointers() + self._treat_indexing_suite() for creator in code_creators.make_flatten( self.__extmodule ): creator.target_configuration = self.__target_configuration #last action. @@ -382,16 +397,10 @@ for cls in self.__decls: if not isinstance( cls, decl_wrappers.class_t ): continue - if cls.indexing_suites: - self.__extmodule.add_system_header( "boost/python/suite/indexing/vector_indexing_suite.hpp" ) - include = code_creators.include_t( header="boost/python/suite/indexing/vector_indexing_suite.hpp" ) - self.__extmodule.adopt_include(include) - break for fn in declarations.declaration_files( self.__decls ): include = code_creators.include_t( header=fn ) self.__extmodule.adopt_include(include) - def guess_functions_code_creators( self ): maker_cls = None fwrapper_cls = None @@ -544,14 +553,7 @@ def visit_class_declaration(self ): pass - - def register_indexing_suites(self, class_decl, class_code_creator): - for suite in class_decl.indexing_suites: - assert isinstance( suite, decl_wrappers.vector_indexing_suite_t ) - creator = code_creators.vector_indexing_suite_t( class_inst=class_decl - , suite_configuration=suite ) - class_code_creator.adopt_creator( creator ) - + def visit_class(self ): if self.curr_decl.ignore: return @@ -608,8 +610,6 @@ self.curr_decl = temp_curr_decl self.curr_code_creator = temp_curr_parent - self.register_indexing_suites( self.curr_decl, self.curr_code_creator ) - def visit_enumeration(self): if self.curr_decl.ignore: return Modified: pyplusplus_dev/pyplusplus/module_creator/types_database.py =================================================================== --- pyplusplus_dev/pyplusplus/module_creator/types_database.py 2006-06-17 18:09:21 UTC (rev 220) +++ pyplusplus_dev/pyplusplus/module_creator/types_database.py 2006-06-17 18:11:32 UTC (rev 221) @@ -16,7 +16,8 @@ self.__smart_ptrs = [ 'shared_ptr', 'auto_ptr' ] self.__fundamental_strs = declarations.FUNDAMENTAL_TYPES.keys() self.__normalize_data = [ ',', '<', '>', '*', '&', '(', ')', '::' ] - + self.__used_vectors = set() + def update( self, decl ): if isinstance( decl, declarations.calldef_t ): if not isinstance( decl, declarations.constructor_t ): @@ -45,8 +46,21 @@ answer = answer.replace( data + ' ', data ) answer = answer.replace( ' ' + data, data ) return answer.replace( ' ', ' ' ) + + def _update_containers_db( self, type ): + #will return True is type was treated + type = declarations.remove_alias( type ) + type = declarations.remove_pointer( type ) + type = declarations.remove_reference( type ) + may_be_vector = declarations.vector_traits.declaration_or_none( type ) + if not ( None is may_be_vector ): + self.__used_vectors.add( may_be_vector ) + return True + return False def _update_db( self, db, type_ ): + if self._update_containers_db( type_ ): + return decl_string = self._normalize( declarations.base_type( type_ ).decl_string ) if not templates.is_instantiation( decl_string ): return @@ -138,3 +152,7 @@ for db in dbs: self._print_single_db( db ) + def _get_used_vectors( self ): + return self.__used_vectors + used_vectors = property( _get_used_vectors ) + Modified: pyplusplus_dev/unittests/data/indexing_suites_to_be_exported.hpp =================================================================== --- pyplusplus_dev/unittests/data/indexing_suites_to_be_exported.hpp 2006-06-17 18:09:21 UTC (rev 220) +++ pyplusplus_dev/unittests/data/indexing_suites_to_be_exported.hpp 2006-06-17 18:11:32 UTC (rev 221) @@ -24,6 +24,8 @@ int value; }; + +typedef std::vector<item_t> items_t; inline item_t get_value( const std::vector<item_t>& vec, unsigned int index ){ return vec.at(index); @@ -34,6 +36,9 @@ vec[index] = value; } +typedef std::vector<int> ivector; +ivector empty_ivector(){ return ivector(); } + } #endif//__indexing_suites_to_be_exported_hpp__ Modified: pyplusplus_dev/unittests/indexing_suites_tester.py =================================================================== --- pyplusplus_dev/unittests/indexing_suites_tester.py 2006-06-17 18:09:21 UTC (rev 220) +++ pyplusplus_dev/unittests/indexing_suites_tester.py 2006-06-17 18:11:32 UTC (rev 221) @@ -7,6 +7,7 @@ import sys import unittest import fundamental_tester_base +from pygccxml import declarations from pyplusplus import module_builder @@ -18,10 +19,20 @@ self , tester_t.EXTENSION_NAME , *args ) + + @staticmethod + def matcher( item, decl ): + if not declarations.vector_traits.is_vector( decl ): + return False + value_type = declarations.vector_traits.value_type(decl) + if item is value_type: + return True + return False def customize(self, generator): - item_cls = generator.class_( 'item_t' ) - item_cls.indexing_suites.append( module_builder.vector_indexing_suite_t( 'items_t' ) ) + item = generator.class_( 'item_t' ) + items = generator.class_( lambda decl: self.matcher( item, decl ) ) + items.alias = "items_t" def run_tests( self, module): items = module.items_t() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-06-17 18:11:40
|
Revision: 220 Author: roman_yakovenko Date: 2006-06-17 11:09:21 -0700 (Sat, 17 Jun 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=220&view=rev Log Message: ----------- fixing small bug in vector_traits Modified Paths: -------------- pygccxml_dev/pygccxml/declarations/cpptypes.py pygccxml_dev/pygccxml/declarations/filters.py pygccxml_dev/pygccxml/declarations/type_traits.py Modified: pygccxml_dev/pygccxml/declarations/cpptypes.py =================================================================== --- pygccxml_dev/pygccxml/declarations/cpptypes.py 2006-06-17 06:29:46 UTC (rev 219) +++ pygccxml_dev/pygccxml/declarations/cpptypes.py 2006-06-17 18:09:21 UTC (rev 220) @@ -466,8 +466,11 @@ has_const_str = '' if has_const: has_const_str = 'const' + return_type_decl_string = '' + if return_type: + return_type_decl_string = return_type.decl_string return member_function_type_t.NAME_TEMPLATE % { - 'return_type' : return_type.decl_string + 'return_type' : return_type_decl_string , 'class' : class_decl_string , 'arguments' : ','.join( map( lambda x: x.decl_string, arguments_types ) ) , 'has_const' : has_const_str } Modified: pygccxml_dev/pygccxml/declarations/filters.py =================================================================== --- pygccxml_dev/pygccxml/declarations/filters.py 2006-06-17 06:29:46 UTC (rev 219) +++ pygccxml_dev/pygccxml/declarations/filters.py 2006-06-17 18:09:21 UTC (rev 220) @@ -201,7 +201,9 @@ if not None is self.decl_type: if not isinstance( decl, self.decl_type ): return False - if not None is self.name: + if not None is self.name: + if 'SubMeshLodGeometryLink' in decl.decl_string: + i = 0 if not self.check_name( decl ): return False if not None is self.header_dir and decl.location: Modified: pygccxml_dev/pygccxml/declarations/type_traits.py =================================================================== --- pygccxml_dev/pygccxml/declarations/type_traits.py 2006-06-17 06:29:46 UTC (rev 219) +++ pygccxml_dev/pygccxml/declarations/type_traits.py 2006-06-17 18:09:21 UTC (rev 220) @@ -805,7 +805,11 @@ return remove_declarated( cls.typedef( "value_type" ).type ) else: value_type_str = templates.args( cls.name )[0] - found = cls.top_parent.classes( value_type_str, allow_empty=True ) + if not value_type_str.startswith( '::' ): + value_type_str = '::' + value_type_str + found = cls.top_parent.decls( name=value_type_str + , function=lambda decl: not isinstance( decl, calldef.calldef_t ) + , allow_empty=True ) if not found: if cpptypes.FUNDAMENTAL_TYPES.has_key( value_type_str ): return cpptypes.FUNDAMENTAL_TYPES[value_type_str] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-06-17 06:29:54
|
Revision: 219 Author: roman_yakovenko Date: 2006-06-16 23:29:46 -0700 (Fri, 16 Jun 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=219&view=rev Log Message: ----------- fixing small bug Modified Paths: -------------- pygccxml_dev/pygccxml/declarations/type_traits.py Modified: pygccxml_dev/pygccxml/declarations/type_traits.py =================================================================== --- pygccxml_dev/pygccxml/declarations/type_traits.py 2006-06-13 12:24:40 UTC (rev 218) +++ pygccxml_dev/pygccxml/declarations/type_traits.py 2006-06-17 06:29:46 UTC (rev 219) @@ -820,6 +820,8 @@ type = remove_alias( type ) type = remove_cv( type ) type = remove_declarated( type ) + if not isinstance( type, ( class_declaration.class_declaration_t, class_declaration.class_t ) ): + return False if not is_defined_in_xxx( 'boost', type ): return False return type.decl_string.startswith( '::boost::shared_ptr<' ) @@ -832,7 +834,9 @@ cls = remove_cv( type ) cls = remove_declarated( type ) if isinstance( cls, class_declaration.class_t ): - return remove_declarated( cls.typedef( "value_type" ).type ) + return remove_declarated( cls.typedef( "value_type" ).type ) + elif not isinstance( cls, ( class_declaration.class_declaration_t, class_declaration.class_t ) ): + raise RuntimeError( "Unable to find out shared_ptr value type. shared_ptr class is: %s" % cls.decl_string ) else: value_type_str = templates.args( cls.name )[0] found = cls.top_parent.classes( value_type_str, allow_empty=True ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-06-13 12:24:46
|
Revision: 218 Author: roman_yakovenko Date: 2006-06-13 05:24:40 -0700 (Tue, 13 Jun 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=218&view=rev Log Message: ----------- adding new type traits: vector and smart pointer Modified Paths: -------------- pygccxml_dev/pygccxml/declarations/type_traits.py Modified: pygccxml_dev/pygccxml/declarations/type_traits.py =================================================================== --- pygccxml_dev/pygccxml/declarations/type_traits.py 2006-06-08 07:02:03 UTC (rev 217) +++ pygccxml_dev/pygccxml/declarations/type_traits.py 2006-06-13 12:24:40 UTC (rev 218) @@ -762,11 +762,15 @@ """returns reference to the class declaration or None""" type = remove_alias( type ) type = remove_cv( type ) - if not isinstance( type, cpptypes.declarated_t ): - return - cls = remove_alias( type.declaration ) - if not isinstance( cls, ( class_declaration.class_t, class_declaration.class_declaration_t ) ): + cls = None + if isinstance( type, cpptypes.declarated_t ): + cls = remove_alias( type.declaration ) + elif isinstance( type, class_declaration.class_t ): + cls = type + elif isinstance( type, class_declaration.class_declaration_t ): + cls = type + else: return if not cls.name.startswith( 'vector<' ): @@ -798,7 +802,7 @@ """returns reference to value_type of the vector""" cls = vector_traits.class_declaration( type ) if isinstance( cls, class_declaration.class_t ): - return cls.typedef( "value_type" ).type + return remove_declarated( cls.typedef( "value_type" ).type ) else: value_type_str = templates.args( cls.name )[0] found = cls.top_parent.classes( value_type_str, allow_empty=True ) @@ -815,6 +819,7 @@ def is_smart_pointer( type ): type = remove_alias( type ) type = remove_cv( type ) + type = remove_declarated( type ) if not is_defined_in_xxx( 'boost', type ): return False return type.decl_string.startswith( '::boost::shared_ptr<' ) @@ -824,9 +829,10 @@ if not smart_pointer_traits.is_smart_pointer( type ): raise TypeError( 'Type "%s" is not instantiation of boost::shared_ptr' % type.decl_string ) type = remove_alias( type ) - cls = remove_cv( type ) + cls = remove_cv( type ) + cls = remove_declarated( type ) if isinstance( cls, class_declaration.class_t ): - return cls.typedef( "value_type" ).type + return remove_declarated( cls.typedef( "value_type" ).type ) else: value_type_str = templates.args( cls.name )[0] found = cls.top_parent.classes( value_type_str, allow_empty=True ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-06-08 10:42:51
|
Revision: 217 Author: roman_yakovenko Date: 2006-06-08 00:02:03 -0700 (Thu, 08 Jun 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=217&view=rev Log Message: ----------- adding is_std_[w]string traits Modified Paths: -------------- pygccxml_dev/pygccxml/declarations/__init__.py pygccxml_dev/pygccxml/declarations/type_traits.py pygccxml_dev/unittests/test_all.py Added Paths: ----------- pygccxml_dev/unittests/data/string_traits.hpp pygccxml_dev/unittests/string_traits_tester.py Modified: pygccxml_dev/pygccxml/declarations/__init__.py =================================================================== --- pygccxml_dev/pygccxml/declarations/__init__.py 2006-06-08 05:52:33 UTC (rev 216) +++ pygccxml_dev/pygccxml/declarations/__init__.py 2006-06-08 07:02:03 UTC (rev 217) @@ -119,6 +119,8 @@ from type_traits import is_base_and_derived from type_traits import is_convertible from type_traits import is_noncopyable +from type_traits import is_std_string +from type_traits import is_std_wstring from type_traits import is_unary_operator from type_traits import is_binary_operator @@ -142,8 +144,11 @@ from type_traits import find_trivial_constructor from type_traits import has_any_non_copyconstructor -from type_traits import vector_traits +from type_traits import vector_traits +from type_traits import smart_pointer_traits + + import templates import call_invocation Modified: pygccxml_dev/pygccxml/declarations/type_traits.py =================================================================== --- pygccxml_dev/pygccxml/declarations/type_traits.py 2006-06-08 05:52:33 UTC (rev 216) +++ pygccxml_dev/pygccxml/declarations/type_traits.py 2006-06-08 07:02:03 UTC (rev 217) @@ -790,7 +790,7 @@ """returns reference to the class declaration, """ cls = vector_traits.declaration_or_none( type ) if not cls: - raise TypeError( 'Type "%s" is not instantiation ov std::vector' % type.decl_string ) + raise TypeError( 'Type "%s" is not instantiation of std::vector' % type.decl_string ) return cls @staticmethod @@ -809,14 +809,36 @@ return found[0] else: raise RuntimeError( "Unable to find out vector value type. vector class is: %s" % cls.decl_string ) - -def is_smart_pointer( type ): - type = remove_alias( type ) - type = remove_cv( type ) - if not is_defined_in_xxx( 'boost', type ): - return False - return type.decl_string.startswith( '::boost::shared_ptr<' ) - + +class smart_pointer_traits: + @staticmethod + def is_smart_pointer( type ): + type = remove_alias( type ) + type = remove_cv( type ) + if not is_defined_in_xxx( 'boost', type ): + return False + return type.decl_string.startswith( '::boost::shared_ptr<' ) + + @staticmethod + def value_type( type ): + if not smart_pointer_traits.is_smart_pointer( type ): + raise TypeError( 'Type "%s" is not instantiation of boost::shared_ptr' % type.decl_string ) + type = remove_alias( type ) + cls = remove_cv( type ) + if isinstance( cls, class_declaration.class_t ): + return cls.typedef( "value_type" ).type + else: + value_type_str = templates.args( cls.name )[0] + found = cls.top_parent.classes( value_type_str, allow_empty=True ) + if not found: + if cpptypes.FUNDAMENTAL_TYPES.has_key( value_type_str ): + return cpptypes.FUNDAMENTAL_TYPES[value_type_str] + if len( found ) == 1: + return found[0] + else: + raise RuntimeError( "Unable to find out shared_ptr value type. shared_ptr class is: %s" % cls.decl_string ) + + def is_std_string( type ): decl_strings = [ '::std::basic_string<char,std::char_traits<char>,std::allocator<char> >' Added: pygccxml_dev/unittests/data/string_traits.hpp =================================================================== --- pygccxml_dev/unittests/data/string_traits.hpp (rev 0) +++ pygccxml_dev/unittests/data/string_traits.hpp 2006-06-08 07:02:03 UTC (rev 217) @@ -0,0 +1,32 @@ +// Copyright 2004 Roman Yakovenko. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include <string> + +namespace string_traits{ +namespace yes{ + typedef std::string x1; + typedef const std::string x2; +} + +namespace no{ + typedef int x1; + typedef std::string& x2; +} + +} + +namespace wstring_traits{ +namespace yes{ + typedef std::wstring x1; + typedef const std::wstring x2; +} + +namespace no{ + typedef int x1; + typedef std::wstring& x2; +} + +} \ No newline at end of file Added: pygccxml_dev/unittests/string_traits_tester.py =================================================================== --- pygccxml_dev/unittests/string_traits_tester.py (rev 0) +++ pygccxml_dev/unittests/string_traits_tester.py 2006-06-08 07:02:03 UTC (rev 217) @@ -0,0 +1,55 @@ +# Copyright 2004 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +import unittest +import autoconfig +import parser_test_case + +from pygccxml import utils +from pygccxml import parser +from pygccxml import declarations + +class tester_t( parser_test_case.parser_test_case_t ): + COMPILATION_MODE = parser.COMPILATION_MODE.ALL_AT_ONCE + global_ns = None + def __init__(self, *args ): + parser_test_case.parser_test_case_t.__init__( self, *args ) + self.header = 'string_traits.hpp' + self.global_ns = None + + def setUp(self): + if not tester_t.global_ns: + decls = parser.parse( [self.header], self.config ) + tester_t.global_ns = declarations.get_global_namespace( decls ) + self.global_ns = tester_t.global_ns + + def validate_yes( self, ns, controller ): + for typedef in ns.typedefs(): + self.failUnless( controller( typedef.type ) ) + + def validate_no( self, ns, controller ): + for typedef in ns.typedefs(): + self.failUnless( not controller( typedef.type ) ) + + def test_string( self ): + string_traits = self.global_ns.namespace( 'string_traits' ) + self.validate_yes( string_traits.namespace( 'yes' ), declarations.is_std_string ) + self.validate_no( string_traits.namespace( 'no' ), declarations.is_std_string ) + + def test_wstring( self ): + wstring_traits = self.global_ns.namespace( 'wstring_traits' ) + self.validate_yes( wstring_traits.namespace( 'yes' ), declarations.is_std_wstring ) + self.validate_no( wstring_traits.namespace( 'no' ), declarations.is_std_wstring ) + +def create_suite(): + suite = unittest.TestSuite() + suite.addTest( unittest.makeSuite(tester_t)) + return suite + +def run_suite(): + unittest.TextTestRunner(verbosity=2).run( create_suite() ) + +if __name__ == "__main__": + run_suite() \ No newline at end of file Modified: pygccxml_dev/unittests/test_all.py =================================================================== --- pygccxml_dev/unittests/test_all.py 2006-06-08 05:52:33 UTC (rev 216) +++ pygccxml_dev/unittests/test_all.py 2006-06-08 07:02:03 UTC (rev 217) @@ -35,6 +35,8 @@ import demangled_tester import unnamed_enums_bug_tester import vector_traits_tester +import string_traits_tester + def create_suite(): testers = [ @@ -68,7 +70,8 @@ , typedefs_tester , demangled_tester , unnamed_enums_bug_tester - , vector_traits_tester + , vector_traits_tester + , string_traits_tester ] main_suite = unittest.TestSuite() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |