diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2017-12-06 05:01:12 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2017-12-06 05:01:12 +0000 |
| commit | 79bd7f22ccb98ddd9383c31154c2f697115e1088 (patch) | |
| tree | 9e92194d601f48325701bf19e3fd60c68ff5217e /Common/include | |
| parent | Minor updates to CMake files (diff) | |
| download | DiligentCore-79bd7f22ccb98ddd9383c31154c2f697115e1088.tar.gz DiligentCore-79bd7f22ccb98ddd9383c31154c2f697115e1088.zip | |
Fixed tolower()-related warnings
Diffstat (limited to 'Common/include')
| -rw-r--r-- | Common/include/StringTools.h | 17 |
1 files changed, 17 insertions, 0 deletions
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 <string> #include <sstream> #include <locale> +#include <algorithm> +#include <cctype> + #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<char>(std::tolower(c)); } + ); +} + +inline std::string StrToLower(std::string str) +{ + StrToLowerInPlace(str); + return str; +} + } |
