Fawkes API  Fawkes Development Version
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 #include <vector>
29 
30 namespace fawkes {
31 
32 
34 {
35  public:
36  static std::string to_upper(std::string str);
37  static std::string to_lower(std::string str);
38 
39  static std::string to_string(unsigned int i);
40  static std::string to_string(int i);
41  static std::string to_string(long int i);
42  static std::string to_string(float f);
43  static std::string to_string(double d);
44  static std::string to_string(bool b);
45  static std::string to_string(std::string &s)
46  { return s; }
47 
48  static unsigned int to_uint(std::string s);
49  static int to_int(std::string s);
50  static long to_long(std::string s);
51  static float to_float(std::string s);
52  static double to_double(std::string s);
53  static bool to_bool(std::string s);
54 
55  static void trim_inplace(std::string &s);
56  static std::string trim(std::string &s);
57 
58  static std::string resolve_path(std::string s);
59  static std::vector<std::string> resolve_paths(std::vector<std::string> s);
60 
61  private:
62  // may not be instantiated!
63  StringConversions() {};
64 };
65 
66 
67 } // end namespace fawkes
68 
69 #endif
static std::string resolve_path(std::string s)
Resolves path-string with @...@ tags.
static std::string to_upper(std::string str)
Convert string to all-uppercase string.
Fawkes library namespace.
static std::string to_lower(std::string str)
Convert string to all-lowercase string.
static std::vector< std::string > resolve_paths(std::vector< std::string > s)
Resolves vector of path-string with @...@ tags.
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.
static std::string to_string(std::string &s)
No-op conversion of string.
Utility class that holds string methods.
static long to_long(std::string s)
Convert string to a long int value.
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.