00001
00002
00003 #ifndef _CONVERSIONS_H_
00004 #define _CONVERSIONS_H_
00005
00006
00007 #include <string>
00008 #include <sstream>
00009
00010
00011
00012
00016 std::string itos(int i);
00017
00023 template <class T> std::string xtos(const T& t)
00024 {
00025 std::stringstream s;
00026 s << t;
00027 return s.str();
00028 }
00029
00034 std::string iptos(unsigned long ip);
00035
00036
00037
00038
00039
00040 bool try_get_double(const std::string& value, double &f);
00041 bool try_get_bool (const std::string& value, bool &b);
00042 bool try_get_long (const std::string& value, long &i);
00043 bool try_get_char (const std::string& value, unsigned char &c);
00044
00045
00047 long get_long (const std::string& value);
00048 double get_double(const std::string& value);
00049 bool get_bool (const std::string& value);
00050 unsigned char get_char(const std::string& value);
00051
00052
00053
00054
00061 void utf8tows(const char *utf8, std::wstring &ws);
00062
00063
00070 void wstoutf8(const std::wstring &ws, std::string &utf8);
00071
00072 #endif