diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 05c1838dfeeedff66ab7a9d5820c4c4da0358f22..ac112281fd2a8263ebee9e71fb316b75fbe6fabf 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -217,7 +217,7 @@ LLNotificationForm::LLNotificationForm(const std::string& name, const LLNotifica BOOL show_notification = TRUE; if (p.ignore.control.isProvided()) { - mIgnoreSetting = ui_inst->mSettingGroups["config"]->getControl(p.ignore.control); + mIgnoreSetting = ui_inst->mSettingGroups["config"]->getControl(p.ignore.control.getValue()); mInvertSetting = p.ignore.invert_control; } else if (mIgnore > IGNORE_NO) @@ -424,7 +424,7 @@ LLNotificationTemplate::LLNotificationTemplate(const LLNotificationTemplate::Par mSoundName("") { if (p.sound.isProvided() - && LLUI::getInstance()->mSettingGroups["config"]->controlExists(p.sound)) + && LLUI::getInstance()->mSettingGroups["config"]->controlExists(p.sound.getValue())) { mSoundName = p.sound; } diff --git a/indra/llxml/llcontrol.cpp b/indra/llxml/llcontrol.cpp index 63c82f04f5ed677e21e2f614cf44cc8af9e3a2a8..b6bb17d854a1544e834b4da1d5ca72368201767a 100644 --- a/indra/llxml/llcontrol.cpp +++ b/indra/llxml/llcontrol.cpp @@ -86,22 +86,22 @@ template <> LLSD convert_to_llsd<LLColor4>(const LLColor4& in); template <> LLSD convert_to_llsd<LLColor3>(const LLColor3& in); template <> LLSD convert_to_llsd<LLColor4U>(const LLColor4U& in); -template <> bool convert_from_llsd<bool>(const LLSD& sd, eControlType type, const std::string& control_name); -template <> S32 convert_from_llsd<S32>(const LLSD& sd, eControlType type, const std::string& control_name); -template <> U32 convert_from_llsd<U32>(const LLSD& sd, eControlType type, const std::string& control_name); -template <> F32 convert_from_llsd<F32>(const LLSD& sd, eControlType type, const std::string& control_name); -template <> std::string convert_from_llsd<std::string>(const LLSD& sd, eControlType type, const std::string& control_name); -template <> LLWString convert_from_llsd<LLWString>(const LLSD& sd, eControlType type, const std::string& control_name); -template <> LLVector3 convert_from_llsd<LLVector3>(const LLSD& sd, eControlType type, const std::string& control_name); -template <> LLVector3d convert_from_llsd<LLVector3d>(const LLSD& sd, eControlType type, const std::string& control_name); -template <> LLVector4 convert_from_llsd<LLVector4>(const LLSD& sd, eControlType type, const std::string& control_name); -template <> LLQuaternion convert_from_llsd<LLQuaternion>(const LLSD& sd, eControlType type, const std::string& control_name); -template <> LLRect convert_from_llsd<LLRect>(const LLSD& sd, eControlType type, const std::string& control_name); -template <> LLColor4 convert_from_llsd<LLColor4>(const LLSD& sd, eControlType type, const std::string& control_name); -template <> LLColor4U convert_from_llsd<LLColor4U>(const LLSD& sd, eControlType type, const std::string& control_name); -template <> LLColor3 convert_from_llsd<LLColor3>(const LLSD& sd, eControlType type, const std::string& control_name); -template <> LLUUID convert_from_llsd<LLUUID>(const LLSD& sd, eControlType type, const std::string& control_name); -template <> LLSD convert_from_llsd<LLSD>(const LLSD& sd, eControlType type, const std::string& control_name); +template <> bool convert_from_llsd<bool>(const LLSD& sd, eControlType type, std::string_view control_name); +template <> S32 convert_from_llsd<S32>(const LLSD& sd, eControlType type, std::string_view control_name); +template <> U32 convert_from_llsd<U32>(const LLSD& sd, eControlType type, std::string_view control_name); +template <> F32 convert_from_llsd<F32>(const LLSD& sd, eControlType type, std::string_view control_name); +template <> std::string convert_from_llsd<std::string>(const LLSD& sd, eControlType type, std::string_view control_name); +template <> LLWString convert_from_llsd<LLWString>(const LLSD& sd, eControlType type, std::string_view control_name); +template <> LLVector3 convert_from_llsd<LLVector3>(const LLSD& sd, eControlType type, std::string_view control_name); +template <> LLVector3d convert_from_llsd<LLVector3d>(const LLSD& sd, eControlType type, std::string_view control_name); +template <> LLVector4 convert_from_llsd<LLVector4>(const LLSD& sd, eControlType type, std::string_view control_name); +template <> LLQuaternion convert_from_llsd<LLQuaternion>(const LLSD& sd, eControlType type, std::string_view control_name); +template <> LLRect convert_from_llsd<LLRect>(const LLSD& sd, eControlType type, std::string_view control_name); +template <> LLColor4 convert_from_llsd<LLColor4>(const LLSD& sd, eControlType type, std::string_view control_name); +template <> LLColor4U convert_from_llsd<LLColor4U>(const LLSD& sd, eControlType type, std::string_view control_name); +template <> LLColor3 convert_from_llsd<LLColor3>(const LLSD& sd, eControlType type, std::string_view control_name); +template <> LLUUID convert_from_llsd<LLUUID>(const LLSD& sd, eControlType type, std::string_view control_name); +template <> LLSD convert_from_llsd<LLSD>(const LLSD& sd, eControlType type, std::string_view control_name); //this defines the current version of the settings file const S32 CURRENT_VERSION = 101; @@ -112,7 +112,7 @@ const S32 CURRENT_VERSION = 101; // by SETTINGS_PROFILE below. Only settings with an average access rate >= 2/second are output. typedef std::pair<std::string, U32> settings_pair_t; typedef std::vector<settings_pair_t> settings_vec_t; -LLSD getCount; +std::map<std::string, int, std::less<>> getCount; settings_vec_t getCount_v; F64 start_time = 0; std::string SETTINGS_PROFILE = "settings_profile.log"; @@ -164,11 +164,11 @@ bool LLControlVariable::llsd_compare(const LLSD& a, const LLSD & b) return result; } -LLControlVariable::LLControlVariable(const std::string& name, eControlType type, - LLSD initial, const std::string& comment, +LLControlVariable::LLControlVariable(const std::string name, eControlType type, + LLSD initial, const std::string comment, ePersist persist, bool hidefromsettingseditor) - : mName(name), - mComment(comment), + : mName(std::move(name)), + mComment(std::move(comment)), mType(type), mPersist(persist), mHideFromSettingsEditor(hidefromsettingseditor) @@ -300,9 +300,9 @@ void LLControlVariable::setHiddenFromSettingsEditor(bool hide) mHideFromSettingsEditor = hide; } -void LLControlVariable::setComment(const std::string& comment) +void LLControlVariable::setComment(const std::string comment) { - mComment = comment; + mComment = std::move(comment); } void LLControlVariable::resetToDefault(bool fire_signal) @@ -367,7 +367,7 @@ void LLControlVariable::firePropertyChanged(const LLSD &pPreviousValue) } } -LLPointer<LLControlVariable> LLControlGroup::getControl(const std::string& name) +LLPointer<LLControlVariable> LLControlGroup::getControl(std::string_view name) { if (mSettingsProfile) { @@ -444,9 +444,9 @@ void LLControlGroup::cleanup() LL_WARNS("SettingsProfile") << "Failed to write settings profile header" << LL_ENDL; } - for (LLSD::map_const_iterator iter = getCount.beginMap(); iter != getCount.endMap(); ++iter) + for (const auto& [first, second] : getCount) { - getCount_v.push_back(settings_pair_t(iter->first, iter->second.asInteger())); + getCount_v.emplace_back(first, second); } sort(getCount_v.begin(), getCount_v.end(), compareRoutine); @@ -469,7 +469,7 @@ void LLControlGroup::cleanup() } } } - getCount = LLSD::emptyMap(); + getCount.clear(); fclose(out); } } @@ -589,51 +589,59 @@ LLControlVariable* LLControlGroup::declareLLSD(const std::string& name, const LL return declareControl(name, TYPE_LLSD, initial_val, comment, persist); } -void LLControlGroup::incrCount(const std::string& name) +void LLControlGroup::incrCount(std::string_view name) { if (0.0 == start_time) { start_time = LLTimer::getTotalSeconds(); } - getCount[name] = getCount[name].asInteger() + 1; + auto it = getCount.find(name); + if (it != getCount.end()) + { + it->second = it->second + 1; + } + else + { + getCount.emplace(name, 1); + } } -BOOL LLControlGroup::getBOOL(const std::string& name) +BOOL LLControlGroup::getBOOL(std::string_view name) { return (BOOL)get<bool>(name); } -bool LLControlGroup::getBool(const std::string& name) +bool LLControlGroup::getBool(std::string_view name) { return get<bool>(name); } -S32 LLControlGroup::getS32(const std::string& name) +S32 LLControlGroup::getS32(std::string_view name) { return get<S32>(name); } -U32 LLControlGroup::getU32(const std::string& name) +U32 LLControlGroup::getU32(std::string_view name) { return get<U32>(name); } -F32 LLControlGroup::getF32(const std::string& name) +F32 LLControlGroup::getF32(std::string_view name) { return get<F32>(name); } -std::string LLControlGroup::getString(const std::string& name) +std::string LLControlGroup::getString(std::string_view name) { return get<std::string>(name); } -LLWString LLControlGroup::getWString(const std::string& name) +LLWString LLControlGroup::getWString(std::string_view name) { return get<LLWString>(name); } -std::string LLControlGroup::getText(const std::string& name) +std::string LLControlGroup::getText(std::string_view name) { std::string utf8_string = getString(name); LLStringUtil::replaceChar(utf8_string, '^', '\n'); @@ -641,59 +649,59 @@ std::string LLControlGroup::getText(const std::string& name) return (utf8_string); } -LLVector3 LLControlGroup::getVector3(const std::string& name) +LLVector3 LLControlGroup::getVector3(std::string_view name) { return get<LLVector3>(name); } -LLVector3d LLControlGroup::getVector3d(const std::string& name) +LLVector3d LLControlGroup::getVector3d(std::string_view name) { return get<LLVector3d>(name); } -LLVector4 LLControlGroup::getVector4(const std::string& name) +LLVector4 LLControlGroup::getVector4(std::string_view name) { return get<LLVector4>(name); } -LLQuaternion LLControlGroup::getQuaternion(const std::string& name) +LLQuaternion LLControlGroup::getQuaternion(std::string_view name) { return get<LLQuaternion>(name); } -LLRect LLControlGroup::getRect(const std::string& name) +LLRect LLControlGroup::getRect(std::string_view name) { return get<LLRect>(name); } -LLColor4 LLControlGroup::getColor(const std::string& name) +LLColor4 LLControlGroup::getColor(std::string_view name) { return get<LLColor4>(name); } -LLColor4 LLControlGroup::getColor4(const std::string& name) +LLColor4 LLControlGroup::getColor4(std::string_view name) { return get<LLColor4>(name); } -LLColor3 LLControlGroup::getColor3(const std::string& name) +LLColor3 LLControlGroup::getColor3(std::string_view name) { return get<LLColor3>(name); } -LLUUID LLControlGroup::getUUID(const std::string& name) +LLUUID LLControlGroup::getUUID(std::string_view name) { return get<LLUUID>(name); } -LLSD LLControlGroup::getLLSD(const std::string& name) +LLSD LLControlGroup::getLLSD(std::string_view name) { return get<LLSD>(name); } -BOOL LLControlGroup::controlExists(const std::string& name) +BOOL LLControlGroup::controlExists(std::string_view name) { ctrl_name_table_t::iterator iter = mNameTable.find(name); return iter != mNameTable.end(); @@ -704,77 +712,77 @@ BOOL LLControlGroup::controlExists(const std::string& name) // Set functions //------------------------------------------------------------------- -void LLControlGroup::setBOOL(const std::string& name, BOOL val) +void LLControlGroup::setBOOL(std::string_view name, BOOL val) { set<bool>(name, val); } -void LLControlGroup::setS32(const std::string& name, S32 val) +void LLControlGroup::setS32(std::string_view name, S32 val) { set(name, val); } -void LLControlGroup::setF32(const std::string& name, F32 val) +void LLControlGroup::setF32(std::string_view name, F32 val) { set(name, val); } -void LLControlGroup::setU32(const std::string& name, U32 val) +void LLControlGroup::setU32(std::string_view name, U32 val) { set(name, val); } -void LLControlGroup::setString(const std::string& name, const std::string &val) +void LLControlGroup::setString(std::string_view name, const std::string &val) { set(name, val); } -void LLControlGroup::setVector3(const std::string& name, const LLVector3 &val) +void LLControlGroup::setVector3(std::string_view name, const LLVector3 &val) { set(name, val); } -void LLControlGroup::setVector3d(const std::string& name, const LLVector3d &val) +void LLControlGroup::setVector3d(std::string_view name, const LLVector3d &val) { set(name, val); } -void LLControlGroup::setQuaternion(const std::string& name, const LLQuaternion &val) +void LLControlGroup::setQuaternion(std::string_view name, const LLQuaternion &val) { set(name, val); } -void LLControlGroup::setVector4(const std::string& name, const LLVector4& val) +void LLControlGroup::setVector4(std::string_view name, const LLVector4& val) { set(name, val); } -void LLControlGroup::setRect(const std::string& name, const LLRect &val) +void LLControlGroup::setRect(std::string_view name, const LLRect &val) { set(name, val); } -void LLControlGroup::setColor4(const std::string& name, const LLColor4 &val) +void LLControlGroup::setColor4(std::string_view name, const LLColor4 &val) { set(name, val); } -void LLControlGroup::setUUID(const std::string& name, const LLUUID& val) +void LLControlGroup::setUUID(std::string_view name, const LLUUID& val) { set(name, val); } -void LLControlGroup::setLLSD(const std::string& name, const LLSD& val) +void LLControlGroup::setLLSD(std::string_view name, const LLSD& val) { set(name, val); } -void LLControlGroup::setUntypedValue(const std::string& name, const LLSD& val) +void LLControlGroup::setUntypedValue(std::string_view name, const LLSD& val) { if (name.empty()) { @@ -1420,7 +1428,7 @@ template <> LLSD convert_to_llsd<LLColor4U>(const LLColor4U& in) template<> -bool convert_from_llsd<bool>(const LLSD& sd, eControlType type, const std::string& control_name) +bool convert_from_llsd<bool>(const LLSD& sd, eControlType type, std::string_view control_name) { if (type == TYPE_BOOLEAN) return sd.asBoolean(); @@ -1432,7 +1440,7 @@ bool convert_from_llsd<bool>(const LLSD& sd, eControlType type, const std::strin } template<> -S32 convert_from_llsd<S32>(const LLSD& sd, eControlType type, const std::string& control_name) +S32 convert_from_llsd<S32>(const LLSD& sd, eControlType type, std::string_view control_name) { if (type == TYPE_S32) return sd.asInteger(); @@ -1444,7 +1452,7 @@ S32 convert_from_llsd<S32>(const LLSD& sd, eControlType type, const std::string& } template<> -U32 convert_from_llsd<U32>(const LLSD& sd, eControlType type, const std::string& control_name) +U32 convert_from_llsd<U32>(const LLSD& sd, eControlType type, std::string_view control_name) { if (type == TYPE_U32) return sd.asInteger(); @@ -1456,7 +1464,7 @@ U32 convert_from_llsd<U32>(const LLSD& sd, eControlType type, const std::string& } template<> -F32 convert_from_llsd<F32>(const LLSD& sd, eControlType type, const std::string& control_name) +F32 convert_from_llsd<F32>(const LLSD& sd, eControlType type, std::string_view control_name) { if (type == TYPE_F32) return (F32) sd.asReal(); @@ -1468,7 +1476,7 @@ F32 convert_from_llsd<F32>(const LLSD& sd, eControlType type, const std::string& } template<> -std::string convert_from_llsd<std::string>(const LLSD& sd, eControlType type, const std::string& control_name) +std::string convert_from_llsd<std::string>(const LLSD& sd, eControlType type, std::string_view control_name) { if (type == TYPE_STRING) return sd.asString(); @@ -1480,13 +1488,13 @@ std::string convert_from_llsd<std::string>(const LLSD& sd, eControlType type, co } template<> -LLWString convert_from_llsd<LLWString>(const LLSD& sd, eControlType type, const std::string& control_name) +LLWString convert_from_llsd<LLWString>(const LLSD& sd, eControlType type, std::string_view control_name) { return utf8str_to_wstring(convert_from_llsd<std::string>(sd, type, control_name)); } template<> -LLVector3 convert_from_llsd<LLVector3>(const LLSD& sd, eControlType type, const std::string& control_name) +LLVector3 convert_from_llsd<LLVector3>(const LLSD& sd, eControlType type, std::string_view control_name) { if (type == TYPE_VEC3) return (LLVector3)sd; @@ -1498,7 +1506,7 @@ LLVector3 convert_from_llsd<LLVector3>(const LLSD& sd, eControlType type, const } template<> -LLVector3d convert_from_llsd<LLVector3d>(const LLSD& sd, eControlType type, const std::string& control_name) +LLVector3d convert_from_llsd<LLVector3d>(const LLSD& sd, eControlType type, std::string_view control_name) { if (type == TYPE_VEC3D) return (LLVector3d)sd; @@ -1510,7 +1518,7 @@ LLVector3d convert_from_llsd<LLVector3d>(const LLSD& sd, eControlType type, cons } template<> -LLVector4 convert_from_llsd<LLVector4>(const LLSD& sd, eControlType type, const std::string& control_name) +LLVector4 convert_from_llsd<LLVector4>(const LLSD& sd, eControlType type, std::string_view control_name) { if (type == TYPE_VEC4) return (LLVector4)sd; @@ -1522,7 +1530,7 @@ LLVector4 convert_from_llsd<LLVector4>(const LLSD& sd, eControlType type, const } template<> -LLQuaternion convert_from_llsd<LLQuaternion>(const LLSD& sd, eControlType type, const std::string& control_name) +LLQuaternion convert_from_llsd<LLQuaternion>(const LLSD& sd, eControlType type, std::string_view control_name) { if (type == TYPE_QUAT) return (LLQuaternion)sd; @@ -1534,7 +1542,7 @@ LLQuaternion convert_from_llsd<LLQuaternion>(const LLSD& sd, eControlType type, } template<> -LLRect convert_from_llsd<LLRect>(const LLSD& sd, eControlType type, const std::string& control_name) +LLRect convert_from_llsd<LLRect>(const LLSD& sd, eControlType type, std::string_view control_name) { if (type == TYPE_RECT) return LLRect(sd); @@ -1547,7 +1555,7 @@ LLRect convert_from_llsd<LLRect>(const LLSD& sd, eControlType type, const std::s template<> -LLColor4 convert_from_llsd<LLColor4>(const LLSD& sd, eControlType type, const std::string& control_name) +LLColor4 convert_from_llsd<LLColor4>(const LLSD& sd, eControlType type, std::string_view control_name) { if (type == TYPE_COL4) { @@ -1579,7 +1587,7 @@ LLColor4 convert_from_llsd<LLColor4>(const LLSD& sd, eControlType type, const st } template<> -LLColor3 convert_from_llsd<LLColor3>(const LLSD& sd, eControlType type, const std::string& control_name) +LLColor3 convert_from_llsd<LLColor3>(const LLSD& sd, eControlType type, std::string_view control_name) { if (type == TYPE_COL3) return sd; @@ -1591,7 +1599,7 @@ LLColor3 convert_from_llsd<LLColor3>(const LLSD& sd, eControlType type, const st } template<> -LLUUID convert_from_llsd<LLUUID>(const LLSD& sd, eControlType type, const std::string& control_name) +LLUUID convert_from_llsd<LLUUID>(const LLSD& sd, eControlType type, std::string_view control_name) { if (type == TYPE_UUID) return sd.asUUID(); @@ -1603,7 +1611,7 @@ LLUUID convert_from_llsd<LLUUID>(const LLSD& sd, eControlType type, const std::s } template<> -LLSD convert_from_llsd<LLSD>(const LLSD& sd, eControlType type, const std::string& control_name) +LLSD convert_from_llsd<LLSD>(const LLSD& sd, eControlType type, std::string_view control_name) { return sd; } diff --git a/indra/llxml/llcontrol.h b/indra/llxml/llcontrol.h index c26a0195b5066d4e2f36669f07fca411ff6f9b41..23c1845eed3f83ba79dacedf6a92460d1de79a87 100644 --- a/indra/llxml/llcontrol.h +++ b/indra/llxml/llcontrol.h @@ -34,6 +34,8 @@ #include "llrefcount.h" #include "llinstancetracker.h" +#include <absl/strings/string_view.h> + #include <vector> // *NOTE: boost::visit_each<> generates warning 4675 on .net 2003 @@ -119,8 +121,8 @@ class LLControlVariable final : public LLRefCount validate_signal_t mValidateSignal; public: - LLControlVariable(const std::string& name, eControlType type, - LLSD initial, const std::string& comment, + LLControlVariable(const std::string name, eControlType type, + LLSD initial, const std::string comment, ePersist persist = PERSIST_NONDFT, bool hidefromsettingseditor = false); virtual ~LLControlVariable() = default; @@ -154,7 +156,7 @@ class LLControlVariable final : public LLRefCount void setDefaultValue(const LLSD& value); void setPersist(ePersist); void setHiddenFromSettingsEditor(bool hide); - void setComment(const std::string& comment); + void setComment(const std::string comment); private: void firePropertyChanged(const LLSD &pPreviousValue); @@ -180,7 +182,7 @@ LLSD convert_to_llsd(const T& in) } template <class T> -T convert_from_llsd(const LLSD& sd, eControlType type, const std::string& control_name) +T convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name) { // needs specialization return T(sd); @@ -192,7 +194,7 @@ class LLControlGroup final : public LLInstanceTracker<LLControlGroup, std::strin LOG_CLASS(LLControlGroup); protected: - typedef std::map<std::string, LLControlVariablePtr > ctrl_name_table_t; + typedef std::map<std::string, LLControlVariablePtr, std::less<>> ctrl_name_table_t; ctrl_name_table_t mNameTable; static const std::string mTypeString[TYPE_COUNT]; @@ -206,7 +208,7 @@ class LLControlGroup final : public LLInstanceTracker<LLControlGroup, std::strin ~LLControlGroup(); void cleanup(); - LLControlVariablePtr getControl(const std::string& name); + LLControlVariablePtr getControl(std::string_view name); struct ApplyFunctor { @@ -231,30 +233,30 @@ class LLControlGroup final : public LLInstanceTracker<LLControlGroup, std::strin LLControlVariable* declareUUID(const std::string& name, const LLUUID& initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT); LLControlVariable* declareLLSD(const std::string& name, const LLSD &initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT); - std::string getString(const std::string& name); - std::string getText(const std::string& name); - BOOL getBOOL(const std::string& name); - bool getBool(const std::string& name); - S32 getS32(const std::string& name); - F32 getF32(const std::string& name); - U32 getU32(const std::string& name); + std::string getString(std::string_view name); + std::string getText(std::string_view name); + BOOL getBOOL(std::string_view name); + bool getBool(std::string_view name); + S32 getS32(std::string_view name); + F32 getF32(std::string_view name); + U32 getU32(std::string_view name); - LLWString getWString(const std::string& name); - LLVector3 getVector3(const std::string& name); - LLVector3d getVector3d(const std::string& name); - LLVector4 getVector4(const std::string& name); - LLRect getRect(const std::string& name); - LLUUID getUUID(const std::string& name); - LLSD getLLSD(const std::string& name); - LLQuaternion getQuaternion(const std::string& name); + LLWString getWString(std::string_view name); + LLVector3 getVector3(std::string_view name); + LLVector3d getVector3d(std::string_view name); + LLVector4 getVector4(std::string_view name); + LLRect getRect(std::string_view name); + LLUUID getUUID(std::string_view name); + LLSD getLLSD(std::string_view name); + LLQuaternion getQuaternion(std::string_view name); - LLColor4 getColor(const std::string& name); - LLColor4 getColor4(const std::string& name); - LLColor3 getColor3(const std::string& name); + LLColor4 getColor(std::string_view name); + LLColor4 getColor4(std::string_view name); + LLColor3 getColor3(std::string_view name); // generic getter - template<typename T> T get(const std::string& name) + template<typename T> T get(std::string_view name) { LLControlVariable* control = getControl(name); LLSD value; @@ -273,25 +275,25 @@ class LLControlGroup final : public LLInstanceTracker<LLControlGroup, std::strin return convert_from_llsd<T>(value, type, name); } - void setBOOL(const std::string& name, BOOL val); - void setS32(const std::string& name, S32 val); - void setF32(const std::string& name, F32 val); - void setU32(const std::string& name, U32 val); - void setString(const std::string& name, const std::string& val); - void setVector3(const std::string& name, const LLVector3 &val); - void setVector3d(const std::string& name, const LLVector3d &val); - void setVector4(const std::string& name, const LLVector4& val); - void setQuaternion(const std::string& name, const LLQuaternion &val); - void setRect(const std::string& name, const LLRect &val); - void setColor4(const std::string& name, const LLColor4 &val); - void setUUID(const std::string& name, const LLUUID& val); - void setLLSD(const std::string& name, const LLSD& val); + void setBOOL(std::string_view name, BOOL val); + void setS32(std::string_view name, S32 val); + void setF32(std::string_view name, F32 val); + void setU32(std::string_view name, U32 val); + void setString(std::string_view name, const std::string& val); + void setVector3(std::string_view name, const LLVector3 &val); + void setVector3d(std::string_view name, const LLVector3d &val); + void setVector4(std::string_view name, const LLVector4& val); + void setQuaternion(std::string_view name, const LLQuaternion &val); + void setRect(std::string_view name, const LLRect &val); + void setColor4(std::string_view name, const LLColor4 &val); + void setUUID(std::string_view name, const LLUUID& val); + void setLLSD(std::string_view name, const LLSD& val); // type agnostic setter that takes LLSD - void setUntypedValue(const std::string& name, const LLSD& val); + void setUntypedValue(std::string_view name, const LLSD& val); // generic setter - template<typename T> void set(const std::string& name, const T& val) + template<typename T> void set(std::string_view name, const T& val) { LLControlVariable* control = getControl(name); @@ -305,7 +307,7 @@ class LLControlGroup final : public LLInstanceTracker<LLControlGroup, std::strin } } - BOOL controlExists(const std::string& name); + BOOL controlExists(std::string_view name); // Returns number of controls loaded, 0 if failed // If require_declaration is false, will auto-declare controls it finds @@ -314,7 +316,7 @@ class LLControlGroup final : public LLInstanceTracker<LLControlGroup, std::strin U32 saveToFile(const std::string& filename, BOOL nondefault_only); U32 loadFromFile(const std::string& filename, bool default_values = false, bool save_values = true); void resetToDefaults(); - void incrCount(const std::string& name); + void incrCount(std::string_view name); bool mSettingsProfile; }; @@ -466,21 +468,21 @@ template <> LLSD convert_to_llsd<LLColor4>(const LLColor4& in); template <> LLSD convert_to_llsd<LLColor3>(const LLColor3& in); template <> LLSD convert_to_llsd<LLColor4U>(const LLColor4U& in); -template<> std::string convert_from_llsd<std::string>(const LLSD& sd, eControlType type, const std::string& control_name); -template<> LLWString convert_from_llsd<LLWString>(const LLSD& sd, eControlType type, const std::string& control_name); -template<> LLVector3 convert_from_llsd<LLVector3>(const LLSD& sd, eControlType type, const std::string& control_name); -template<> LLVector3d convert_from_llsd<LLVector3d>(const LLSD& sd, eControlType type, const std::string& control_name); -template<> LLVector4 convert_from_llsd<LLVector4>(const LLSD& sd, eControlType type, const std::string& control_name); -template<> LLQuaternion convert_from_llsd<LLQuaternion>(const LLSD& sd, eControlType type, const std::string& control_name); -template<> LLRect convert_from_llsd<LLRect>(const LLSD& sd, eControlType type, const std::string& control_name); -template<> bool convert_from_llsd<bool>(const LLSD& sd, eControlType type, const std::string& control_name); -template<> S32 convert_from_llsd<S32>(const LLSD& sd, eControlType type, const std::string& control_name); -template<> F32 convert_from_llsd<F32>(const LLSD& sd, eControlType type, const std::string& control_name); -template<> U32 convert_from_llsd<U32>(const LLSD& sd, eControlType type, const std::string& control_name); -template<> LLColor3 convert_from_llsd<LLColor3>(const LLSD& sd, eControlType type, const std::string& control_name); -template<> LLColor4 convert_from_llsd<LLColor4>(const LLSD& sd, eControlType type, const std::string& control_name); -template<> LLUUID convert_from_llsd<LLUUID>(const LLSD& sd, eControlType type, const std::string& control_name); -template<> LLSD convert_from_llsd<LLSD>(const LLSD& sd, eControlType type, const std::string& control_name); +template<> std::string convert_from_llsd<std::string>(const LLSD& sd, eControlType type, std::string_view control_name); +template<> LLWString convert_from_llsd<LLWString>(const LLSD& sd, eControlType type, std::string_view control_name); +template<> LLVector3 convert_from_llsd<LLVector3>(const LLSD& sd, eControlType type, std::string_view control_name); +template<> LLVector3d convert_from_llsd<LLVector3d>(const LLSD& sd, eControlType type, std::string_view control_name); +template<> LLVector4 convert_from_llsd<LLVector4>(const LLSD& sd, eControlType type, std::string_view control_name); +template<> LLQuaternion convert_from_llsd<LLQuaternion>(const LLSD& sd, eControlType type, std::string_view control_name); +template<> LLRect convert_from_llsd<LLRect>(const LLSD& sd, eControlType type, std::string_view control_name); +template<> bool convert_from_llsd<bool>(const LLSD& sd, eControlType type, std::string_view control_name); +template<> S32 convert_from_llsd<S32>(const LLSD& sd, eControlType type, std::string_view control_name); +template<> F32 convert_from_llsd<F32>(const LLSD& sd, eControlType type, std::string_view control_name); +template<> U32 convert_from_llsd<U32>(const LLSD& sd, eControlType type, std::string_view control_name); +template<> LLColor3 convert_from_llsd<LLColor3>(const LLSD& sd, eControlType type, std::string_view control_name); +template<> LLColor4 convert_from_llsd<LLColor4>(const LLSD& sd, eControlType type, std::string_view control_name); +template<> LLUUID convert_from_llsd<LLUUID>(const LLSD& sd, eControlType type, std::string_view control_name); +template<> LLSD convert_from_llsd<LLSD>(const LLSD& sd, eControlType type, std::string_view control_name); //#define TEST_CACHED_CONTROL 1 #ifdef TEST_CACHED_CONTROL diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index df0a627350e0a5ac57d297fa562b6c72b44d2dad..8b525b7b019bcd6335997dbcf1f5ae962f81ba9a 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -2327,10 +2327,10 @@ bool LLAppViewer::loadSettingsFromDirectory(const std::string& location_key, std::string full_settings_path; if (file.file_name_setting.isProvided() - && gSavedSettings.controlExists(file.file_name_setting)) + && gSavedSettings.controlExists(file.file_name_setting.getValue())) { // try to find filename stored in file_name_setting control - full_settings_path = gSavedSettings.getString(file.file_name_setting); + full_settings_path = gSavedSettings.getString(file.file_name_setting.getValue()); if (full_settings_path.empty()) { continue; diff --git a/indra/newview/llfirstuse.cpp b/indra/newview/llfirstuse.cpp index 65c457da7235c16075abc549668a5fc0388d8080..f94954264ec74653a97f0f68002df65f98f3c7c9 100644 --- a/indra/newview/llfirstuse.cpp +++ b/indra/newview/llfirstuse.cpp @@ -170,7 +170,7 @@ bool LLFirstUse::processNotification(const LLSD& notify) if (notification) { // disable any future notifications - gWarningSettings.setBOOL(notification->getPayload()["control_var"], FALSE); + gWarningSettings.setBOOL(notification->getPayload()["control_var"].asStringRef(), FALSE); } } return false;