4
0
mirror of https://github.com/QuasarApp/pe-parse.git synced 2025-04-28 21:34:31 +00:00
William Woodruff 8736072cc1
pe-parser-library: Use WinAPI for UTF-16 to UTF-8 ()
* pe-parser-library: Use WinAPI for UTF-16 to UTF-8

If ICU isn't available and we're on C++17 or later, use
the Windows API for Unicode conversion instead of codecvt.
2020-04-14 10:20:16 -04:00

25 lines
528 B
C++

#pragma once
#include <sstream>
#include <string>
#if defined(USE_ICU4C)
#include <unicode/unistr.h>
typedef std::basic_string<UChar> UCharString;
#elif defined(USE_STRINGAPISET)
typedef std::basic_string<wchar_t> UCharString;
#else
typedef std::u16string UCharString;
#endif
namespace peparse {
template <class T>
static std::string to_string(T t, std::ios_base &(*f)(std::ios_base &) ) {
std::ostringstream oss;
oss << f << t;
return oss.str();
}
std::string from_utf16(const UCharString &u);
} // namespace peparse