1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-02 10:24:12 +01:00

[util] Implement tows method to convert strings to wide strings

This commit is contained in:
Philip Rebohle 2019-02-11 21:35:32 +01:00
parent 746562de5a
commit 629238ac36
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 19 additions and 0 deletions

View File

@ -22,4 +22,20 @@ namespace dxvk::str {
&result.at(0), len, nullptr, nullptr);
return result;
}
std::vector<WCHAR> tows(const std::string& str) {
int strLen = ::MultiByteToWideChar(
CP_ACP, 0, str.c_str(), str.length() + 1,
nullptr, 0);
std::vector<WCHAR> wideStr(strLen);
::MultiByteToWideChar(
CP_ACP, 0, str.c_str(), str.length() + 1,
wideStr.data(), strLen);
return wideStr;
}
}

View File

@ -2,12 +2,15 @@
#include <string>
#include <sstream>
#include <vector>
#include "./com/com_include.h"
namespace dxvk::str {
std::string fromws(const WCHAR *ws);
std::vector<WCHAR> tows(const std::string& str);
inline void format1(std::stringstream&) { }