summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/llui/lltrans.cpp24
-rw-r--r--indra/llui/lltrans.h23
-rw-r--r--indra/llwindow/llkeyboard.cpp4
-rw-r--r--indra/llwindow/llkeyboard.h2
-rw-r--r--indra/newview/lllogininstance.cpp2
5 files changed, 27 insertions, 28 deletions
diff --git a/indra/llui/lltrans.cpp b/indra/llui/lltrans.cpp
index 6c7e472a87..8410031653 100644
--- a/indra/llui/lltrans.cpp
+++ b/indra/llui/lltrans.cpp
@@ -65,7 +65,7 @@ bool LLTrans::parseStrings(LLXMLNodePtr &root, const std::set<std::string>& defa
if (!root->hasName("strings"))
{
LL_ERRS() << "Invalid root node name in " << xml_filename
- << ": was " << root->getName() << ", expected \"strings\"" << LL_ENDL;
+ << ": was " << root->getName()->mString << ", expected \"strings\"" << LL_ENDL;
}
StringTable string_table;
@@ -113,7 +113,7 @@ bool LLTrans::parseLanguageStrings(LLXMLNodePtr &root)
if (!root->hasName("strings"))
{
LL_ERRS() << "Invalid root node name in " << xml_filename
- << ": was " << root->getName() << ", expected \"strings\"" << LL_ENDL;
+ << ": was " << root->getName()->mString << ", expected \"strings\"" << LL_ENDL;
}
StringTable string_table;
@@ -143,7 +143,7 @@ bool LLTrans::parseLanguageStrings(LLXMLNodePtr &root)
static LLTrace::BlockTimerStatHandle FTM_GET_TRANS("Translate string");
//static
-std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::format_map_t& msg_args, bool def_string)
+std::string LLTrans::getString(std::string_view xml_desc, const LLStringUtil::format_map_t& msg_args, bool def_string)
{
// Don't care about time as much as call count. Make sure we're not
// calling LLTrans::getString() in an inner loop. JC
@@ -167,12 +167,12 @@ std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::
else
{
LL_WARNS_ONCE("configuration") << "Missing String in strings.xml: [" << xml_desc << "]" << LL_ENDL;
- return "MissingString("+xml_desc+")";
+ return "MissingString(" + std::string(xml_desc) + ")";
}
}
//static
-std::string LLTrans::getDefString(const std::string &xml_desc, const LLStringUtil::format_map_t& msg_args)
+std::string LLTrans::getDefString(std::string_view xml_desc, const LLStringUtil::format_map_t& msg_args)
{
template_map_t::iterator iter = sDefaultStringTemplates.find(xml_desc);
if (iter != sDefaultStringTemplates.end())
@@ -187,12 +187,12 @@ std::string LLTrans::getDefString(const std::string &xml_desc, const LLStringUti
else
{
LL_WARNS_ONCE("configuration") << "Missing String in strings.xml: [" << xml_desc << "]" << LL_ENDL;
- return "MissingString(" + xml_desc + ")";
+ return "MissingString(" + std::string(xml_desc) + ")";
}
}
//static
-std::string LLTrans::getString(const std::string &xml_desc, const LLSD& msg_args, bool def_string)
+std::string LLTrans::getString(std::string_view xml_desc, const LLSD& msg_args, bool def_string)
{
// Don't care about time as much as call count. Make sure we're not
// calling LLTrans::getString() in an inner loop. JC
@@ -213,12 +213,12 @@ std::string LLTrans::getString(const std::string &xml_desc, const LLSD& msg_args
else
{
LL_WARNS_ONCE("configuration") << "Missing String in strings.xml: [" << xml_desc << "]" << LL_ENDL;
- return "MissingString("+xml_desc+")";
+ return "MissingString(" + std::string(xml_desc) + ")";
}
}
//static
-std::string LLTrans::getDefString(const std::string &xml_desc, const LLSD& msg_args)
+std::string LLTrans::getDefString(std::string_view xml_desc, const LLSD& msg_args)
{
template_map_t::iterator iter = sDefaultStringTemplates.find(xml_desc);
if (iter != sDefaultStringTemplates.end())
@@ -230,12 +230,12 @@ std::string LLTrans::getDefString(const std::string &xml_desc, const LLSD& msg_a
else
{
LL_WARNS_ONCE("configuration") << "Missing String in strings.xml: [" << xml_desc << "]" << LL_ENDL;
- return "MissingString(" + xml_desc + ")";
+ return "MissingString(" + std::string(xml_desc) + ")";
}
}
//static
-bool LLTrans::findString(std::string &result, const std::string &xml_desc, const LLStringUtil::format_map_t& msg_args)
+bool LLTrans::findString(std::string &result, std::string_view xml_desc, const LLStringUtil::format_map_t& msg_args)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_UI;
@@ -257,7 +257,7 @@ bool LLTrans::findString(std::string &result, const std::string &xml_desc, const
}
//static
-bool LLTrans::findString(std::string &result, const std::string &xml_desc, const LLSD& msg_args)
+bool LLTrans::findString(std::string &result, std::string_view xml_desc, const LLSD& msg_args)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_UI;
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;
diff --git a/indra/llwindow/llkeyboard.cpp b/indra/llwindow/llkeyboard.cpp
index 4f29fb0b0a..33eebdadd1 100644
--- a/indra/llwindow/llkeyboard.cpp
+++ b/indra/llwindow/llkeyboard.cpp
@@ -359,7 +359,7 @@ std::string LLKeyboard::stringFromKey(KEY key, bool translate)
LLKeyStringTranslatorFunc *trans = gKeyboard->mStringTranslator;
if (trans != NULL)
{
- res = trans(res.c_str());
+ res = trans(res);
}
}
@@ -399,7 +399,7 @@ std::string LLKeyboard::stringFromMouse(EMouseClickType click, bool translate)
LLKeyStringTranslatorFunc* trans = gKeyboard->mStringTranslator;
if (trans != NULL)
{
- res = trans(res.c_str());
+ res = trans(res);
}
}
return res;
diff --git a/indra/llwindow/llkeyboard.h b/indra/llwindow/llkeyboard.h
index 7f8d0af155..713eb7aec2 100644
--- a/indra/llwindow/llkeyboard.h
+++ b/indra/llwindow/llkeyboard.h
@@ -42,7 +42,7 @@ enum EKeystate
};
typedef boost::function<bool(EKeystate keystate)> LLKeyFunc;
-typedef std::string (LLKeyStringTranslatorFunc)(const char *label);
+typedef std::string (LLKeyStringTranslatorFunc)(std::string_view);
enum EKeyboardInsertMode
{
diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp
index d015c0ed95..f37926a938 100644
--- a/indra/newview/lllogininstance.cpp
+++ b/indra/newview/lllogininstance.cpp
@@ -447,7 +447,7 @@ void LLLoginInstance::handleLoginFailure(const LLSD& event)
gViewerWindow->setShowProgress(false);
}
- showMFAChallange(LLTrans::getString(response["message_id"]));
+ showMFAChallange(LLTrans::getString(response["message_id"].asString()));
}
else if( reason_response == "key"
|| reason_response == "presence"