Fawkes API  Fawkes Development Version
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
string_conversions.h
1 
2 /***************************************************************************
3  * string_conversions.h - string conversions
4  *
5  * Created: Thu Oct 12 12:03:49 2006
6  * Copyright 2006 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #ifndef __UTILS_MISC_STRINGTOOLS_H_
25 #define __UTILS_MISC_STRINGTOOLS_H_
26 
27 #include <string>
28 
29 namespace fawkes {
30 
31 
33 {
34  public:
35  static std::string to_upper(std::string str);
36  static std::string to_lower(std::string str);
37 
38  static std::string to_string(unsigned int i);
39  static std::string to_string(int i);
40  static std::string to_string(long int i);
41  static std::string to_string(float f);
42  static std::string to_string(double d);
43  static std::string to_string(bool b);
44 
45  static unsigned int to_uint(std::string s);
46  static int to_int(std::string s);
47  static float to_float(std::string s);
48  static double to_double(std::string s);
49  static bool to_bool(std::string s);
50 
51  static void trim_inplace(std::string &s);
52  static std::string trim(std::string &s);
53 
54  private:
55  // may not be instantiated!
56  StringConversions() {};
57 };
58 
59 
60 } // end namespace fawkes
61 
62 #endif
static std::string to_upper(std::string str)
Convert string to all-uppercase string.
static std::string to_lower(std::string str)
Convert string to all-lowercase string.
static void trim_inplace(std::string &s)
Trim string.
static int to_int(std::string s)
Convert string to an int value.
static std::string trim(std::string &s)
Trim spring.
Utility class that holds string methods.
static float to_float(std::string s)
Convert string to a float value.
static bool to_bool(std::string s)
Convert string to a bool value.
static double to_double(std::string s)
Convert string to a double value.
static std::string to_string(unsigned int i)
Convert unsigned int value to a string.
static unsigned int to_uint(std::string s)
Convert string to an unsigned int value.