diff options
author | Treeston <treeston.mmoc@gmail.com> | 2020-09-12 19:42:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-12 19:42:10 +0200 |
commit | 75f9e7396e35360f3016cc0cb21e72e20f5d96d5 (patch) | |
tree | e738b70d54516717d2c784117fbd2b0134412ac0 /src/common/Utilities/Util.cpp | |
parent | 59be657ca267667b3cbeb1f34d47df0382e97f53 (diff) |
[3.3.5] Core/ChatCommands: Show error messages from argument parsers (PR #25443)
Diffstat (limited to 'src/common/Utilities/Util.cpp')
-rw-r--r-- | src/common/Utilities/Util.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/common/Utilities/Util.cpp b/src/common/Utilities/Util.cpp index c51cb954c91..e277a3aae95 100644 --- a/src/common/Utilities/Util.cpp +++ b/src/common/Utilities/Util.cpp @@ -29,6 +29,7 @@ #include <cctype> #include <cstdarg> #include <ctime> +#include <boost/core/demangle.hpp> #if TRINITY_COMPILER == TRINITY_COMPILER_GNU #include <sys/socket.h> @@ -646,17 +647,23 @@ void Trinity::Impl::HexStrToByteArray(std::string_view str, uint8* out, size_t o } } -bool StringEqualI(std::string_view str1, std::string_view str2) +bool StringEqualI(std::string_view a, std::string_view b) { - return std::equal(str1.begin(), str1.end(), str2.begin(), str2.end(), - [](char a, char b) - { - return std::tolower(a) == std::tolower(b); - }); + return std::equal(a.begin(), a.end(), b.begin(), b.end(), [](char c1, char c2) { return std::tolower(c1) == std::tolower(c2); }); } bool StringContainsStringI(std::string_view haystack, std::string_view needle) { return haystack.end() != - std::search(haystack.begin(), haystack.end(), needle.begin(), needle.end(), [](char c1, char c2) { return std::toupper(c1) == std::toupper(c2); }); + std::search(haystack.begin(), haystack.end(), needle.begin(), needle.end(), [](char c1, char c2) { return std::tolower(c1) == std::tolower(c2); }); +} + +bool StringCompareLessI(std::string_view a, std::string_view b) +{ + return std::lexicographical_compare(a.begin(), a.end(), b.begin(), b.end(), [](char c1, char c2) { return std::tolower(c1) < std::tolower(c2); }); +} + +std::string GetTypeName(std::type_info const& info) +{ + return boost::core::demangle(info.name()); } |