#include <cexception.h>#include <iostream>#include <sstream>#include <string>Go to the source code of this file.
Functions | |
| template<class t > | |
| t | convertString (const std::string &str) |
| template<class t > | |
| std::string | convertToString (const t &val) |
Definition in file StringConvert.h.
| t convertString | ( | const std::string & | str | ) |
Definition at line 29 of file StringConvert.h.
{
std::istringstream s(str);
t buf;
if (!(s >> buf)) {
throw( cException("convertString: parsing of string %s failed", str.c_str()) );
}
return buf;
}
| std::string convertToString | ( | const t & | val | ) |
Definition at line 38 of file StringConvert.h.
{
std::ostringstream s;
if (!(s << val)) {
throw( cException("convertToString: cannot convert value to string") );
}
return s.str();
}
1.7.1