diff options
| author | Lioncash <mai.iam2048@gmail.com> | 2023-05-16 14:17:54 -0400 |
|---|---|---|
| committer | Lioncash <mai.iam2048@gmail.com> | 2023-05-16 14:17:54 -0400 |
| commit | 21df3ca572a0fad37440b29c56c83d50c45c92f4 (patch) | |
| tree | 2a591e415f8bcae667bbfaa7b4c4de57db420674 /Source/Core/Common | |
| parent | a9f1edeb614297ba1bf20529e1888929252a9f60 (diff) | |
StringUtil: Move IsPrintableCharacter() into Common namespace
Diffstat (limited to 'Source/Core/Common')
| -rw-r--r-- | Source/Core/Common/StringUtil.cpp | 2 | ||||
| -rw-r--r-- | Source/Core/Common/StringUtil.h | 16 |
2 files changed, 9 insertions, 9 deletions
diff --git a/Source/Core/Common/StringUtil.cpp b/Source/Core/Common/StringUtil.cpp index af81e2b84b..c041164f22 100644 --- a/Source/Core/Common/StringUtil.cpp +++ b/Source/Core/Common/StringUtil.cpp @@ -77,7 +77,7 @@ std::string HexDump(const u8* data, size_t size) if (row_start + i < size) { char c = static_cast<char>(data[row_start + i]); - out += IsPrintableCharacter(c) ? c : '.'; + out += Common::IsPrintableCharacter(c) ? c : '.'; } } out += "\n"; diff --git a/Source/Core/Common/StringUtil.h b/Source/Core/Common/StringUtil.h index d2177c2208..9e321ca59a 100644 --- a/Source/Core/Common/StringUtil.h +++ b/Source/Core/Common/StringUtil.h @@ -230,14 +230,6 @@ std::string ThousandSeparate(I value, int spaces = 0) #endif } -/// Returns whether a character is printable, i.e. whether 0x20 <= c <= 0x7e is true. -/// Use this instead of calling std::isprint directly to ensure -/// the C locale is being used and to avoid possibly undefined behaviour. -inline bool IsPrintableCharacter(char c) -{ - return std::isprint(c, std::locale::classic()); -} - #ifdef _WIN32 std::vector<std::string> CommandLineToUtf8Argv(const wchar_t* command_line); #endif @@ -246,6 +238,14 @@ std::string GetEscapedHtml(std::string html); namespace Common { +/// Returns whether a character is printable, i.e. whether 0x20 <= c <= 0x7e is true. +/// Use this instead of calling std::isprint directly to ensure +/// the C locale is being used and to avoid possibly undefined behaviour. +inline bool IsPrintableCharacter(char c) +{ + return std::isprint(c, std::locale::classic()); +} + /// Returns whether a character is a letter, i.e. whether 'a' <= c <= 'z' || 'A' <= c <= 'Z' /// is true. Use this instead of calling std::isalpha directly to ensure /// the C locale is being used and to avoid possibly undefined behaviour. |
