conversions.h

Go to the documentation of this file.
00001 /* MAINATINER: Bernard CURENT_EDITOR: Bernard */
00002 
00003 #ifndef _CONVERSIONS_H_
00004 #define _CONVERSIONS_H_
00005 
00006 //#include <unistd.h>
00007 #include <string>
00008 #include <sstream>
00009 
00010 
00011 //---- Conversions anything to string 
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 //---- Conversions for extractibg data from string ----
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 //----- Conversion UTF-8 <=> wchar_t
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

Generated on Wed Apr 12 13:55:27 2006 for bjs by  doxygen 1.4.5