From 79bd7f22ccb98ddd9383c31154c2f697115e1088 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Tue, 5 Dec 2017 21:01:12 -0800 Subject: Fixed tolower()-related warnings --- Common/include/StringTools.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'Common/include') diff --git a/Common/include/StringTools.h b/Common/include/StringTools.h index e1327d0a..6bf713de 100644 --- a/Common/include/StringTools.h +++ b/Common/include/StringTools.h @@ -26,6 +26,9 @@ #include #include #include +#include +#include + #include "DebugUtilities.h" namespace Diligent @@ -107,4 +110,18 @@ inline bool StrCmpSuff(const char *RefStr, const char *Str, const char *Suff) return strcmp(r, Suff) == 0; } +inline void StrToLowerInPlace(std::string &str) +{ + std::transform(str.begin(), str.end(), str.begin(), + // http://en.cppreference.com/w/cpp/string/byte/tolower + [](unsigned char c) { return static_cast(std::tolower(c)); } + ); +} + +inline std::string StrToLower(std::string str) +{ + StrToLowerInPlace(str); + return str; +} + } -- cgit v1.2.3