From fd05a353418e1be8f4d5194fd2222de7f3955241 Mon Sep 17 00:00:00 2001 From: Treeston Date: Mon, 24 Aug 2020 16:38:39 +0200 Subject: Revert "[3.3.5] Core/ChatCommands: C++17 cleanup (if constexpr + std::string_view)" This reverts commit 11c4a60fbe9d471618e0579f588706746ff3e439. --- src/common/Utilities/Util.cpp | 8 ++------ src/common/Utilities/Util.h | 3 +-- 2 files changed, 3 insertions(+), 8 deletions(-) (limited to 'src/common/Utilities') diff --git a/src/common/Utilities/Util.cpp b/src/common/Utilities/Util.cpp index cb70cc114d3..da086c6b6cc 100644 --- a/src/common/Utilities/Util.cpp +++ b/src/common/Utilities/Util.cpp @@ -651,13 +651,9 @@ void Trinity::Impl::HexStrToByteArray(std::string_view str, uint8* out, size_t o } } -Optional StringToBool(std::string_view str) +bool StringToBool(std::string_view str) { - if (str == "1" || StringEqualI(str, "y") || StringEqualI(str, "on") || StringEqualI(str, "yes") || StringEqualI(str, "true")) - return true; - if (str == "0" || StringEqualI(str, "n") || StringEqualI(str, "off") || StringEqualI(str, "no") || StringEqualI(str, "false")) - return false; - return std::nullopt; + return ((str == "1") || StringEqualI(str, "true") || StringEqualI(str, "yes")); } bool StringEqualI(std::string_view str1, std::string_view str2) diff --git a/src/common/Utilities/Util.h b/src/common/Utilities/Util.h index 8c97f99fe63..cd8765b309f 100644 --- a/src/common/Utilities/Util.h +++ b/src/common/Utilities/Util.h @@ -20,7 +20,6 @@ #include "Define.h" #include "Errors.h" -#include "Optional.h" #include #include @@ -346,7 +345,7 @@ inline std::vector HexStrToByteVector(std::string_view str, bool reverse return buf; } -TC_COMMON_API Optional StringToBool(std::string_view str); +TC_COMMON_API bool StringToBool(std::string_view str); TC_COMMON_API bool StringEqualI(std::string_view str1, std::string_view str2); TC_COMMON_API bool StringStartsWith(std::string_view haystack, std::string_view needle); -- cgit v1.2.3