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