diff options
Diffstat (limited to 'indra/llui/llview.cpp')
-rw-r--r-- | indra/llui/llview.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 441b7d6a6c..7d6c937b85 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -85,7 +85,7 @@ bool LLView::sIsDrawing = false; // Compiler optimization, generate extern template template class LLView* LLView::getChild<class LLView>( - const std::string& name, bool recurse) const; + std::string_view name, bool recurse) const; static LLDefaultChildRegistry::Register<LLView> r("view"); @@ -729,7 +729,7 @@ void LLView::logMouseEvent() } template <typename METHOD, typename CHARTYPE> -LLView* LLView::childrenHandleCharEvent(const std::string& desc, const METHOD& method, +LLView* LLView::childrenHandleCharEvent(std::string_view desc, const METHOD& method, CHARTYPE c, MASK mask) { if ( getVisible() && getEnabled() ) @@ -1613,7 +1613,7 @@ bool LLView::hasAncestor(const LLView* parentp) const //----------------------------------------------------------------------------- -bool LLView::childHasKeyboardFocus( const std::string& childname ) const +bool LLView::childHasKeyboardFocus(std::string_view childname) const { LLView *focus = dynamic_cast<LLView *>(gFocusMgr.getKeyboardFocus()); @@ -1632,7 +1632,7 @@ bool LLView::childHasKeyboardFocus( const std::string& childname ) const //----------------------------------------------------------------------------- -bool LLView::hasChild(const std::string& childname, bool recurse) const +bool LLView::hasChild(std::string_view childname, bool recurse) const { return findChildView(childname, recurse) != NULL; } @@ -1640,12 +1640,12 @@ bool LLView::hasChild(const std::string& childname, bool recurse) const //----------------------------------------------------------------------------- // getChildView() //----------------------------------------------------------------------------- -LLView* LLView::getChildView(const std::string& name, bool recurse) const +LLView* LLView::getChildView(std::string_view name, bool recurse) const { return getChild<LLView>(name, recurse); } -LLView* LLView::findChildView(const std::string& name, bool recurse) const +LLView* LLView::findChildView(std::string_view name, bool recurse) const { LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; @@ -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); } |