Core/ChatCommands: Add std::wstring argument type (#25302)

(cherry picked from commit 617a769d6f)
This commit is contained in:
Peter Keresztes Schmidt
2020-08-22 17:36:13 +02:00
committed by Shauren
parent e9209c3131
commit b527a031b9

View File

@@ -120,6 +120,25 @@ struct ArgInfo<std::string, void>
}
};
// wstring
template <>
struct ArgInfo<std::wstring, void>
{
static char const* TryConsume(std::wstring& val, char const* args)
{
std::string utf8Str;
char const* ret = ArgInfo<std::string>::TryConsume(utf8Str, args);
if (!ret)
return nullptr;
if (!Utf8toWStr(utf8Str, val))
return nullptr;
return ret;
}
};
// enum
template <typename T>
struct ArgInfo<T, std::enable_if_t<std::is_enum_v<T>>>