Showing the changes to Source/Libraries/TimeSeriesPlatformLibrary/Common/Convert.cpp (1 of 11 files). Show all
Unified · Split
| @@ -23,6 +23,8 @@ · 22 unmodified lines | |||
| 23 | 23 | ||
| 24 | #include <iomanip> | 24 | #include <iomanip> |
| 25 | #include <sstream> | 25 | #include <sstream> |
| 26 | #include <locale> | ||
| 27 | #include <codecvt> | ||
| 26 | #include <boost/uuid/string_generator.hpp> | 28 | #include <boost/uuid/string_generator.hpp> |
| 27 | #include <boost/uuid/uuid_io.hpp> | 29 | #include <boost/uuid/uuid_io.hpp> |
| 28 | #include <boost/date_time/posix_time/posix_time.hpp> | 30 | #include <boost/date_time/posix_time/posix_time.hpp> |
| @@ -252,6 +254,18 @@ std::string GSF::ToString(const DateTime& value, const char* format) · 223 unmodified lines | |||
| 252 | return stream.str(); | 254 | return stream.str(); |
| 253 | } | 255 | } |
| 254 | 256 | ||
| 257 | wstring GSF::ToUTF16(const string& value) | ||
| 258 | { | ||
| 259 | wstring_convert<codecvt_utf8<wchar_t>, wchar_t> converter; | ||
| 260 | return converter.from_bytes(value); | ||
| 261 | } | ||
| 262 | |||
| 263 | string GSF::ToUTF8(const wstring& value) | ||
| 264 | { | ||
| 265 | wstring_convert<codecvt_utf8<wchar_t>, wchar_t> converter; | ||
| 266 | return converter.to_bytes(value); | ||
| 267 | } | ||
| 268 | |||
| 255 | Guid GSF::ParseGuid(const uint8_t* data, bool swapBytes) | 269 | Guid GSF::ParseGuid(const uint8_t* data, bool swapBytes) |
| 256 | { | 270 | { |
| 257 | Guid id; | 271 | Guid id; |
| @@ -351,4 +365,4 @@ DateTime GSF::ParseTimestamp(const char* time, bool parseAsUTC) · 93 unmodified lines | |||
| 351 | return timestamp; | 365 | return timestamp; |
| 352 | 366 | ||
| 353 | throw runtime_error("Failed to parse timestamp \"" + string(time) + "\""); | 367 | throw runtime_error("Failed to parse timestamp \"" + string(time) + "\""); |
| 354 | } | 368 | } |