diff options
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 511e4b99684..ad98bd5e491 100644 --- a/src/common/Utilities/Util.cpp +++ b/src/common/Utilities/Util.cpp @@ -21,6 +21,7 @@ #include "IpAddress.h" #include "StringConvert.h" #include "StringFormat.h" +#include <boost/core/demangle.hpp> #include <utf8.h> #include <algorithm> #include <iomanip> @@ -831,19 +832,25 @@ 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()); } float DegToRad(float degrees) |