00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef _CSP_EXAMPLES_Conversions_H
00030 #define _CSP_EXAMPLES_Conversions_H
00031
00032
00039 std::wstring string2wstring(const std::string& s);
00040
00047 std::string wstring2string(const std::wstring& ws);
00048
00049
00057 double wstring2double(const std::wstring& s);
00058
00059
00067 const std::wstring int2wstring(int x, int base = 10);
00068
00069
00082 template<class Iterator>
00083 void wstring2container(
00084 const std::wstring& source,
00085 Iterator iterator,
00086 const std::wstring& separator = std::wstring(L","))
00087 {
00088 if (source.empty())
00089 return;
00090
00091 std::wstring::size_type b = 0;
00092
00093 for (std::wstring::size_type e = 0;
00094 (e = source.find(separator, b)) != std::wstring::npos;
00095 b = e + separator.size())
00096 *iterator = source.substr(b, e - b);
00097
00098 *iterator = source.substr(b);
00099 }
00100
00101
00102 #endif // _CSP_EXAMPLES_Conversions_H
00103
00104
00105
00106