From df128b747be998c904ecd0559d8001b01359580e Mon Sep 17 00:00:00 2001 From: Daniel Edwards Date: Mon, 29 Jun 2026 10:59:50 +0200 Subject: [PATCH] utils: inline implementation of internal `SilKit::Util::LowerCase` function Signed-off-by: Daniel Edwards --- SilKit/source/util/StringHelpers.cpp | 8 -------- SilKit/source/util/StringHelpers.hpp | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/SilKit/source/util/StringHelpers.cpp b/SilKit/source/util/StringHelpers.cpp index fc409199d..08fe20a41 100644 --- a/SilKit/source/util/StringHelpers.cpp +++ b/SilKit/source/util/StringHelpers.cpp @@ -96,14 +96,6 @@ auto CurrentTimestampString() -> std::string return fmt::format("{:%FT%H-%M-%S}", tm); } -auto LowerCase(std::string input) -> std::string -{ - // Note: std::tolower has undefined behavior if the argument is not representable as unsigned char. - std::transform(input.begin(), input.end(), input.begin(), - [](unsigned char c) { return static_cast(std::tolower(static_cast(static_cast(c)))); }); - return input; -} - auto PrintableString(const std::string& participantName) -> std::string { std::string safeName; diff --git a/SilKit/source/util/StringHelpers.hpp b/SilKit/source/util/StringHelpers.hpp index d75770a6d..549df682d 100644 --- a/SilKit/source/util/StringHelpers.hpp +++ b/SilKit/source/util/StringHelpers.hpp @@ -4,10 +4,13 @@ #pragma once +#include #include #include #include +#include + namespace SilKit { namespace Util { @@ -32,3 +35,19 @@ auto SplitString(std::string_view input, const std::string_view& separator) -> s } // namespace Util } // namespace SilKit + + +namespace SilKit { +namespace Util { + +inline auto LowerCase(std::string input) -> std::string +{ + // Note: std::tolower has undefined behavior if the argument is not representable as unsigned char. + std::transform(input.begin(), input.end(), input.begin(), [](unsigned char c) { + return static_cast(std::tolower(static_cast(static_cast(c)))); + }); + return input; +} + +} // namespace Util +} // namespace SilKit