Begin to rework term256 support

This commit is contained in:
ridiculousfish
2012-03-05 10:44:08 -08:00
parent 230fb921ec
commit 063a465227
5 changed files with 56 additions and 19 deletions

View File

@@ -303,6 +303,14 @@ T from_string(const wcstring &x) {
return result;
}
template<typename T>
T from_string(const std::string &x) {
T result = T();
std::stringstream stream(x);
stream >> result;
return result;
}
template<typename T>
wcstring to_string(const T &x) {
std::wstringstream stream;
@@ -318,6 +326,16 @@ inline wcstring to_string(const long &x) {
return wcstring(buff);
}
template<>
inline bool from_string(const std::string &x) {
return ! x.empty() && strchr("YTyt", x.at(0));
}
template<>
inline bool from_string(const wcstring &x) {
return ! x.empty() && wcschr(L"YTyt", x.at(0));
}
template<>
inline wcstring to_string(const int &x) {
return to_string(static_cast<long>(x));