mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-30 11:52:11 +01:00
[util] Handle WCHAR strings in str::format.
This commit is contained in:
parent
95e04de3ad
commit
9fd30cf5bf
@ -7,8 +7,16 @@
|
||||
|
||||
namespace dxvk::str {
|
||||
|
||||
std::string fromws(const WCHAR *ws);
|
||||
|
||||
inline void format1(std::stringstream&) { }
|
||||
|
||||
template<typename... Tx>
|
||||
void format1(std::stringstream& str, const WCHAR *arg, const Tx&... args) {
|
||||
str << fromws(arg);
|
||||
format1(str, args...);
|
||||
}
|
||||
|
||||
template<typename T, typename... Tx>
|
||||
void format1(std::stringstream& str, const T& arg, const Tx&... args) {
|
||||
str << arg;
|
||||
@ -22,6 +30,4 @@ namespace dxvk::str {
|
||||
return stream.str();
|
||||
}
|
||||
|
||||
std::string fromws(const WCHAR *ws);
|
||||
|
||||
}
|
||||
|
@ -38,11 +38,8 @@ int WINAPI WinMain(HINSTANCE hInstance,
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::array<char, 257> chars;
|
||||
std::wcstombs(chars.data(), desc.Description, chars.size() - 1);
|
||||
|
||||
std::cout << str::format("Adapter ", i, ":") << std::endl;
|
||||
std::cout << str::format(" ", chars.data()) << std::endl;
|
||||
std::cout << str::format(" ", desc.Description) << std::endl;
|
||||
std::cout << str::format(" Vendor: ", desc.VendorId) << std::endl;
|
||||
std::cout << str::format(" Device: ", desc.DeviceId) << std::endl;
|
||||
std::cout << str::format(" Dedicated RAM: ", desc.DedicatedVideoMemory) << std::endl;
|
||||
@ -60,11 +57,8 @@ int WINAPI WinMain(HINSTANCE hInstance,
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::array<char, 257> chars;
|
||||
std::wcstombs(chars.data(), desc.DeviceName, chars.size() - 1);
|
||||
|
||||
std::cout << str::format(" Output ", j, ":") << std::endl;
|
||||
std::cout << str::format(" ", chars.data()) << std::endl;
|
||||
std::cout << str::format(" ", desc.DeviceName) << std::endl;
|
||||
std::cout << str::format(" Coordinates: ",
|
||||
desc.DesktopCoordinates.left, ",",
|
||||
desc.DesktopCoordinates.top, ":",
|
||||
|
Loading…
x
Reference in New Issue
Block a user