From 0ab1bacf759709fe2cf5f4ea4a41bbfd89df7f79 Mon Sep 17 00:00:00 2001 From: Rye Mutt <rye@alchemyviewer.org> Date: Sun, 4 Jul 2021 17:30:27 -0400 Subject: [PATCH] Convert many things to string_view --- indra/llui/llaccordionctrl.cpp | 2 +- indra/llui/llaccordionctrl.h | 2 +- indra/llui/llcheckboxctrl.cpp | 2 +- indra/llui/llcheckboxctrl.h | 2 +- indra/llui/llcombobox.cpp | 4 ++-- indra/llui/llcombobox.h | 4 ++-- indra/llui/llctrlselectioninterface.h | 4 ++-- indra/llui/llkeywords.cpp | 6 +++--- indra/llui/llkeywords.h | 8 ++++---- indra/llui/lllayoutstack.cpp | 2 +- indra/llui/lllayoutstack.h | 2 +- indra/llui/llmultisliderctrl.cpp | 2 +- indra/llui/llmultisliderctrl.h | 2 +- indra/llui/llscrolllistctrl.cpp | 6 +++--- indra/llui/llscrolllistctrl.h | 8 ++++---- indra/llui/llsliderctrl.h | 2 +- indra/llui/lltabcontainer.cpp | 6 +++--- indra/llui/lltabcontainer.h | 6 +++--- indra/llui/lltoolbar.h | 2 +- indra/llui/lluictrl.cpp | 6 +++--- indra/llui/lluictrl.h | 4 ++-- indra/llui/llviewmodel.cpp | 4 ++-- indra/llui/llviewmodel.h | 4 ++-- 23 files changed, 45 insertions(+), 45 deletions(-) diff --git a/indra/llui/llaccordionctrl.cpp b/indra/llui/llaccordionctrl.cpp index eb49a2be106..575358a2dd5 100644 --- a/indra/llui/llaccordionctrl.cpp +++ b/indra/llui/llaccordionctrl.cpp @@ -866,7 +866,7 @@ void LLAccordionCtrl::expandDefaultTab() } // [SL:KB] - Patch: Notification-GroupCreateNotice | Checked: 2012-02-16 (Catznip-3.2) -void LLAccordionCtrl::expandTab(const std::string& tab_name) +void LLAccordionCtrl::expandTab(std::string_view tab_name) { if (mAccordionTabs.size() > 0) { diff --git a/indra/llui/llaccordionctrl.h b/indra/llui/llaccordionctrl.h index 36353bcc6b9..190188d1c60 100644 --- a/indra/llui/llaccordionctrl.h +++ b/indra/llui/llaccordionctrl.h @@ -119,7 +119,7 @@ class LLAccordionCtrl: public LLPanel void reset (); void expandDefaultTab(); // [SL:KB] - Patch: Notification-GroupCreateNotice | Checked: 2012-02-16 (Catznip-3.2) - void expandTab(const std::string& tab_name); + void expandTab(std::string_view tab_name); // [/SL:KB] void setComparator(const LLTabComparator* comp) { mTabComparator = comp; } diff --git a/indra/llui/llcheckboxctrl.cpp b/indra/llui/llcheckboxctrl.cpp index 13e83ea0842..bba2d2900c0 100644 --- a/indra/llui/llcheckboxctrl.cpp +++ b/indra/llui/llcheckboxctrl.cpp @@ -279,7 +279,7 @@ BOOL LLCheckBoxCtrl::setLabelArg( const std::string& key, const LLStringExplicit } // virtual -void LLCheckBoxCtrl::setControlName(const std::string& control_name, LLView* context) +void LLCheckBoxCtrl::setControlName(std::string_view control_name, LLView* context) { mButton->setControlName(control_name, context); } diff --git a/indra/llui/llcheckboxctrl.h b/indra/llui/llcheckboxctrl.h index 2f0c4ade642..e612b79a31c 100644 --- a/indra/llui/llcheckboxctrl.h +++ b/indra/llui/llcheckboxctrl.h @@ -119,7 +119,7 @@ class LLCheckBoxCtrl void setFont( const LLFontGL* font ) { mFont = font; } const LLFontGL* getFont() { return mFont; } - virtual void setControlName(const std::string& control_name, LLView* context); + virtual void setControlName(std::string_view control_name, LLView* context); virtual BOOL isDirty() const; // Returns TRUE if the user has modified this control. virtual void resetDirty(); // Clear dirty state diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index 656bc4bc550..d1f0bab11c7 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -1057,7 +1057,7 @@ void LLComboBox::clearColumns() mList->clearColumns(); } -void LLComboBox::setColumnLabel(const std::string& column, const std::string& label) +void LLComboBox::setColumnLabel(std::string_view column, const std::string& label) { mList->setColumnLabel(column, label); } @@ -1077,7 +1077,7 @@ void LLComboBox::clearRows() mList->clearRows(); } -void LLComboBox::sortByColumn(const std::string& name, BOOL ascending) +void LLComboBox::sortByColumn(std::string_view name, BOOL ascending) { mList->sortByColumn(name, ascending); } diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h index 945d58235a8..deaeb46cf06 100644 --- a/indra/llui/llcombobox.h +++ b/indra/llui/llcombobox.h @@ -173,11 +173,11 @@ class LLComboBox // Overwrites the default column (See LLScrollListCtrl for format) void addColumn(const LLSD& column, EAddPosition pos = ADD_BOTTOM) override; void clearColumns() override; - void setColumnLabel(const std::string& column, const std::string& label) override; + void setColumnLabel(std::string_view column, const std::string& label) override; LLScrollListItem* addElement(const LLSD& value, EAddPosition pos = ADD_BOTTOM, void* userdata = NULL) override; LLScrollListItem* addSimpleElement(const std::string& value, EAddPosition pos = ADD_BOTTOM, const LLSD& id = LLSD()) override; void clearRows() override; - void sortByColumn(const std::string& name, BOOL ascending) override; + void sortByColumn(std::string_view name, BOOL ascending) override; // LLCtrlSelectionInterface functions BOOL getCanSelect() const override { return TRUE; } diff --git a/indra/llui/llctrlselectioninterface.h b/indra/llui/llctrlselectioninterface.h index c61bb3210f8..ce7f4dd9be3 100644 --- a/indra/llui/llctrlselectioninterface.h +++ b/indra/llui/llctrlselectioninterface.h @@ -79,7 +79,7 @@ class LLCtrlListInterface : public LLCtrlSelectionInterface virtual void addColumn(const LLSD& column, EAddPosition pos = ADD_BOTTOM) = 0; virtual void clearColumns() = 0; - virtual void setColumnLabel(const std::string& column, const std::string& label) = 0; + virtual void setColumnLabel(std::string_view column, const std::string& label) = 0; // TomY TODO: Document this virtual LLScrollListItem* addElement(const LLSD& value, EAddPosition pos = ADD_BOTTOM, void* userdata = NULL) = 0; @@ -88,7 +88,7 @@ class LLCtrlListInterface : public LLCtrlSelectionInterface virtual LLScrollListItem* addSimpleElement(const std::string& value, EAddPosition pos, const LLSD& id) = 0; virtual void clearRows() = 0; - virtual void sortByColumn(const std::string& name, BOOL ascending) = 0; + virtual void sortByColumn(std::string_view name, BOOL ascending) = 0; }; class LLCtrlScrollInterface diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index d4b80eabfd4..219f1cf2342 100644 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -161,13 +161,13 @@ std::string LLKeywords::getArguments(LLSD& arguments) return argString; } -std::string LLKeywords::getAttribute(const std::string& key) +std::string LLKeywords::getAttribute(std::string_view key) { attribute_iterator_t it = mAttributes.find(key); return (it != mAttributes.end()) ? it->second : std::string(); } -LLColor4 LLKeywords::getColorGroup(const std::string& key_in) +LLColor4 LLKeywords::getColorGroup(std::string_view key_in) { std::string color_group = "ScriptText"; if (key_in == "functions") @@ -257,7 +257,7 @@ void LLKeywords::processTokens() LL_INFOS("SyntaxLSL") << "Finished processing tokens." << LL_ENDL; } -void LLKeywords::processTokensGroup(const LLSD& tokens, const std::string& group) +void LLKeywords::processTokensGroup(const LLSD& tokens, std::string_view group) { LLColor4 color; LLColor4 color_group; diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index 18e2ed06c53..9fce3af3e31 100644 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -110,7 +110,7 @@ class LLKeywords ~LLKeywords(); void clearLoaded() { mLoaded = false; } - LLColor4 getColorGroup(const std::string& key_in); + LLColor4 getColorGroup(std::string_view key_in); bool isLoaded() const { return mLoaded; } void findSegments(std::vector<LLTextSegmentPtr> *seg_list, @@ -169,7 +169,7 @@ class LLKeywords #endif protected: - void processTokensGroup(const LLSD& Tokens, const std::string& Group); + void processTokensGroup(const LLSD& Tokens, std::string_view Group); void insertSegment(std::vector<LLTextSegmentPtr>& seg_list, LLTextSegmentPtr new_segment, S32 text_len, @@ -191,10 +191,10 @@ class LLKeywords token_list_t mLineTokenList; token_list_t mDelimiterTokenList; - typedef std::map<std::string, std::string> element_attributes_t; + typedef std::map<std::string, std::string, std::less<>> element_attributes_t; typedef element_attributes_t::const_iterator attribute_iterator_t; element_attributes_t mAttributes; - std::string getAttribute(const std::string& key); + std::string getAttribute(std::string_view key); std::string getArguments(LLSD& arguments); }; diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 282305cb7dc..92a04658336 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -528,7 +528,7 @@ LLLayoutPanel* LLLayoutStack::findEmbeddedPanel(LLPanel* panelp) const return NULL; } -LLLayoutPanel* LLLayoutStack::findEmbeddedPanelByName(const std::string& name) const +LLLayoutPanel* LLLayoutStack::findEmbeddedPanelByName(std::string_view name) const { LLLayoutPanel* result = NULL; diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index f772dbc6b49..1227acd0339 100644 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h @@ -107,7 +107,7 @@ class LLLayoutStack : public LLView, public LLInstanceTracker<LLLayoutStack> e_panel_list_t mPanels; LLLayoutPanel* findEmbeddedPanel(LLPanel* panelp) const; - LLLayoutPanel* findEmbeddedPanelByName(const std::string& name) const; + LLLayoutPanel* findEmbeddedPanelByName(std::string_view name) const; void updateFractionalSizes(); void normalizeFractionalSizes(); void updatePanelRect( LLLayoutPanel* param1, const LLRect& new_rect ); diff --git a/indra/llui/llmultisliderctrl.cpp b/indra/llui/llmultisliderctrl.cpp index b3df7c154b1..0a50495bd52 100644 --- a/indra/llui/llmultisliderctrl.cpp +++ b/indra/llui/llmultisliderctrl.cpp @@ -518,7 +518,7 @@ void LLMultiSliderCtrl::reportInvalidData() } // virtual -void LLMultiSliderCtrl::setControlName(const std::string& control_name, LLView* context) +void LLMultiSliderCtrl::setControlName(std::string_view control_name, LLView* context) { mMultiSlider->setControlName(control_name, context); } diff --git a/indra/llui/llmultisliderctrl.h b/indra/llui/llmultisliderctrl.h index adb28676ecd..3f61b90711b 100644 --- a/indra/llui/llmultisliderctrl.h +++ b/indra/llui/llmultisliderctrl.h @@ -141,7 +141,7 @@ class LLMultiSliderCtrl : public LLF32UICtrl virtual void setTentative(BOOL b); // marks value as tentative virtual void onCommit(); // mark not tentative, then commit - virtual void setControlName(const std::string& control_name, LLView* context); + virtual void setControlName(std::string_view control_name, LLView* context); static void onSliderCommit(LLUICtrl* caller, const LLSD& userdata); diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index b5d42bf6c6c..4c33c5e0995 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -2668,7 +2668,7 @@ void LLScrollListCtrl::onScrollChange( S32 new_pos, LLScrollbar* scrollbar ) } -void LLScrollListCtrl::sortByColumn(const std::string& name, BOOL ascending) +void LLScrollListCtrl::sortByColumn(std::string_view name, BOOL ascending) { column_map_t::iterator itor = mColumns.find(name); if (itor != mColumns.end()) @@ -3025,7 +3025,7 @@ void LLScrollListCtrl::clearColumns() mTotalColumnPadding = 0; } -void LLScrollListCtrl::setColumnLabel(const std::string& column, const std::string& label) +void LLScrollListCtrl::setColumnLabel(std::string_view column, const std::string& label) { LLScrollListColumn* columnp = getColumn(column); if (columnp) @@ -3047,7 +3047,7 @@ LLScrollListColumn* LLScrollListCtrl::getColumn(S32 index) return mColumnsIndexed[index]; } -LLScrollListColumn* LLScrollListCtrl::getColumn(const std::string& name) +LLScrollListColumn* LLScrollListCtrl::getColumn(std::string_view name) { column_map_t::iterator column_itor = mColumns.find(name); if (column_itor != mColumns.end()) diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index 810437fa439..da482053f6d 100644 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h @@ -174,10 +174,10 @@ class LLScrollListCtrl : public LLUICtrl, public LLEditMenuHandler, virtual void addColumn(const LLScrollListColumn::Params& column, EAddPosition pos = ADD_BOTTOM); virtual void addColumn(const LLSD& column, EAddPosition pos = ADD_BOTTOM); virtual void clearColumns(); - virtual void setColumnLabel(const std::string& column, const std::string& label); + virtual void setColumnLabel(std::string_view column, const std::string& label); virtual bool preProcessChildNode(LLXMLNodePtr child); virtual LLScrollListColumn* getColumn(S32 index); - virtual LLScrollListColumn* getColumn(const std::string& name); + virtual LLScrollListColumn* getColumn(std::string_view name); virtual S32 getNumColumns() const { return mColumnsIndexed.size(); } // Adds a single element, from an array of: @@ -189,7 +189,7 @@ class LLScrollListCtrl : public LLUICtrl, public LLEditMenuHandler, // Simple add element. Takes a single array of: // [ "value" => value, "font" => font, "font-style" => style ] virtual void clearRows(); // clears all elements - virtual void sortByColumn(const std::string& name, BOOL ascending); + virtual void sortByColumn(std::string_view name, BOOL ascending); // These functions take and return an array of arrays of elements, as above virtual void setValue(const LLSD& value ); @@ -526,7 +526,7 @@ class LLScrollListCtrl : public LLUICtrl, public LLEditMenuHandler, mutable bool mSorted; - typedef std::map<std::string, LLScrollListColumn*> column_map_t; + typedef std::map<std::string, LLScrollListColumn*, std::less<>> column_map_t; column_map_t mColumns; bool mDirty; diff --git a/indra/llui/llsliderctrl.h b/indra/llui/llsliderctrl.h index 541c1677171..93ab387ea58 100644 --- a/indra/llui/llsliderctrl.h +++ b/indra/llui/llsliderctrl.h @@ -119,7 +119,7 @@ class LLSliderCtrl: public LLF32UICtrl, public ll::ui::SearchableControl /*virtual*/ void setTentative(BOOL b); // marks value as tentative /*virtual*/ void onCommit(); // mark not tentative, then commit - /*virtual*/ void setControlName(const std::string& control_name, LLView* context) + /*virtual*/ void setControlName(std::string_view control_name, LLView* context) { LLUICtrl::setControlName(control_name, context); mSlider->setControlName(control_name, context); diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 44f33801fc3..ef22ae59d2d 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -1399,7 +1399,7 @@ S32 LLTabContainer::getIndexForPanel(LLPanel* panel) return -1; } -S32 LLTabContainer::getPanelIndexByTitle(const std::string& title) +S32 LLTabContainer::getPanelIndexByTitle(std::string_view title) { for (S32 index = 0 ; index < (S32)mTabList.size(); index++) { @@ -1411,7 +1411,7 @@ S32 LLTabContainer::getPanelIndexByTitle(const std::string& title) return -1; } -LLPanel* LLTabContainer::getPanelByName(const std::string& name) +LLPanel* LLTabContainer::getPanelByName(std::string_view name) { for (S32 index = 0 ; index < (S32)mTabList.size(); index++) { @@ -1630,7 +1630,7 @@ BOOL LLTabContainer::setTab(S32 which) return is_visible; } -BOOL LLTabContainer::selectTabByName(const std::string& name) +BOOL LLTabContainer::selectTabByName(std::string_view name) { LLPanel* panel = getPanelByName(name); if (!panel) diff --git a/indra/llui/lltabcontainer.h b/indra/llui/lltabcontainer.h index 94d7b02a64b..29efc81040b 100644 --- a/indra/llui/lltabcontainer.h +++ b/indra/llui/lltabcontainer.h @@ -188,8 +188,8 @@ class LLTabContainer : public LLPanel S32 getTabCount(); LLPanel* getPanelByIndex(S32 index); S32 getIndexForPanel(LLPanel* panel); - S32 getPanelIndexByTitle(const std::string& title); - LLPanel* getPanelByName(const std::string& name); + S32 getPanelIndexByTitle(std::string_view title); + LLPanel* getPanelByName(std::string_view name); S32 getTotalTabWidth() const; void setCurrentTabName(const std::string& name); @@ -199,7 +199,7 @@ class LLTabContainer : public LLPanel void selectPrevTab(); BOOL selectTabPanel( LLPanel* child ); BOOL selectTab(S32 which); - BOOL selectTabByName(const std::string& title); + BOOL selectTabByName(std::string_view title); void setCurrentPanelIndex(S32 index) { mCurrentTabIdx = index; } BOOL getTabPanelFlashing(LLPanel* child); diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index 1b218e2f141..45c783e724c 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -266,7 +266,7 @@ class LLToolBar final boost::signals2::connection setButtonRemoveCallback(const button_signal_t::slot_type& cb); // append the specified string to end of tooltip - void setTooltipButtonSuffix(const std::string& suffix) { mButtonTooltipSuffix = suffix; } + void setTooltipButtonSuffix(std::string suffix) { mButtonTooltipSuffix = std::move(suffix); } LLToolBarEnums::SideType getSideType() const { return mSideType; } bool hasButtons() const { return !mButtons.empty(); } diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp index dc0ac79fede..0a8b02dc630 100644 --- a/indra/llui/lluictrl.cpp +++ b/indra/llui/lluictrl.cpp @@ -540,7 +540,7 @@ void LLUICtrl::setControlVariable(LLControlVariable* control) } //virtual -void LLUICtrl::setControlName(const std::string& control_name, LLView *context) +void LLUICtrl::setControlName(std::string_view control_name, LLView *context) { if (context == NULL) { @@ -620,9 +620,9 @@ void LLUICtrl::setMakeInvisibleControlVariable(LLControlVariable* control) } } -void LLUICtrl::setFunctionName(const std::string& function_name) +void LLUICtrl::setFunctionName(std::string function_name) { - mFunctionName = function_name; + mFunctionName = std::move(function_name); } // static diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h index ec818de0556..ebd80463ca4 100644 --- a/indra/llui/lluictrl.h +++ b/indra/llui/lluictrl.h @@ -174,7 +174,7 @@ class LLUICtrl bool setControlValue(const LLSD& value); void setControlVariable(LLControlVariable* control); - virtual void setControlName(const std::string& control, LLView *context = NULL); + virtual void setControlName(std::string_view control, LLView* context = NULL); LLControlVariable* getControlVariable() { return mControlVariable; } @@ -183,7 +183,7 @@ class LLUICtrl void setMakeVisibleControlVariable(LLControlVariable* control); void setMakeInvisibleControlVariable(LLControlVariable* control); - void setFunctionName(const std::string& function_name); + void setFunctionName(std::string function_name); virtual void setTentative(BOOL b); virtual BOOL getTentative() const; diff --git a/indra/llui/llviewmodel.cpp b/indra/llui/llviewmodel.cpp index 282addf6925..4f40f9835ee 100644 --- a/indra/llui/llviewmodel.cpp +++ b/indra/llui/llviewmodel.cpp @@ -146,7 +146,7 @@ void LLListViewModel::clearColumns() { } -void LLListViewModel::setColumnLabel(const std::string& column, const std::string& label) +void LLListViewModel::setColumnLabel(std::string_view column, const std::string& label) { } @@ -166,6 +166,6 @@ void LLListViewModel::clearRows() { } -void LLListViewModel::sortByColumn(const std::string& name, bool ascending) +void LLListViewModel::sortByColumn(std::string_view name, bool ascending) { } diff --git a/indra/llui/llviewmodel.h b/indra/llui/llviewmodel.h index 49d7c322a3d..7d843c6f50c 100644 --- a/indra/llui/llviewmodel.h +++ b/indra/llui/llviewmodel.h @@ -135,13 +135,13 @@ class LLListViewModel: public LLViewModel virtual void addColumn(const LLSD& column, EAddPosition pos = ADD_BOTTOM); virtual void clearColumns(); - virtual void setColumnLabel(const std::string& column, const std::string& label); + virtual void setColumnLabel(std::string_view column, const std::string& label); virtual LLScrollListItem* addElement(const LLSD& value, EAddPosition pos = ADD_BOTTOM, void* userdata = NULL); virtual LLScrollListItem* addSimpleElement(const std::string& value, EAddPosition pos, const LLSD& id); virtual void clearRows(); - virtual void sortByColumn(const std::string& name, bool ascending); + virtual void sortByColumn(std::string_view name, bool ascending); }; //namespace LLViewModel -- GitLab