StringUtil: Move CommandLineToUtf8Argv() into Common namespace

This commit is contained in:
Lioncash 2023-05-16 14:23:21 -04:00
parent d368c989e7
commit 954afd81ec
6 changed files with 10 additions and 10 deletions

View File

@ -656,6 +656,8 @@ std::string PathToString(const std::filesystem::path& path)
#endif
}
namespace Common
{
#ifdef _WIN32
std::vector<std::string> CommandLineToUtf8Argv(const wchar_t* command_line)
{
@ -675,8 +677,6 @@ std::vector<std::string> CommandLineToUtf8Argv(const wchar_t* command_line)
}
#endif
namespace Common
{
std::string GetEscapedHtml(std::string html)
{
static constexpr std::array<std::array<const char*, 2>, 5> replacements{{

View File

@ -230,10 +230,6 @@ std::string ThousandSeparate(I value, int spaces = 0)
#endif
}
#ifdef _WIN32
std::vector<std::string> CommandLineToUtf8Argv(const wchar_t* command_line);
#endif
namespace Common
{
/// Returns whether a character is printable, i.e. whether 0x20 <= c <= 0x7e is true.
@ -262,6 +258,10 @@ inline char ToUpper(char ch)
return std::toupper(ch, std::locale::classic());
}
#ifdef _WIN32
std::vector<std::string> CommandLineToUtf8Argv(const wchar_t* command_line);
#endif
std::string GetEscapedHtml(std::string html);
void ToLower(std::string* str);

View File

@ -316,7 +316,7 @@ int main(int argc, char* argv[])
#ifdef _WIN32
int wmain(int, wchar_t*[], wchar_t*[])
{
std::vector<std::string> args = CommandLineToUtf8Argv(GetCommandLineW());
std::vector<std::string> args = Common::CommandLineToUtf8Argv(GetCommandLineW());
const int argc = static_cast<int>(args.size());
std::vector<char*> argv(args.size());
for (size_t i = 0; i < args.size(); ++i)

View File

@ -306,7 +306,7 @@ int main(int argc, char* argv[])
#ifdef _WIN32
int WINAPI wWinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ LPWSTR, _In_ int)
{
std::vector<std::string> args = CommandLineToUtf8Argv(GetCommandLineW());
std::vector<std::string> args = Common::CommandLineToUtf8Argv(GetCommandLineW());
const int argc = static_cast<int>(args.size());
std::vector<char*> argv(args.size());
for (size_t i = 0; i < args.size(); ++i)

View File

@ -54,7 +54,7 @@ int main(int argc, char* argv[])
#ifdef _WIN32
int wmain(int, wchar_t*[], wchar_t*[])
{
std::vector<std::string> args = CommandLineToUtf8Argv(GetCommandLineW());
std::vector<std::string> args = Common::CommandLineToUtf8Argv(GetCommandLineW());
const int argc = static_cast<int>(args.size());
std::vector<char*> argv(args.size());
for (size_t i = 0; i < args.size(); ++i)

View File

@ -62,7 +62,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine
return 0;
}
std::vector<std::string> args = CommandLineToUtf8Argv(pCmdLine);
std::vector<std::string> args = Common::CommandLineToUtf8Argv(pCmdLine);
return RunUpdater(args) ? 0 : 1;
}