Nui
widen.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <locale>
4 #include <codecvt>
5 #include <string>
6 
7 namespace Nui
8 {
9  inline std::wstring widenString(std::string const& str)
10  {
11 #pragma clang diagnostic push
12 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
13  std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
14  return converter.from_bytes(str);
15 #pragma clang diagnostic pop
16  }
17 
18  inline std::string shortenString(std::wstring const& str)
19  {
20 #pragma clang diagnostic push
21 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
22  std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
23  return converter.to_bytes(str);
24 #pragma clang diagnostic pop
25  }
26 }
Definition: file_dialog.hpp:6
std::string shortenString(std::wstring const &str)
Definition: widen.hpp:18
std::wstring widenString(std::string const &str)
Definition: widen.hpp:9