From 16002ec0c82a59082f670f9364834764f627f835 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Sat, 5 Oct 2024 15:25:48 +0200 Subject: add GameControl feature --- indra/llcommon/llstring.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'indra/llcommon/llstring.cpp') diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index 07adf71d18..ab4d724ae4 100644 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -1119,18 +1119,27 @@ void LLStringOps::setupDayFormat(const std::string& data) } -std::string LLStringOps::getDatetimeCode (std::string key) +std::string LLStringOps::getDatetimeCode(std::string key) { - std::map::iterator iter; + std::map::iterator iter = datetimeToCodes.find(key); + return iter == datetimeToCodes.end() ? LLStringUtil::null : iter->second; +} - iter = datetimeToCodes.find (key); - if (iter != datetimeToCodes.end()) +void LLStringOps::splitString(const std::string& text, char delimiter, + std::function handler) +{ + std::size_t from = 0; + for (std::size_t i = 0; i < text.size(); ++i) { - return iter->second; + if (text[i] == delimiter) + { + handler(text.substr(from, i - from)); + from = i + 1; + } } - else + if (from <= text.size()) { - return std::string(""); + handler(text.substr(from)); } } -- cgit v1.3 From 22ab2bc3b1e7bf6dc2db584778fa0d4ecafe1e29 Mon Sep 17 00:00:00 2001 From: Kyler Eastridge Date: Tue, 13 Jan 2026 18:13:33 -0500 Subject: Change parameter type to const reference in getDatetimeCode --- indra/llcommon/llstring.cpp | 2 +- indra/llcommon/llstring.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llcommon/llstring.cpp') diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index ab4d724ae4..892671099e 100644 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -1119,7 +1119,7 @@ void LLStringOps::setupDayFormat(const std::string& data) } -std::string LLStringOps::getDatetimeCode(std::string key) +std::string LLStringOps::getDatetimeCode(const std::string& key) { std::map::iterator iter = datetimeToCodes.find(key); return iter == datetimeToCodes.end() ? LLStringUtil::null : iter->second; diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index 263d39c01a..fdbaaaac53 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -211,7 +211,7 @@ public: // currently in daylight savings time? static bool getPacificDaylightTime(void) { return sPacificDaylightTime;} - static std::string getDatetimeCode (std::string key); + static std::string getDatetimeCode (const std::string& key); static void splitString(const std::string& text, char delimiter, std::function handler); -- cgit v1.3