2 PROJECT: FlowerSoft C++ library
3 FILE : string-convert.hh
6 #ifndef STRING_CONVERT_HH
7 #define STRING_CONVERT_HH
12 #include "std-string.hh"
13 #include "flower-proto.hh"
15 /** The functor std::string_convert handles all conversions to/from std::string
16 (some time, anyway). The class is quite empty from data view. */
19 static int hex2bin (std::string hex_string, std::string &bin_string_r);
20 static int hex2nibble (Byte byte);
21 static Byte nibble2hex_byte (Byte byte);
23 static std::string pad_to (std::string s, int length);
24 static std::string bool_string (bool b);
25 static std::string bin2dec (std::string bin_string);
26 static std::string bin2hex (std::string bin_string);
27 static std::string dec2bin (std::string str);
28 static int bin2int (std::string bin_string);
29 static unsigned bin2unsigned (std::string bin_string);
30 static std::string char_string (char c, int n);
31 static int dec2int (std::string dec_string);
32 static double dec2double (std::string dec_string);
33 static std::string double_string (double f, char const *fmt = 0);
34 static std::string form_string (char const *format, ...);
35 static std::string vform_string (char const *format, va_list args);
36 static int hex2int (std::string str);
37 static unsigned hex2unsigned (std::string str);
38 static std::string hex2bin (std::string str);
39 static std::string int_string (int i, char const *fmt = 0);
40 static std::string long_string (long);
41 static std::string int2hex (int i, int length_i, char ch);
42 static std::string unsigned2hex (unsigned u, ssize length, char ch);
43 static std::string int2dec (int i, int length_i, char ch);
44 static std::string rational_string (Rational);
45 static std::string pointer_string (void const *);
46 static std::string precision_string (double x, int n);
47 static Array<std::string> split (std::string str, char c);
48 static std::string i64_string (I64, char const *fmt = 0);
49 static std::string to_lower (std::string s);
50 static std::string to_upper (std::string s);
51 static std::string reverse (std::string s);
54 #endif // __STRING_CONVERT_HH //