@@ -29,7 +29,7 @@ def normalize(self, type_str):
2929 return type_str .replace (' ' , '' )
3030
3131 def replace_basic_string (self , cls_name ):
32-
32+ print ( "replace_basic_string" , cls_name )
3333 # Take the lists of all possible string variations
3434 # and clean them up by replacing ::std by std.
3535 str_eq = [
@@ -72,7 +72,7 @@ def decorated_call_suffix(self, cls_name, text, doit):
7272 def erase_call (self , cls_name ):
7373 c_traits = find_container_traits (cls_name )
7474 if not c_traits :
75- return cls_name
75+ return None
7676 return c_traits .remove_defaults (cls_name )
7777
7878 def no_std (self , cls_name ):
@@ -99,10 +99,13 @@ def erase_recursive(self, cls_name):
9999 return self .no_end_const (cls_name )
100100
101101 def erase_allocator (self , cls_name , default_allocator = 'std::allocator' ):
102+ print ("erase_allocator" , cls_name )
102103 cls_name = self .replace_basic_string (cls_name )
104+ print ("erase_allocator" , cls_name )
103105 c_name , c_args = templates .split (cls_name )
106+ print ("c_name, c_args" , c_name , c_args )
104107 if len (c_args ) != 2 :
105- return
108+ return None
106109 value_type = c_args [0 ]
107110 tmpl = string .Template (
108111 "$container< $value_type, $allocator<$value_type> >" )
@@ -112,19 +115,24 @@ def erase_allocator(self, cls_name, default_allocator='std::allocator'):
112115 allocator = default_allocator )
113116 if self .normalize (cls_name ) == \
114117 self .normalize (tmpl ):
115- return templates .join (
118+ result = templates .join (
116119 c_name , [self .erase_recursive (value_type )])
120+ print ("result" , result )
121+ print ("c_name" , c_name )
122+ print ("value_type" , value_type )
123+ print ("erase" , self .erase_recursive (value_type ))
124+ return result
117125
118126 def erase_container (self , cls_name , default_container_name = 'std::deque' ):
119127 cls_name = self .replace_basic_string (cls_name )
120128 c_name , c_args = templates .split (cls_name )
121129 if len (c_args ) != 2 :
122- return
130+ return None
123131 value_type = c_args [0 ]
124132 dc_no_defaults = self .erase_recursive (c_args [1 ])
125133 if self .normalize (dc_no_defaults ) != self .normalize (
126134 templates .join (default_container_name , [value_type ])):
127- return
135+ return None
128136 return templates .join (
129137 c_name , [self .erase_recursive (value_type )])
130138
@@ -136,7 +144,7 @@ def erase_container_compare(
136144 cls_name = self .replace_basic_string (cls_name )
137145 c_name , c_args = templates .split (cls_name )
138146 if len (c_args ) != 3 :
139- return
147+ return None
140148 dc_no_defaults = self .erase_recursive (c_args [1 ])
141149 if self .normalize (dc_no_defaults ) != self .normalize (
142150 templates .join (default_container_name , [c_args [0 ]])):
@@ -156,7 +164,7 @@ def erase_compare_allocator(
156164 cls_name = self .replace_basic_string (cls_name )
157165 c_name , c_args = templates .split (cls_name )
158166 if len (c_args ) != 3 :
159- return
167+ return None
160168 value_type = c_args [0 ]
161169 tmpl = string .Template (
162170 "$container< $value_type, $compare<$value_type>, " +
@@ -179,7 +187,7 @@ def erase_map_compare_allocator(
179187 cls_name = self .replace_basic_string (cls_name )
180188 c_name , c_args = templates .split (cls_name )
181189 if len (c_args ) != 4 :
182- return
190+ return None
183191 key_type = c_args [0 ]
184192 mapped_type = c_args [1 ]
185193 tmpls = [
@@ -209,7 +217,7 @@ def erase_hash_allocator(self, cls_name):
209217 cls_name = self .replace_basic_string (cls_name )
210218 c_name , c_args = templates .split (cls_name )
211219 if len (c_args ) < 3 :
212- return
220+ return None
213221
214222 default_less = 'std::less'
215223 default_equal_to = 'std::equal_to'
@@ -226,7 +234,7 @@ def erase_hash_allocator(self, cls_name):
226234 "$container< $value_type, $hash<$value_type >, " +
227235 "$equal_to<$value_type >, $allocator<$value_type> >" )
228236 else :
229- return
237+ return None
230238
231239 value_type = c_args [0 ]
232240 template = string .Template (tmpl )
@@ -258,7 +266,7 @@ def erase_hashmap_compare_allocator(self, cls_name):
258266 key_type = c_args [0 ]
259267 mapped_type = c_args [1 ]
260268 else :
261- return
269+ return None
262270
263271 if len (c_args ) == 4 :
264272 default_hash = 'hash_compare'
@@ -305,7 +313,7 @@ def erase_hashmap_compare_allocator(self, cls_name):
305313 "$equal_to<$key_type>, " +
306314 "$allocator< $mapped_type > >" )
307315 else :
308- return
316+ return None
309317
310318 for ns in std_namespaces :
311319 inst = tmpl .substitute (
@@ -520,14 +528,13 @@ def remove_defaults(self, type_or_string):
520528 std::vector< int >
521529
522530 """
523-
524531 name = type_or_string
525532 if not isinstance (type_or_string , str ):
526533 name = self .class_declaration (type_or_string ).name
527534 if not self .remove_defaults_impl :
528535 return name
529536 no_defaults = self .remove_defaults_impl (name )
530- if not no_defaults :
537+ if no_defaults is None :
531538 return name
532539 return no_defaults
533540
0 commit comments