25 |
#endif |
#endif |
26 |
|
|
27 |
#include <cstring> |
#include <cstring> |
28 |
|
#include <algorithm> |
29 |
|
|
30 |
#include <glibmmconfig.h> |
#ifdef GLIBMM_HEADER_FILE |
31 |
|
# include GLIBMM_HEADER_FILE(glibmmconfig.h) |
32 |
|
#else |
33 |
|
# include <glibmmconfig.h> |
34 |
|
#endif |
35 |
// threads.h must be included first to be able to build with |
// threads.h must be included first to be able to build with |
36 |
// G_DISABLE_DEPRECATED |
// G_DISABLE_DEPRECATED |
37 |
#if (GLIBMM_MAJOR_VERSION == 2 && GLIBMM_MINOR_VERSION == 31 && GLIBMM_MICRO_VERSION >= 2) || \ |
#if (GLIBMM_MAJOR_VERSION == 2 && GLIBMM_MINOR_VERSION == 31 && GLIBMM_MICRO_VERSION >= 2) || \ |
56 |
#endif |
#endif |
57 |
|
|
58 |
//FIXME: for some reason AC GETTEXT check fails on the Mac cross compiler? |
//FIXME: for some reason AC GETTEXT check fails on the Mac cross compiler? |
59 |
#if (HAVE_GETTEXT || defined(__APPLE__)) |
#ifdef GETTEXT_HEADER_FILE |
60 |
|
# include GETTEXT_HEADER_FILE(libintl.h) |
61 |
|
#elif (HAVE_GETTEXT || defined(__APPLE__)) |
62 |
# include <libintl.h> |
# include <libintl.h> |
63 |
# define _(String) gettext(String) |
# define _(String) gettext(String) |
64 |
#else |
#else |
123 |
return Glib::convert_with_fallback(utf8_string, GIG_STR_ENCODING, "UTF-8", "?"); |
return Glib::convert_with_fallback(utf8_string, GIG_STR_ENCODING, "UTF-8", "?"); |
124 |
} |
} |
125 |
|
|
126 |
|
inline Glib::ustring ltrim(Glib::ustring s) { |
127 |
|
s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun<int, int>(std::isspace)))); |
128 |
|
return s; |
129 |
|
} |
130 |
|
|
131 |
|
inline Glib::ustring rtrim(Glib::ustring s) { |
132 |
|
s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun<int, int>(std::isspace))).base(), s.end()); |
133 |
|
return s; |
134 |
|
} |
135 |
|
|
136 |
|
inline Glib::ustring trim(Glib::ustring s) { |
137 |
|
return ltrim(rtrim(s)); |
138 |
|
} |
139 |
|
|
140 |
template<class T> inline std::string ToString(T o) { |
template<class T> inline std::string ToString(T o) { |
141 |
std::stringstream ss; |
std::stringstream ss; |
142 |
ss << o; |
ss << o; |