Further directx cleaning.

This commit is contained in:
jmsgrogan 2023-01-05 12:06:17 +00:00
parent d99a36f24f
commit 7fcc8e43ae
23 changed files with 401 additions and 304 deletions

View file

@ -173,6 +173,23 @@ std::string StringUtils::convert(const std::wstring& input)
#endif
}
std::wstring StringUtils::convert(const std::string& input)
{
if (input.empty())
{
return std::wstring();
}
#ifdef _WIN32
const auto charsNeeded = ::MultiByteToWideChar(CP_UTF8, 0, input.data(), (int)input.size(), NULL, 0);
std::vector<wchar_t> buffer(charsNeeded);
const auto charsConverted = ::MultiByteToWideChar(CP_UTF8, 0, input.data(), (int)input.size(), &buffer[0], buffer.size());
return std::wstring(&buffer[0], charsConverted);
#else
throw std::logic_error("Not implemented");
#endif
}
std::string StringUtils::toPaddedString(unsigned numBytes, unsigned entry)
{
std::stringstream sstr;

View file

@ -20,6 +20,8 @@ public:
static std::string convert(const std::wstring& input);
static std::wstring convert(const std::string& input);
static bool isAlphaNumeric(char c);
static bool isAlphabetical(char c);