From eda5386b3fb8cf5a9ed6a0a778e8f409fe62f5bb Mon Sep 17 00:00:00 2001 From: Artem Pavlenko Date: Wed, 14 Feb 2007 20:25:24 +0000 Subject: [PATCH] added missing mapnik::value to std::wstring conversions --- include/mapnik/value.hpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/include/mapnik/value.hpp b/include/mapnik/value.hpp index ebf424a61..d4d4a9766 100644 --- a/include/mapnik/value.hpp +++ b/include/mapnik/value.hpp @@ -347,15 +347,16 @@ namespace mapnik { for (;pos!=val.end();++pos) { wchar_t c = *pos; - if (c < 0x7f) + if (c < 0x80) { ss << char(c); } else { ss << "\\x"; - ss << ((c >> 8) & 0xff); - ss << (c & 0xff); + unsigned c0 = (c >> 8) & 0xff; + if (c0) ss << c0; + ss << (c & 0xff); } } return ss.str(); @@ -375,7 +376,9 @@ namespace mapnik { template std::wstring operator() (T val) const { - return L"TODO"; + std::basic_ostringstream out; + out << val; + return out.str(); } // specializations std::wstring const& operator() (std::wstring const& val) const @@ -394,18 +397,19 @@ namespace mapnik { for (;pos!=val.end();++pos) { wchar_t c = *pos; - if (c < 0x7f) + if (c < 0x80) { ss << char(c); } else { ss << "\\x"; - ss << ((c >> 8) & 0xff); - ss << (c & 0xff); + unsigned c0 = (c >> 8) & 0xff; + if (c0) ss << c0; + ss << (c & 0xff); } } - return ss.str(); + return "\'" + ss.str() + "\'"; } template