1 from refractor
import framework
as rf
2 from string
import Formatter
5 "Convert a list of strings into a C++ vector of strings" 7 vec_str = rf.vector_string()
8 for str_val
in string_vals:
10 if isinstance(str_val, bytes):
11 str_val = str_val.decode(
"UTF-8")
12 elif not isinstance(str_val, str):
13 raise TypeError(
"Cannot add incompatible type to vector_string: %s" % str_val)
15 vec_str.push_back(str_val)
19 """An extended format string formatter 21 Formatter with extended conversion symbol 24 """ Extend conversion symbol 25 Following additional symbol has been added 26 * l: convert to string and low case 27 * u: convert to string and up case 30 * s: convert with str() 31 * r: convert with repr() 32 * a: convert with ascii() 36 return str(value).upper()
37 elif conversion ==
"l":
38 return str(value).lower()
40 super(ExtendedFormatter, self).
convert_field(value, conversion)
def as_vector_string(string_vals)
def convert_field(self, value, conversion)