summaryrefslogtreecommitdiff
path: root/indra/llui/lltrans.h
diff options
context:
space:
mode:
authorRye Mutt <rye@alchemyviewer.org>2024-07-01 22:50:39 -0400
committerRye Mutt <rye@alchemyviewer.org>2024-07-01 22:50:39 -0400
commit3fa6db9603a020402eea8c61622b0cab27dbcca3 (patch)
tree67729f34cb6230cff774469e8597eab945bca122 /indra/llui/lltrans.h
parent0460d9a5e84599316e505ae25b3f9a8148adb3fa (diff)
Reduce string temporaries from LLTrans
Diffstat (limited to 'indra/llui/lltrans.h')
-rw-r--r--indra/llui/lltrans.h23
1 files changed, 11 insertions, 12 deletions
diff --git a/indra/llui/lltrans.h b/indra/llui/lltrans.h
index 4f38ef9067..3492ed0169 100644
--- a/indra/llui/lltrans.h
+++ b/indra/llui/lltrans.h
@@ -76,12 +76,12 @@ public:
* @param args A list of substrings to replace in the string
* @returns Translated string
*/
- static std::string getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args, bool def_string = false);
- static std::string getDefString(const std::string &xml_desc, const LLStringUtil::format_map_t& args);
- static std::string getString(const std::string &xml_desc, const LLSD& args, bool def_string = false);
- static std::string getDefString(const std::string &xml_desc, const LLSD& args);
- static bool findString(std::string &result, const std::string &xml_desc, const LLStringUtil::format_map_t& args);
- static bool findString(std::string &result, const std::string &xml_desc, const LLSD& args);
+ static std::string getString(std::string_view xml_desc, const LLStringUtil::format_map_t& args, bool def_string = false);
+ static std::string getDefString(std::string_view xml_desc, const LLStringUtil::format_map_t& args);
+ static std::string getString(std::string_view xml_desc, const LLSD& args, bool def_string = false);
+ static std::string getDefString(std::string_view xml_desc, const LLSD& args);
+ static bool findString(std::string &result, std::string_view xml_desc, const LLStringUtil::format_map_t& args);
+ static bool findString(std::string &result, std::string_view xml_desc, const LLSD& args);
// Returns translated string with [COUNT] replaced with a number, following
// special per-language logic for plural nouns. For example, some languages
@@ -94,23 +94,22 @@ public:
* @param xml_desc String's description
* @returns Translated string
*/
- static std::string getString(const std::string &xml_desc, bool def_string = false)
+ static std::string getString(std::string_view xml_desc, bool def_string = false)
{
LLStringUtil::format_map_t empty;
return getString(xml_desc, empty);
}
- static bool findString(std::string &result, const std::string &xml_desc)
+ static bool findString(std::string &result, std::string_view xml_desc)
{
LLStringUtil::format_map_t empty;
return findString(result, xml_desc, empty);
}
- static std::string getKeyboardString(const char* keystring)
+ static std::string getKeyboardString(const std::string_view keystring)
{
- std::string key_str(keystring);
std::string trans_str;
- return findString(trans_str, key_str) ? trans_str : key_str;
+ return findString(trans_str, keystring) ? trans_str : std::string(keystring);
}
// get the default args
@@ -128,7 +127,7 @@ public:
}
private:
- typedef std::map<std::string, LLTransTemplate > template_map_t;
+ typedef std::map<std::string, LLTransTemplate, std::less<>> template_map_t;
static template_map_t sStringTemplates;
static template_map_t sDefaultStringTemplates;
static LLStringUtil::format_map_t sDefaultArgs;