18 lines
497 B
C
18 lines
497 B
C
|
#pragma once
|
||
|
|
||
|
#include "common.h"
|
||
|
|
||
|
inline std::wstring StringToWideString(const std::string& text)
|
||
|
{
|
||
|
std::vector<wchar_t> buffer(text.size() + 1);
|
||
|
MultiByteToWideChar(CP_UTF8, 0, text.c_str(), -1, buffer.data(), buffer.size());
|
||
|
return buffer.data();
|
||
|
}
|
||
|
|
||
|
inline std::string WideStringToString(const std::wstring& text)
|
||
|
{
|
||
|
std::vector<char> buffer((text.size() + 1) * 4);
|
||
|
WideCharToMultiByte(CP_UTF8, 0, text.c_str(), -1, buffer.data(), buffer.size(), nullptr, nullptr);
|
||
|
return buffer.data();
|
||
|
}
|