1 /*
2  * This file is part of GtkEveMon.
3  *
4  * GtkEveMon is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * You should have received a copy of the GNU General Public License
10  * along with GtkEveMon. If not, see <http://www.gnu.org/licenses/>.
11  */
12 
13 #ifndef HELPERS_HEADER
14 #define HELPERS_HEADER
15 
16 #include <string>
17 #include <vector>
18 
19 typedef std::vector<std::string> StringVector;
20 
21 class Helpers
22 {
23   public:
24     static std::string get_string_from_int (int value);
25     static std::string get_string_from_uint (unsigned int value);
26     static std::string get_string_from_sizet (std::size_t value);
27     static std::string get_string_from_float (float value, int digits);
28     static std::string get_string_from_double (double value, int digits);
29 
30     static int get_int_from_string (std::string const& value);
31     static unsigned int get_uint_from_string (std::string const& value);
32     static double get_double_from_string (std::string const& value);
33     static float get_float_from_string (std::string const& value);
34     static std::string get_roman_from_int (int value);
35 
36     static std::string get_dotted_str_from_int (int value);
37     static std::string get_dotted_str_from_uint (unsigned int value);
38     static std::string get_dotted_str_from_str (std::string const& str);
39     static std::string get_dotted_isk (std::string const& isk_string);
40 
41     static std::string trunc_string (std::string const& str, int len);
42 
43     static StringVector split_string (std::string const& str, char delim);
44     static StringVector tokenize_cmd (std::string const& str);
45     static char** create_argv (std::vector<std::string> const& cmd);
46     static void delete_argv (char** argv);
47     static void read_file (std::string const& filename, std::string* data,
48         bool auto_gunzip = false);
49     static void write_file (std::string const& filename,
50         std::string const& data);
51 };
52 
53 #endif /* HELPERS_HEADER */
54