FTXUI/src/ftxui/screen/string.cpp

27 lines
698 B
C++
Raw Normal View History

2020-04-20 03:00:37 +08:00
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include "ftxui/screen/string.hpp"
2018-09-18 14:48:40 +08:00
#include <codecvt>
#include <locale>
2020-03-23 14:12:06 +08:00
#ifdef _MSC_VER
2020-03-27 08:42:46 +08:00
#pragma warning(push)
#pragma warning(disable : 4996) // codecvt_utf8_utf16 is deprecated
2020-03-23 14:12:06 +08:00
#endif
2018-09-18 14:48:40 +08:00
std::string to_string(const std::wstring& s) {
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
return converter.to_bytes(s);
}
std::wstring to_wstring(const std::string& s) {
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
return converter.from_bytes(s);
}
2020-03-23 14:12:06 +08:00
#ifdef _MSC_VER
2020-03-27 08:42:46 +08:00
#pragma warning(pop)
2020-03-23 14:12:06 +08:00
#endif