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