Revision: 798
http://svn.sourceforge.net/pygccxml/?rev=798&view=rev
Author: roman_yakovenko
Date: 2006-12-13 23:04:27 -0800 (Wed, 13 Dec 2006)
Log Message:
-----------
improving the algorithm, which guesses container element type
Modified Paths:
--------------
pygccxml_dev/pygccxml/declarations/__init__.py
pygccxml_dev/pygccxml/declarations/class_declaration.py
pygccxml_dev/pygccxml/declarations/type_traits.py
Modified: pygccxml_dev/pygccxml/declarations/__init__.py
===================================================================
--- pygccxml_dev/pygccxml/declarations/__init__.py 2006-12-13 22:12:02 UTC (rev 797)
+++ pygccxml_dev/pygccxml/declarations/__init__.py 2006-12-14 07:04:27 UTC (rev 798)
@@ -18,9 +18,8 @@
from class_declaration import ACCESS_TYPES
from class_declaration import hierarchy_info_t
from class_declaration import class_declaration_t
+from class_declaration import class_types
-class_types = ( class_t, class_declaration_t )
-
from typedef import typedef_t
from cpptypes import type_t
Modified: pygccxml_dev/pygccxml/declarations/class_declaration.py
===================================================================
--- pygccxml_dev/pygccxml/declarations/class_declaration.py 2006-12-13 22:12:02 UTC (rev 797)
+++ pygccxml_dev/pygccxml/declarations/class_declaration.py 2006-12-14 07:04:27 UTC (rev 798)
@@ -356,3 +356,5 @@
, ACCESS_TYPES.ALL )
return answer
+
+class_types = ( class_t, class_declaration_t )
Modified: pygccxml_dev/pygccxml/declarations/type_traits.py
===================================================================
--- pygccxml_dev/pygccxml/declarations/type_traits.py 2006-12-13 22:12:02 UTC (rev 797)
+++ pygccxml_dev/pygccxml/declarations/type_traits.py 2006-12-14 07:04:27 UTC (rev 798)
@@ -898,9 +898,9 @@
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 not found:
+ if cpptypes.FUNDAMENTAL_TYPES.has_key( value_type_str[2:] ): #remove leading ::
+ return cpptypes.FUNDAMENTAL_TYPES[value_type_str[2:]]
elif is_std_string( value_type_str ):
string_ = global_ns.typedef( '::std::string' )
return remove_declarated( string_ )
@@ -908,7 +908,24 @@
string_ = global_ns.typedef( '::std::wstring' )
return remove_declarated( string_ )
else:
- return None
+ value_type_str = value_type_str[2:]#removing leading ::
+ has_const = value_type_str.startswith( 'const ' )
+ if has_const:
+ value_type_str = value_type_str[ len('const '): ]
+ has_pointer = value_type_str.endswith( '*' )
+ if has_pointer:
+ value_type_str = value_type_str[:-1]
+ found = impl_details.find_value_type( global_ns, value_type_str )
+ if not found:
+ return None
+ else:
+ if isinstance( found, class_declaration.class_types ):
+ found = cpptypes.declarated_t( found )
+ if has_const:
+ found = cpptypes.const_t( found )
+ if has_pointer:
+ found = cpptypes.pointer_t( found )
+ return found
if len( found ) == 1:
return found[0]
else:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|