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:
parent
746562de5a
commit
629238ac36
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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&) { }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user