6 namespace StringUtils {
7 inline void ToWideString(
const std::string& source,
8 std::wstring& destination) noexcept
10 destination.assign(source.begin(), source.end());
13 inline std::wstring ToWideString(
const std::string& source) noexcept
16 dest.assign(source.begin(), source.end());
20 inline std::string ToString(
const std::wstring& source) noexcept
22 using convert_type = std::codecvt_utf8<wchar_t>;
23 std::wstring_convert<convert_type, wchar_t> converter;
24 return converter.to_bytes(source);
27 inline std::wstring AnsiToWString(
const std::string& str) noexcept
29 static const std::uint32_t bufferMaxSize = 512U;
30 WCHAR buffer[bufferMaxSize];
31 MultiByteToWideChar(CP_ACP, 0U, str.c_str(), -1, buffer, bufferMaxSize);
32 return std::wstring(buffer);