From bd4a882df9f517a0b45c1ae042edc4892354face Mon Sep 17 00:00:00 2001 From: Mark Moll Date: Wed, 19 May 2021 09:02:29 -0700 Subject: [PATCH] make type equivalence check for string and ostream more robust --- pygccxml/declarations/type_traits.py | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/pygccxml/declarations/type_traits.py b/pygccxml/declarations/type_traits.py index a9b79f0b..eef8fe7a 100644 --- a/pygccxml/declarations/type_traits.py +++ b/pygccxml/declarations/type_traits.py @@ -483,29 +483,21 @@ def is_fundamental(type_): string_equivalences = [ ( '::std::basic_string,' - 'std::allocator >'), - ( - '::std::basic_string, ' - 'std::allocator >'), + 'std::allocator>'), '::std::basic_string', '::std::string'] wstring_equivalences = [ ( '::std::basic_string,' + - 'std::allocator >'), - ( - '::std::basic_string, ' + - 'std::allocator >'), + 'std::allocator>'), '::std::basic_string', '::std::wstring'] ostream_equivalences = [ - '::std::basic_ostream >', - '::std::basic_ostream >', + '::std::basic_ostream>', '::std::basic_ostream', '::std::ostream'] wostream_equivalences = [ - '::std::basic_ostream >', - '::std::basic_ostream >', + '::std::basic_ostream>', '::std::basic_ostream', '::std::wostream'] @@ -521,7 +513,7 @@ def is_std_string(type_): type_ = remove_alias(type_) type_ = remove_reference(type_) type_ = remove_cv(type_) - return type_.decl_string in string_equivalences + return type_.decl_string.replace(' ', '') in string_equivalences def is_std_wstring(type_): @@ -536,7 +528,7 @@ def is_std_wstring(type_): type_ = remove_alias(type_) type_ = remove_reference(type_) type_ = remove_cv(type_) - return type_.decl_string in wstring_equivalences + return type_.decl_string.replace(' ', '') in wstring_equivalences def is_std_ostream(type_): @@ -551,7 +543,7 @@ def is_std_ostream(type_): type_ = remove_alias(type_) type_ = remove_reference(type_) type_ = remove_cv(type_) - return type_.decl_string in ostream_equivalences + return type_.decl_string.replace(' ', '') in ostream_equivalences def is_std_wostream(type_): @@ -566,4 +558,4 @@ def is_std_wostream(type_): type_ = remove_alias(type_) type_ = remove_reference(type_) type_ = remove_cv(type_) - return type_.decl_string in wostream_equivalences + return type_.decl_string.replace(' ', '') in wostream_equivalences