1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-23 14:54:30 +01:00

Move more window code to UiContext

This commit is contained in:
Ted John
2017-04-01 13:38:52 +01:00
committed by Gymnasiast
parent a020a9fbef
commit 3fcd42fe2b
21 changed files with 357 additions and 165 deletions

View File

@@ -47,6 +47,30 @@ namespace String
return returnValue;
}
std::string ToUtf8(const std::wstring &s)
{
std::string result;
utf8 * cstr = widechar_to_utf8(s.c_str());
if (cstr != nullptr)
{
result = std::string(cstr);
}
free(cstr);
return result;
}
std::wstring ToUtf16(const std::string &s)
{
std::wstring result;
wchar_t * wcstr = utf8_to_widechar(s.c_str());
if (wcstr != nullptr)
{
result = std::wstring(wcstr);
}
free(wcstr);
return result;
}
bool IsNullOrEmpty(const utf8 * str)
{
return str == nullptr || str[0] == '\0';