diff options
author | Rye Mutt <rye@alchemyviewer.org> | 2024-07-01 21:48:34 -0400 |
---|---|---|
committer | Rye Mutt <rye@alchemyviewer.org> | 2024-07-01 21:50:54 -0400 |
commit | e834e77988fcf637ee0f3e4c5c0875e47044e324 (patch) | |
tree | a6d95d8a8a29eb8f4ce3f86855a9e33fb0dde5b3 /indra/llui | |
parent | e32f6426d5b0765272f7c08bbbb6780a2f2e1e0b (diff) |
Reduce string temporaries from findChild and getChild
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llbadge.cpp | 2 | ||||
-rw-r--r-- | indra/llui/llbadge.h | 2 | ||||
-rw-r--r-- | indra/llui/llbutton.cpp | 2 | ||||
-rw-r--r-- | indra/llui/llbutton.h | 2 | ||||
-rw-r--r-- | indra/llui/llcheckboxctrl.cpp | 2 | ||||
-rw-r--r-- | indra/llui/llcheckboxctrl.h | 2 | ||||
-rw-r--r-- | indra/llui/llfloaterreglistener.cpp | 2 | ||||
-rw-r--r-- | indra/llui/lllineeditor.cpp | 2 | ||||
-rw-r--r-- | indra/llui/lllineeditor.h | 2 | ||||
-rw-r--r-- | indra/llui/llmenugl.cpp | 4 | ||||
-rw-r--r-- | indra/llui/llmenugl.h | 4 | ||||
-rw-r--r-- | indra/llui/llpanel.cpp | 2 | ||||
-rw-r--r-- | indra/llui/llpanel.h | 2 | ||||
-rw-r--r-- | indra/llui/lltabcontainer.cpp | 4 | ||||
-rw-r--r-- | indra/llui/lltabcontainer.h | 4 | ||||
-rw-r--r-- | indra/llui/lltextbox.cpp | 2 | ||||
-rw-r--r-- | indra/llui/lltextbox.h | 2 | ||||
-rw-r--r-- | indra/llui/lltexteditor.cpp | 2 | ||||
-rw-r--r-- | indra/llui/lltexteditor.h | 2 | ||||
-rw-r--r-- | indra/llui/lluictrl.cpp | 2 | ||||
-rw-r--r-- | indra/llui/lluictrl.h | 2 | ||||
-rw-r--r-- | indra/llui/lluictrlfactory.h | 4 | ||||
-rw-r--r-- | indra/llui/llview.cpp | 12 | ||||
-rw-r--r-- | indra/llui/llview.h | 22 |
24 files changed, 44 insertions, 44 deletions
diff --git a/indra/llui/llbadge.cpp b/indra/llui/llbadge.cpp index 3397c97ee1..40c5041132 100644 --- a/indra/llui/llbadge.cpp +++ b/indra/llui/llbadge.cpp @@ -36,7 +36,7 @@ static LLDefaultChildRegistry::Register<LLBadge> r("badge"); static const S32 BADGE_OFFSET_NOT_SPECIFIED = 0x7FFFFFFF; // Compiler optimization, generate extern template -template class LLBadge* LLView::getChild<class LLBadge>(const std::string& name, bool recurse) const; +template class LLBadge* LLView::getChild<class LLBadge>(std::string_view name, bool recurse) const; LLBadge::Params::Params() diff --git a/indra/llui/llbadge.h b/indra/llui/llbadge.h index a6d584c6d7..77fe76f0da 100644 --- a/indra/llui/llbadge.h +++ b/indra/llui/llbadge.h @@ -171,7 +171,7 @@ private: // Build time optimization, generate once in .cpp file #ifndef LLBADGE_CPP -extern template class LLBadge* LLView::getChild<class LLBadge>(const std::string& name, bool recurse) const; +extern template class LLBadge* LLView::getChild<class LLBadge>(std::string_view name, bool recurse) const; #endif #endif // LL_LLBADGE_H diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index e6c045250e..91044e5441 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -56,7 +56,7 @@ static LLDefaultChildRegistry::Register<LLButton> r("button"); // Compiler optimization, generate extern template template class LLButton* LLView::getChild<class LLButton>( - const std::string& name, bool recurse) const; + std::string_view name, bool recurse) const; // globals S32 LLBUTTON_H_PAD = 4; diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index fed5cdcc50..80a876393e 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -400,7 +400,7 @@ protected: // Build time optimization, generate once in .cpp file #ifndef LLBUTTON_CPP extern template class LLButton* LLView::getChild<class LLButton>( - const std::string& name, bool recurse) const; + std::string_view name, bool recurse) const; #endif #endif // LL_LLBUTTON_H diff --git a/indra/llui/llcheckboxctrl.cpp b/indra/llui/llcheckboxctrl.cpp index 3bcf0a6517..dea262942b 100644 --- a/indra/llui/llcheckboxctrl.cpp +++ b/indra/llui/llcheckboxctrl.cpp @@ -45,7 +45,7 @@ static LLDefaultChildRegistry::Register<LLCheckBoxCtrl> r("check_box"); // Compiler optimization, generate extern template template class LLCheckBoxCtrl* LLView::getChild<class LLCheckBoxCtrl>( - const std::string& name, bool recurse) const; + std::string_view name, bool recurse) const; void LLCheckBoxCtrl::WordWrap::declareValues() { diff --git a/indra/llui/llcheckboxctrl.h b/indra/llui/llcheckboxctrl.h index 3058e946c3..fc04a8a781 100644 --- a/indra/llui/llcheckboxctrl.h +++ b/indra/llui/llcheckboxctrl.h @@ -151,7 +151,7 @@ protected: // Build time optimization, generate once in .cpp file #ifndef LLCHECKBOXCTRL_CPP extern template class LLCheckBoxCtrl* LLView::getChild<class LLCheckBoxCtrl>( - const std::string& name, bool recurse) const; + std::string_view name, bool recurse) const; #endif #endif // LL_LLCHECKBOXCTRL_H diff --git a/indra/llui/llfloaterreglistener.cpp b/indra/llui/llfloaterreglistener.cpp index aa3d1a1171..88fa65e8f5 100644 --- a/indra/llui/llfloaterreglistener.cpp +++ b/indra/llui/llfloaterreglistener.cpp @@ -131,7 +131,7 @@ void LLFloaterRegListener::clickButton(const LLSD& event) const { // Here 'floater' points to an LLFloater instance with the specified // name and key which isShown(). - LLButton* button = floater->findChild<LLButton>(event["button"]); + LLButton* button = floater->findChild<LLButton>(event["button"].asString()); if (! LLButton::isAvailable(button)) { reply["type"] = "LLButton"; diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 50bf3f5877..e4b18e8919 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -74,7 +74,7 @@ static LLDefaultChildRegistry::Register<LLLineEditor> r1("line_editor"); // Compiler optimization, generate extern template template class LLLineEditor* LLView::getChild<class LLLineEditor>( - const std::string& name, bool recurse) const; + std::string_view name, bool recurse) const; // // Member functions diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index e955cbb17d..1cb7cac854 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -466,7 +466,7 @@ private: // Build time optimization, generate once in .cpp file #ifndef LLLINEEDITOR_CPP extern template class LLLineEditor* LLView::getChild<class LLLineEditor>( - const std::string& name, bool recurse) const; + std::string_view name, bool recurse) const; #endif #endif // LL_LINEEDITOR_ diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index dffaf69a9f..9ab210e003 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -988,7 +988,7 @@ LLMenuItemBranchGL::~LLMenuItemBranchGL() // virtual -LLView* LLMenuItemBranchGL::getChildView(const std::string& name, bool recurse) const +LLView* LLMenuItemBranchGL::getChildView(std::string_view name, bool recurse) const { LLMenuGL* branch = getBranch(); if (branch) @@ -1005,7 +1005,7 @@ LLView* LLMenuItemBranchGL::getChildView(const std::string& name, bool recurse) return LLView::getChildView(name, recurse); } -LLView* LLMenuItemBranchGL::findChildView(const std::string& name, bool recurse) const +LLView* LLMenuItemBranchGL::findChildView(std::string_view name, bool recurse) const { LLMenuGL* branch = getBranch(); if (branch) diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index 51766afe85..300a669d52 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -687,8 +687,8 @@ public: virtual void openMenu(); - virtual LLView* getChildView(const std::string& name, bool recurse = true) const; - virtual LLView* findChildView(const std::string& name, bool recurse = true) const; + virtual LLView* getChildView(std::string_view name, bool recurse = true) const; + virtual LLView* findChildView(std::string_view name, bool recurse = true) const; private: LLHandle<LLView> mBranchHandle; diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index 468cdb10fb..01d0097eab 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -55,7 +55,7 @@ LLPanel::factory_stack_t LLPanel::sFactoryStack; // Compiler optimization, generate extern template template class LLPanel* LLView::getChild<class LLPanel>( - const std::string& name, bool recurse) const; + std::string_view name, bool recurse) const; LLPanel::LocalizedString::LocalizedString() : name("name"), diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h index 2be5573faf..6d1be519e4 100644 --- a/indra/llui/llpanel.h +++ b/indra/llui/llpanel.h @@ -259,7 +259,7 @@ private: // Build time optimization, generate once in .cpp file #ifndef LLPANEL_CPP extern template class LLPanel* LLView::getChild<class LLPanel>( - const std::string& name, bool recurse) const; + std::string_view name, bool recurse) const; #endif typedef boost::function<LLPanel* (void)> LLPanelClassCreatorFunc; diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 06f584d372..f10d545126 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -315,7 +315,7 @@ void LLTabContainer::reshape(S32 width, S32 height, bool called_from_parent) } //virtual -LLView* LLTabContainer::getChildView(const std::string& name, bool recurse) const +LLView* LLTabContainer::getChildView(std::string_view name, bool recurse) const { tuple_list_t::const_iterator itor; for (itor = mTabList.begin(); itor != mTabList.end(); ++itor) @@ -343,7 +343,7 @@ LLView* LLTabContainer::getChildView(const std::string& name, bool recurse) cons } //virtual -LLView* LLTabContainer::findChildView(const std::string& name, bool recurse) const +LLView* LLTabContainer::findChildView(std::string_view name, bool recurse) const { tuple_list_t::const_iterator itor; for (itor = mTabList.begin(); itor != mTabList.end(); ++itor) diff --git a/indra/llui/lltabcontainer.h b/indra/llui/lltabcontainer.h index b22eec2fe5..4f0a0b2a57 100644 --- a/indra/llui/lltabcontainer.h +++ b/indra/llui/lltabcontainer.h @@ -149,8 +149,8 @@ public: /*virtual*/ bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType type, void* cargo_data, EAcceptance* accept, std::string& tooltip); - /*virtual*/ LLView* getChildView(const std::string& name, bool recurse = true) const; - /*virtual*/ LLView* findChildView(const std::string& name, bool recurse = true) const; + /*virtual*/ LLView* getChildView(std::string_view name, bool recurse = true) const; + /*virtual*/ LLView* findChildView(std::string_view name, bool recurse = true) const; /*virtual*/ void initFromParams(const LLPanel::Params& p); /*virtual*/ bool addChild(LLView* view, S32 tab_group = 0); /*virtual*/ bool postBuild(); diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp index 92551b682c..05af36b71e 100644 --- a/indra/llui/lltextbox.cpp +++ b/indra/llui/lltextbox.cpp @@ -39,7 +39,7 @@ static LLDefaultChildRegistry::Register<LLTextBox> r("text"); // Compiler optimization, generate extern template template class LLTextBox* LLView::getChild<class LLTextBox>( - const std::string& name, bool recurse) const; + std::string_view name, bool recurse) const; LLTextBox::LLTextBox(const LLTextBox::Params& p) : LLTextBase(p), diff --git a/indra/llui/lltextbox.h b/indra/llui/lltextbox.h index c1f829c2b9..a3cde45cd0 100644 --- a/indra/llui/lltextbox.h +++ b/indra/llui/lltextbox.h @@ -81,7 +81,7 @@ protected: // Build time optimization, generate once in .cpp file #ifndef LLTEXTBOX_CPP extern template class LLTextBox* LLView::getChild<class LLTextBox>( - const std::string& name, bool recurse) const; + std::string_view name, bool recurse) const; #endif #endif diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index dc3026e14d..bba9e9d5a5 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -71,7 +71,7 @@ static LLDefaultChildRegistry::Register<LLTextEditor> r("simple_text_editor"); // Compiler optimization, generate extern template template class LLTextEditor* LLView::getChild<class LLTextEditor>( - const std::string& name, bool recurse) const; + std::string_view name, bool recurse) const; // // Constants diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index be7f7cb256..0b5acf19a1 100644 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -345,7 +345,7 @@ private: // Build time optimization, generate once in .cpp file #ifndef LLTEXTEDITOR_CPP extern template class LLTextEditor* LLView::getChild<class LLTextEditor>( - const std::string& name, bool recurse) const; + std::string_view name, bool recurse) const; #endif #endif // LL_TEXTEDITOR_H diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp index 52c5f72a45..d1011edcf7 100644 --- a/indra/llui/lluictrl.cpp +++ b/indra/llui/lluictrl.cpp @@ -44,7 +44,7 @@ F32 LLUICtrl::sInactiveControlTransparency = 1.0f; // Compiler optimization, generate extern template template class LLUICtrl* LLView::getChild<class LLUICtrl>( - const std::string& name, bool recurse) const; + std::string_view name, bool recurse) const; LLUICtrl::CallbackParam::CallbackParam() : name("name"), diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h index c56c3c43a4..fb8fc0c5ea 100644 --- a/indra/llui/lluictrl.h +++ b/indra/llui/lluictrl.h @@ -335,7 +335,7 @@ private: // Build time optimization, generate once in .cpp file #ifndef LLUICTRL_CPP extern template class LLUICtrl* LLView::getChild<class LLUICtrl>( - const std::string& name, bool recurse) const; + std::string_view name, bool recurse) const; #endif #endif // LL_LLUICTRL_H diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h index a07f9b7dae..75e7e396bc 100644 --- a/indra/llui/lluictrlfactory.h +++ b/indra/llui/lluictrlfactory.h @@ -182,10 +182,10 @@ fail: } template<class T> - static T* getDefaultWidget(const std::string& name) + static T* getDefaultWidget(std::string_view name) { typename T::Params widget_params; - widget_params.name = name; + widget_params.name = std::string(name); return create<T>(widget_params); } diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 441b7d6a6c..ab03a7a9a8 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; diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 3ce7243370..4a9bef158a 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -341,8 +341,8 @@ public: S32 getChildCount() const { return (S32)mChildList.size(); } template<class _Pr3> void sortChildren(_Pr3 _Pred) { mChildList.sort(_Pred); } bool hasAncestor(const LLView* parentp) const; - bool hasChild(const std::string& childname, bool recurse = false) const; - bool childHasKeyboardFocus( const std::string& childname ) const; + bool hasChild(std::string_view childname, bool recurse = false) const; + bool childHasKeyboardFocus( std::string_view childname ) const; // these iterators are used for collapsing various tree traversals into for loops typedef LLTreeDFSIter<LLView, child_list_const_iter_t> tree_iterator_t; @@ -452,24 +452,24 @@ public: // static method handles NULL pointer too static std::string getPathname(const LLView*); - template <class T> T* findChild(const std::string& name, bool recurse = true) const + template <class T> T* findChild(std::string_view name, bool recurse = true) const { LLView* child = findChildView(name, recurse); T* result = dynamic_cast<T*>(child); return result; } - template <class T> T* getChild(const std::string& name, bool recurse = true) const; + template <class T> T* getChild(std::string_view name, bool recurse = true) const; - template <class T> T& getChildRef(const std::string& name, bool recurse = true) const + template <class T> T& getChildRef(std::string_view name, bool recurse = true) const { return *getChild<T>(name, recurse); } - virtual LLView* getChildView(const std::string& name, bool recurse = true) const; - virtual LLView* findChildView(const std::string& name, bool recurse = true) const; + virtual LLView* getChildView(std::string_view name, bool recurse = true) const; + virtual LLView* findChildView(std::string_view name, bool recurse = true) const; - template <class T> T* getDefaultWidget(const std::string& name) const + template <class T> T* getDefaultWidget(std::string_view name) const { LLView* widgetp = getDefaultWidgetContainer().findChildView(name); return dynamic_cast<T*>(widgetp); @@ -576,7 +576,7 @@ private: LLView* childrenHandleMouseEvent(const METHOD& method, S32 x, S32 y, XDATA extra, bool allow_mouse_block = true); template <typename METHOD, typename CHARTYPE> - LLView* childrenHandleCharEvent(const std::string& desc, const METHOD& method, + LLView* childrenHandleCharEvent(std::string_view desc, const METHOD& method, CHARTYPE c, MASK mask); // adapter to blur distinction between handleKey() and handleUnicodeChar() @@ -696,7 +696,7 @@ struct TypeValues<LLView::EOrientation> : public LLInitParam::TypeValuesHelper<L }; } -template <class T> T* LLView::getChild(const std::string& name, bool recurse) const +template <class T> T* LLView::getChild(std::string_view name, bool recurse) const { LLView* child = findChildView(name, recurse); T* result = dynamic_cast<T*>(child); @@ -731,7 +731,7 @@ template <class T> T* LLView::getChild(const std::string& name, bool recurse) co // require explicit specialization. See llbutton.cpp for an example. #ifndef LLVIEW_CPP extern template class LLView* LLView::getChild<class LLView>( - const std::string& name, bool recurse) const; + std::string_view name, bool recurse) const; #endif #endif //LL_LLVIEW_H |