summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRye Mutt <rye@alchemyviewer.org>2024-07-02 08:56:42 -0400
committerRye Mutt <rye@alchemyviewer.org>2024-07-02 08:56:42 -0400
commit14cbf331cbf345bac83606ee5f56c994694420b3 (patch)
tree1dd59dc399543ec2ec15b7a06be6ab05e8cdd793
parent6ad1957b3163b661d7ea8c501b0a113b94f01558 (diff)
Reduce string temporaries from LLTabContainer, LLMenuGL, LLLayoutStack, and LLKeywords using string_view
-rw-r--r--indra/llui/llkeywords.cpp8
-rw-r--r--indra/llui/llkeywords.h8
-rw-r--r--indra/llui/lllayoutstack.cpp2
-rw-r--r--indra/llui/lllayoutstack.h2
-rw-r--r--indra/llui/llmenugl.cpp6
-rw-r--r--indra/llui/llmenugl.h6
-rw-r--r--indra/llui/lltabcontainer.cpp6
-rw-r--r--indra/llui/lltabcontainer.h6
-rw-r--r--indra/newview/llfloaterpreference.cpp2
9 files changed, 23 insertions, 23 deletions
diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp
index 5e184b5ddb..ea84594ad6 100644
--- a/indra/llui/llkeywords.cpp
+++ b/indra/llui/llkeywords.cpp
@@ -164,13 +164,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 : "";
}
-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")
@@ -261,7 +261,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;
@@ -333,7 +333,7 @@ void LLKeywords::processTokensGroup(const LLSD& tokens, const std::string& group
case LLKeywordToken::TT_CONSTANT:
if (getAttribute("type").length() > 0)
{
- color_group = getColorGroup(group + "-" + getAttribute("type"));
+ color_group = getColorGroup(std::string(group) + "-" + getAttribute("type"));
}
else
{
diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h
index f498b3ddee..6df2da7cd3 100644
--- a/indra/llui/llkeywords.h
+++ b/indra/llui/llkeywords.h
@@ -111,7 +111,7 @@ public:
~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,
@@ -170,7 +170,7 @@ public:
#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,
@@ -194,10 +194,10 @@ protected:
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 6db9f64a97..bb09f7a26e 100644
--- a/indra/llui/lllayoutstack.cpp
+++ b/indra/llui/lllayoutstack.cpp
@@ -548,7 +548,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 9e5f8048ba..8459921c60 100644
--- a/indra/llui/lllayoutstack.h
+++ b/indra/llui/lllayoutstack.h
@@ -111,7 +111,7 @@ private:
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/llmenugl.cpp b/indra/llui/llmenugl.cpp
index 9ab210e003..0038a8ae18 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -2752,7 +2752,7 @@ void LLMenuGL::setEnabledSubMenus(bool enable)
// setItemEnabled() - pass the label and the enable flag for a menu
// item. true will make sure it's enabled, false will disable it.
-void LLMenuGL::setItemEnabled( const std::string& name, bool enable )
+void LLMenuGL::setItemEnabled(std::string_view name, bool enable )
{
item_list_t::iterator item_iter;
for (item_iter = mItems.begin(); item_iter != mItems.end(); ++item_iter)
@@ -2766,7 +2766,7 @@ void LLMenuGL::setItemEnabled( const std::string& name, bool enable )
}
}
-void LLMenuGL::setItemVisible( const std::string& name, bool visible )
+void LLMenuGL::setItemVisible(std::string_view name, bool visible )
{
item_list_t::iterator item_iter;
for (item_iter = mItems.begin(); item_iter != mItems.end(); ++item_iter)
@@ -3277,7 +3277,7 @@ void LLMenuGL::setVisible(bool visible)
}
}
-LLMenuGL* LLMenuGL::findChildMenuByName(const std::string& name, bool recurse) const
+LLMenuGL* LLMenuGL::findChildMenuByName(std::string_view name, bool recurse) const
{
LLView* view = findChildView(name, recurse);
if (view)
diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h
index 300a669d52..66f84393fe 100644
--- a/indra/llui/llmenugl.h
+++ b/indra/llui/llmenugl.h
@@ -456,7 +456,7 @@ public:
virtual bool hasAccelerator(const KEY &key, const MASK &mask) const;
virtual bool handleAcceleratorKey(KEY key, MASK mask);
- LLMenuGL* findChildMenuByName(const std::string& name, bool recurse) const;
+ LLMenuGL* findChildMenuByName(std::string_view name, bool recurse) const;
bool clearHoverItem();
@@ -479,12 +479,12 @@ public:
// setItemEnabled() - pass the name and the enable flag for a
// menu item. true will make sure it's enabled, false will disable
// it.
- void setItemEnabled( const std::string& name, bool enable );
+ void setItemEnabled(std::string_view name, bool enable );
// propagate message to submenus
void setEnabledSubMenus(bool enable);
- void setItemVisible( const std::string& name, bool visible);
+ void setItemVisible(std::string_view name, bool visible);
void setItemLabel(const std::string &name, const std::string &label);
diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp
index f10d545126..0a617558d2 100644
--- a/indra/llui/lltabcontainer.cpp
+++ b/indra/llui/lltabcontainer.cpp
@@ -1401,7 +1401,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++)
{
@@ -1413,7 +1413,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++)
{
@@ -1637,7 +1637,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 4f0a0b2a57..40f272ffa8 100644
--- a/indra/llui/lltabcontainer.h
+++ b/indra/llui/lltabcontainer.h
@@ -190,8 +190,8 @@ public:
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);
@@ -201,7 +201,7 @@ public:
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/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index 85a07f23a4..0ec2024994 100644
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -1910,7 +1910,7 @@ void LLFloaterPreference::setCacheLocation(const LLStringExplicit& location)
void LLFloaterPreference::selectPanel(const LLSD& name)
{
LLTabContainer * tab_containerp = getChild<LLTabContainer>("pref core");
- LLPanel * panel = tab_containerp->getPanelByName(name);
+ LLPanel * panel = tab_containerp->getPanelByName(name.asStringRef());
if (NULL != panel)
{
tab_containerp->selectTabPanel(panel);