added saving and reading int and unsigned int from settings.

This commit is contained in:
rachytski 2012-07-24 14:50:51 -07:00 committed by Alex Zolotarev
parent 6f95619ff7
commit d8b0f9f88b

View file

@ -199,6 +199,44 @@ namespace Settings
else return false;
}
template <> string ToString<int>(int const & v)
{
ostringstream stream;
stream << v;
return stream.str();
}
template <> bool FromString<int>(string const & str, int & v)
{
istringstream stream(str);
if (stream.good())
{
stream >> v;
return !stream.fail();
}
else
return false;
}
template <> string ToString<unsigned>(unsigned const & v)
{
ostringstream stream;
stream << v;
return stream.str();
}
template <> bool FromString<unsigned>(string const & str, unsigned & v)
{
istringstream stream(str);
if (stream.good())
{
stream >> v;
return !stream.fail();
}
else
return false;
}
namespace impl
{
template <class TPair> string ToStringPair(TPair const & value)