diff --git a/indra/newview/tests/llagentaccess_test.cpp b/indra/newview/tests/llagentaccess_test.cpp index 9a8d8bb61fa845c469cad3928b766d18c52cfa2b..a2db5a54f47dd9e2e525c27768ff451b56a08645 100644 --- a/indra/newview/tests/llagentaccess_test.cpp +++ b/indra/newview/tests/llagentaccess_test.cpp @@ -55,12 +55,12 @@ LLControlVariable* LLControlGroup::declareU32(const std::string& name, U32 initi return NULL; } -void LLControlGroup::setU32(const std::string& name, U32 val) +void LLControlGroup::setU32(const std::string_view name, U32 val) { test_preferred_maturity = val; } -U32 LLControlGroup::getU32(const std::string& name) +U32 LLControlGroup::getU32(const std::string_view name) { return test_preferred_maturity; } diff --git a/indra/newview/tests/lldateutil_test.cpp b/indra/newview/tests/lldateutil_test.cpp index 62158d8f66973fb3d3ee88900f35f23a7761a3ef..ad299448c5fa0c664bc65955e90738d21e7c43ae 100644 --- a/indra/newview/tests/lldateutil_test.cpp +++ b/indra/newview/tests/lldateutil_test.cpp @@ -38,26 +38,31 @@ // Baked-in return values for getString() -std::map< std::string, std::string > gString; +std::map< std::string, std::string, std::less<> > gString; // Baked-in return values for getCountString() // map of pairs of input xml_desc and integer count typedef std::pair< std::string, int > count_string_t; std::map< count_string_t, std::string > gCountString; -std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args, bool def_string) +std::string LLTrans::getString(const std::string_view xml_desc, const LLStringUtil::format_map_t& args, bool def_string) { - std::string text = gString[xml_desc]; - LLStringUtil::format(text, args); - return text; + auto it = gString.find(xml_desc); + if (it != gString.end()) + { + std::string text = it->second; + LLStringUtil::format(text, args); + return text; + } + return {}; } -std::string LLTrans::getCountString(const std::string& language, const std::string& xml_desc, S32 count) +std::string LLTrans::getCountString(const std::string_view language, const std::string_view xml_desc, S32 count) { count_string_t key(xml_desc, count); if (gCountString.find(key) == gCountString.end()) { - return std::string("Couldn't find ") + xml_desc; + return std::string("Couldn't find ") + std::string(xml_desc); } return gCountString[ count_string_t(xml_desc, count) ]; } diff --git a/indra/newview/tests/lllogininstance_test.cpp b/indra/newview/tests/lllogininstance_test.cpp index 57f2d31eabe68f3da8940dac7a00cb21958ceb06..11711a64766333436f64d6255b6a1b0d1ef1d5b6 100644 --- a/indra/newview/tests/lllogininstance_test.cpp +++ b/indra/newview/tests/lllogininstance_test.cpp @@ -188,12 +188,12 @@ LLControlGroup gSavedSettings("Global"); LLControlGroup::LLControlGroup(const std::string& name) : LLInstanceTracker<LLControlGroup, std::string>(name){} LLControlGroup::~LLControlGroup() {} -void LLControlGroup::setBOOL(const std::string& name, BOOL val) {} -BOOL LLControlGroup::getBOOL(const std::string& name) { return FALSE; } -F32 LLControlGroup::getF32(const std::string& name) { return 0.0f; } +void LLControlGroup::setBOOL(const std::string_view name, BOOL val) {} +BOOL LLControlGroup::getBOOL(const std::string_view name) { return FALSE; } +F32 LLControlGroup::getF32(const std::string_view name) { return 0.0f; } U32 LLControlGroup::saveToFile(const std::string& filename, BOOL nondefault_only) { return 1; } -void LLControlGroup::setString(const std::string& name, const std::string& val) {} -std::string LLControlGroup::getString(const std::string& name) { return "test_string"; } +void LLControlGroup::setString(const std::string_view name, const std::string& val) {} +std::string LLControlGroup::getString(const std::string_view name) { return "test_string"; } LLControlVariable* LLControlGroup::declareBOOL(const std::string& name, BOOL initial_val, const std::string& comment, LLControlVariable::ePersist persist) { return NULL; } LLControlVariable* LLControlGroup::declareString(const std::string& name, const std::string &initial_val, const std::string& comment, LLControlVariable::ePersist persist) { return NULL; } diff --git a/indra/newview/tests/llsecapi_test.cpp b/indra/newview/tests/llsecapi_test.cpp index caa3016d2e9e92f0eb061ea2b89c8c0761dff90c..d27126ce2d6c8f22af83c1216b8b3a15bb26a7d0 100644 --- a/indra/newview/tests/llsecapi_test.cpp +++ b/indra/newview/tests/llsecapi_test.cpp @@ -43,8 +43,8 @@ LLControlVariable* LLControlGroup::declareString(const std::string& name, const std::string& initial_val, const std::string& comment, LLControlVariable::ePersist persist) {return NULL;} -void LLControlGroup::setString(const std::string& name, const std::string& val){} -std::string LLControlGroup::getString(const std::string& name) +void LLControlGroup::setString(const std::string_view name, const std::string& val){} +std::string LLControlGroup::getString(const std::string_view name) { return ""; } diff --git a/indra/newview/tests/llsechandler_basic_test.cpp b/indra/newview/tests/llsechandler_basic_test.cpp index e5d226a2a4966cea58d25fca2939073d71e424f6..15ca66ee013ccf352a2d10745df8b09c4116c91d 100644 --- a/indra/newview/tests/llsechandler_basic_test.cpp +++ b/indra/newview/tests/llsechandler_basic_test.cpp @@ -78,8 +78,8 @@ LLControlVariable* LLControlGroup::declareString(const std::string& name, const std::string& initial_val, const std::string& comment, LLControlVariable::ePersist persist) {return NULL;} -void LLControlGroup::setString(const std::string& name, const std::string& val){} -std::string LLControlGroup::getString(const std::string& name) +void LLControlGroup::setString(const std::string_view name, const std::string& val){} +std::string LLControlGroup::getString(const std::string_view name) { if (name == "FirstName") @@ -90,7 +90,7 @@ std::string LLControlGroup::getString(const std::string& name) } // Stub for --no-verify-ssl-cert -BOOL LLControlGroup::getBOOL(const std::string& name) { return FALSE; } +BOOL LLControlGroup::getBOOL(const std::string_view name) { return FALSE; } LLSD LLCredential::getLoginParams() { diff --git a/indra/newview/tests/llslurl_test.cpp b/indra/newview/tests/llslurl_test.cpp index 6a1b96f75a45ec3efa55a4a34b0d50fb85f1cff8..d341f8c0c1c6daeede5802a73ec3569ee09e526c 100644 --- a/indra/newview/tests/llslurl_test.cpp +++ b/indra/newview/tests/llslurl_test.cpp @@ -46,10 +46,10 @@ static const char * const TEST_FILENAME("llslurl_test.xml"); class LLTrans { public: - static std::string getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args, bool def_string = false); + static std::string getString(std::string_view xml_desc, const LLStringUtil::format_map_t& args, bool def_string = false); }; -std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args, bool def_string) +std::string LLTrans::getString(const std::string_view xml_desc, const LLStringUtil::format_map_t& args, bool def_string) { return std::string(); } @@ -58,7 +58,7 @@ std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil:: // Stub implementation to get the test to compile properly #include "../rlvhandler.h" -const std::string& RlvStrings::getString(const std::string& strStringName) +const std::string& RlvStrings::getString(const std::string_view strStringName) { static const std::string strMissing = "(Missing RLVa string)"; return strMissing; @@ -100,14 +100,14 @@ LLControlVariable* LLControlGroup::declareString(const std::string& name, const std::string& initial_val, const std::string& comment, LLControlVariable::ePersist persist) {return NULL;} -void LLControlGroup::setString(const std::string& name, const std::string& val){} +void LLControlGroup::setString(const std::string_view name, const std::string& val){} std::string gCmdLineLoginURI; std::string gCmdLineGridChoice; std::string gCmdLineHelperURI; std::string gLoginPage; std::string gCurrentGrid; -std::string LLControlGroup::getString(const std::string& name) +std::string LLControlGroup::getString(const std::string_view name) { if (name == "CmdLineGridChoice") return gCmdLineGridChoice; @@ -120,7 +120,7 @@ std::string LLControlGroup::getString(const std::string& name) return ""; } -LLSD LLControlGroup::getLLSD(const std::string& name) +LLSD LLControlGroup::getLLSD(const std::string_view name) { if (name == "CmdLineLoginURI") { @@ -132,7 +132,7 @@ LLSD LLControlGroup::getLLSD(const std::string& name) return LLSD(); } -LLPointer<LLControlVariable> LLControlGroup::getControl(const std::string& name) +LLPointer<LLControlVariable> LLControlGroup::getControl(const std::string_view name) { ctrl_name_table_t::iterator iter = mNameTable.find(name); return iter == mNameTable.end() ? LLPointer<LLControlVariable>() : iter->second; diff --git a/indra/newview/tests/llviewerhelputil_test.cpp b/indra/newview/tests/llviewerhelputil_test.cpp index f6456a28392b5af902743800117c0c60203f4127..d4b6b68d24da3ff219171e4a2399c2479cc5495f 100644 --- a/indra/newview/tests/llviewerhelputil_test.cpp +++ b/indra/newview/tests/llviewerhelputil_test.cpp @@ -53,8 +53,8 @@ LLControlVariable* LLControlGroup::declareString(const std::string& name, const std::string& initial_val, const std::string& comment, LLControlVariable::ePersist persist) {return NULL;} -void LLControlGroup::setString(const std::string& name, const std::string& val){} -std::string LLControlGroup::getString(const std::string& name) +void LLControlGroup::setString(const std::string_view name, const std::string& val){} +std::string LLControlGroup::getString(const std::string_view name) { if (name == "HelpURLFormat") return gHelpURL; diff --git a/indra/newview/tests/llviewernetwork_test.cpp b/indra/newview/tests/llviewernetwork_test.cpp index 9fc9ca01ac8d09ed40489050e3727df7e6996ae7..b46b9ecfc572dd497a862ec4484560f5a80bd4c2 100644 --- a/indra/newview/tests/llviewernetwork_test.cpp +++ b/indra/newview/tests/llviewernetwork_test.cpp @@ -45,10 +45,10 @@ static const char * const TEST_FILENAME("llviewernetwork_test.xml"); class LLTrans { public: - static std::string getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args, bool def_string = false); + static std::string getString(const std::string_view xml_desc, const LLStringUtil::format_map_t& args, bool def_string = false); }; -std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args, bool def_string) +std::string LLTrans::getString(const std::string_view xml_desc, const LLStringUtil::format_map_t& args, bool def_string) { std::string grid_label = std::string(); if(xml_desc == "AgniGridLabel") @@ -73,14 +73,14 @@ LLControlVariable* LLControlGroup::declareString(const std::string& name, const std::string& initial_val, const std::string& comment, LLControlVariable::ePersist persist) {return NULL;} -void LLControlGroup::setString(const std::string& name, const std::string& val){} +void LLControlGroup::setString(const std::string_view name, const std::string& val){} std::string gCmdLineLoginURI; std::string gCmdLineGridChoice; std::string gCmdLineHelperURI; std::string gLoginPage; std::string gCurrentGrid; -std::string LLControlGroup::getString(const std::string& name) +std::string LLControlGroup::getString(const std::string_view name) { if (name == "CmdLineGridChoice") return gCmdLineGridChoice; @@ -93,7 +93,7 @@ std::string LLControlGroup::getString(const std::string& name) return ""; } -LLSD LLControlGroup::getLLSD(const std::string& name) +LLSD LLControlGroup::getLLSD(const std::string_view name) { if (name == "CmdLineLoginURI") { @@ -105,7 +105,7 @@ LLSD LLControlGroup::getLLSD(const std::string& name) return LLSD(); } -LLPointer<LLControlVariable> LLControlGroup::getControl(const std::string& name) +LLPointer<LLControlVariable> LLControlGroup::getControl(const std::string_view name) { ctrl_name_table_t::iterator iter = mNameTable.find(name); return iter == mNameTable.end() ? LLPointer<LLControlVariable>() : iter->second; diff --git a/indra/newview/tests/llworldmap_test.cpp b/indra/newview/tests/llworldmap_test.cpp index f1dd8acccf10936bffc6abfd983f1a8ada5c883c..c765f83a188550e303165992edfc1220381632b0 100644 --- a/indra/newview/tests/llworldmap_test.cpp +++ b/indra/newview/tests/llworldmap_test.cpp @@ -66,7 +66,7 @@ void LLWorldMipmap::equalizeBoostLevels() { } LLPointer<LLViewerFetchedTexture> LLWorldMipmap::getObjectsTile(U32 grid_x, U32 grid_y, S32 level, bool load) { return NULL; } // Stub other stuff -std::string LLTrans::getString(const std::string &, const LLStringUtil::format_map_t&, bool def_string) { return std::string("test_trans"); } +std::string LLTrans::getString(const std::string_view, const LLStringUtil::format_map_t&, bool def_string) { return std::string("test_trans"); } void LLUIString::updateResult() const { } void LLUIString::setArg(const std::string& , const std::string& ) { } void LLUIString::assign(const std::string& ) { } diff --git a/indra/newview/tests/llworldmipmap_test.cpp b/indra/newview/tests/llworldmipmap_test.cpp index 142d75bcfd523689f275f60091377f13c6e164a0..cf6cd61262ee69f050b9c8a692ea69e831d2b142 100644 --- a/indra/newview/tests/llworldmipmap_test.cpp +++ b/indra/newview/tests/llworldmipmap_test.cpp @@ -48,7 +48,7 @@ LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromUrl(const s LLControlGroup::LLControlGroup(const std::string& name) : LLInstanceTracker<LLControlGroup, std::string>(name) { } LLControlGroup::~LLControlGroup() { } -std::string LLControlGroup::getString(const std::string& ) { return std::string("test_url"); } +std::string LLControlGroup::getString(const std::string_view) { return std::string("test_url"); } LLControlGroup gSavedSettings("test_settings"); // End Stubbing