summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorRye Mutt <rye@alchemyviewer.org>2024-07-01 22:25:56 -0400
committerRye Mutt <rye@alchemyviewer.org>2024-07-01 22:25:56 -0400
commitb0e30477e93bb16b0cf8c7b64aaee35cedf85ca8 (patch)
treed8e0c8eca6f078395d0bc581925f589adc67d895 /indra/llui
parent49d60e0ded52c095c834e9ca134b67282728b389 (diff)
Use heterogeneous comparison for string_view map finds in LLControl and convert controlExists to string_view
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llnotifications.cpp2
-rw-r--r--indra/llui/llui.cpp2
-rw-r--r--indra/llui/llui.h4
-rw-r--r--indra/llui/lluictrl.cpp8
-rw-r--r--indra/llui/llview.cpp14
-rw-r--r--indra/llui/llview.h2
6 files changed, 17 insertions, 15 deletions
diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp
index bee7d5bb3f..825956227f 100644
--- a/indra/llui/llnotifications.cpp
+++ b/indra/llui/llnotifications.cpp
@@ -439,7 +439,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()))
{
mSoundName = p.sound;
}
diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp
index f5c55a3d37..448c730688 100644
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -367,7 +367,7 @@ void LLUI::glRectToScreen(const LLRect& gl, LLRect *screen)
}
-LLControlGroup& LLUI::getControlControlGroup (const std::string& controlname)
+LLControlGroup& LLUI::getControlControlGroup (std::string_view controlname)
{
for (settings_map_t::iterator itor = mSettingGroups.begin();
itor != mSettingGroups.end(); ++itor)
diff --git a/indra/llui/llui.h b/indra/llui/llui.h
index 373a358544..f33b43f599 100644
--- a/indra/llui/llui.h
+++ b/indra/llui/llui.h
@@ -115,7 +115,7 @@ typedef void (*LLUIAudioCallback)(const LLUUID& uuid);
class LLUI : public LLParamSingleton<LLUI>
{
public:
- typedef std::map<std::string, LLControlGroup*> settings_map_t;
+ typedef std::map<std::string, LLControlGroup*, std::less<> > settings_map_t;
private:
LLSINGLETON(LLUI , const settings_map_t &settings,
@@ -295,7 +295,7 @@ public:
void screenRectToGL(const LLRect& screen, LLRect *gl);
void glRectToScreen(const LLRect& gl, LLRect *screen);
// Returns the control group containing the control name, or the default group
- LLControlGroup& getControlControlGroup (const std::string& controlname);
+ LLControlGroup& getControlControlGroup (std::string_view controlname);
F32 getMouseIdleTime() { return mMouseIdleTimer.getElapsedTimeF32(); }
void resetMouseIdleTimer() { mMouseIdleTimer.reset(); }
LLWindow* getWindow() { return mWindow; }
diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp
index d1011edcf7..cb86a79407 100644
--- a/indra/llui/lluictrl.cpp
+++ b/indra/llui/lluictrl.cpp
@@ -135,7 +135,7 @@ void LLUICtrl::initFromParams(const Params& p)
{
if (p.enabled_controls.enabled.isChosen())
{
- LLControlVariable* control = findControl(p.enabled_controls.enabled);
+ LLControlVariable* control = findControl(p.enabled_controls.enabled());
if (control)
{
setEnabledControlVariable(control);
@@ -149,7 +149,7 @@ void LLUICtrl::initFromParams(const Params& p)
}
else if(p.enabled_controls.disabled.isChosen())
{
- LLControlVariable* control = findControl(p.enabled_controls.disabled);
+ LLControlVariable* control = findControl(p.enabled_controls.disabled());
if (control)
{
setDisabledControlVariable(control);
@@ -166,7 +166,7 @@ void LLUICtrl::initFromParams(const Params& p)
{
if (p.controls_visibility.visible.isChosen())
{
- LLControlVariable* control = findControl(p.controls_visibility.visible);
+ LLControlVariable* control = findControl(p.controls_visibility.visible());
if (control)
{
setMakeVisibleControlVariable(control);
@@ -180,7 +180,7 @@ void LLUICtrl::initFromParams(const Params& p)
}
else if (p.controls_visibility.invisible.isChosen())
{
- LLControlVariable* control = findControl(p.controls_visibility.invisible);
+ LLControlVariable* control = findControl(p.controls_visibility.invisible());
if (control)
{
setMakeInvisibleControlVariable(control);
diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp
index ab03a7a9a8..7d6c937b85 100644
--- a/indra/llui/llview.cpp
+++ b/indra/llui/llview.cpp
@@ -2312,18 +2312,20 @@ LLView* LLView::findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESna
//-----------------------------------------------------------------------------
-LLControlVariable *LLView::findControl(const std::string& name)
+LLControlVariable *LLView::findControl(std::string_view name)
{
+ auto uiInst = LLUI::getInstance();
// parse the name to locate which group it belongs to
std::size_t key_pos= name.find(".");
- if(key_pos!= std::string::npos )
+ if(key_pos != std::string_view::npos )
{
- std::string control_group_key = name.substr(0, key_pos);
+ std::string_view control_group_key = name.substr(0, key_pos);
LLControlVariable* control;
// check if it's in the control group that name indicated
- if(LLUI::getInstance()->mSettingGroups[control_group_key])
+ auto it = uiInst->mSettingGroups.find(control_group_key);
+ if(it != uiInst->mSettingGroups.end() && it->second)
{
- control = LLUI::getInstance()->mSettingGroups[control_group_key]->getControl(name);
+ control = it->second->getControl(name);
if (control)
{
return control;
@@ -2331,7 +2333,7 @@ LLControlVariable *LLView::findControl(const std::string& name)
}
}
- LLControlGroup& control_group = LLUI::getInstance()->getControlControlGroup(name);
+ LLControlGroup& control_group = uiInst->getControlControlGroup(name);
return control_group.getControl(name);
}
diff --git a/indra/llui/llview.h b/indra/llui/llview.h
index 4a9bef158a..710ec3d05e 100644
--- a/indra/llui/llview.h
+++ b/indra/llui/llview.h
@@ -416,7 +416,7 @@ public:
void screenRectToLocal( const LLRect& screen, LLRect* local ) const;
void localRectToScreen( const LLRect& local, LLRect* screen ) const;
- LLControlVariable *findControl(const std::string& name);
+ LLControlVariable *findControl(std::string_view name);
const child_list_t* getChildList() const { return &mChildList; }
child_list_const_iter_t beginChild() const { return mChildList.begin(); }