forked from doitsujin/dxvk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutil_string.h
43 lines (31 loc) · 909 Bytes
/
util_string.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#pragma once
#include <string>
#include <sstream>
#include <vector>
#include "./com/com_include.h"
namespace dxvk::str {
std::string fromws(const WCHAR *ws);
void tows(const char* mbs, WCHAR* wcs, size_t wcsLen);
template <size_t N>
void tows(const char* mbs, WCHAR (&wcs)[N]) {
return tows(mbs, wcs, N);
}
std::wstring tows(const char* mbs);
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;
format1(str, args...);
}
template<typename... Args>
std::string format(const Args&... args) {
std::stringstream stream;
format1(stream, args...);
return stream.str();
}
}