diff options
author | Rye Mutt <rye@alchemyviewer.org> | 2024-07-02 08:55:12 -0400 |
---|---|---|
committer | Rye Mutt <rye@alchemyviewer.org> | 2024-07-02 08:55:12 -0400 |
commit | fc8c601fc1e5173267b6231f7223a0f1e76d5164 (patch) | |
tree | 8429d650c7a36469dbfb38edcce8e938eb1af144 /indra/llui/llnotifications.cpp | |
parent | fad6a3753757778d4b50d46f44aabd0d3fa3e13b (diff) |
Reduce string temporaries from LLNotifications using string_view
Diffstat (limited to 'indra/llui/llnotifications.cpp')
-rw-r--r-- | indra/llui/llnotifications.cpp | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 825956227f..8a73148631 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -266,7 +266,7 @@ LLSD LLNotificationForm::asLLSD() const return mFormData; } -LLSD LLNotificationForm::getElement(const std::string& element_name) +LLSD LLNotificationForm::getElement(std::string_view element_name) { for (LLSD::array_const_iterator it = mFormData.beginArray(); it != mFormData.endArray(); @@ -278,7 +278,7 @@ LLSD LLNotificationForm::getElement(const std::string& element_name) } -bool LLNotificationForm::hasElement(const std::string& element_name) const +bool LLNotificationForm::hasElement(std::string_view element_name) const { for (LLSD::array_const_iterator it = mFormData.beginArray(); it != mFormData.endArray(); @@ -301,7 +301,7 @@ void LLNotificationForm::getElements(LLSD& elements, S32 offset) } } -bool LLNotificationForm::getElementEnabled(const std::string& element_name) const +bool LLNotificationForm::getElementEnabled(std::string_view element_name) const { for (LLSD::array_const_iterator it = mFormData.beginArray(); it != mFormData.endArray(); @@ -316,7 +316,7 @@ bool LLNotificationForm::getElementEnabled(const std::string& element_name) cons return false; } -void LLNotificationForm::setElementEnabled(const std::string& element_name, bool enabled) +void LLNotificationForm::setElementEnabled(std::string_view element_name, bool enabled) { for (LLSD::array_iterator it = mFormData.beginArray(); it != mFormData.endArray(); @@ -769,7 +769,7 @@ bool LLNotification::hasUniquenessConstraints() const return (mTemplatep ? mTemplatep->mUnique : false); } -bool LLNotification::matchesTag(const std::string& tag) +bool LLNotification::matchesTag(std::string_view tag) { bool result = false; @@ -1443,11 +1443,12 @@ void LLNotifications::createDefaultChannels() } -LLNotificationTemplatePtr LLNotifications::getTemplate(const std::string& name) +LLNotificationTemplatePtr LLNotifications::getTemplate(std::string_view name) { - if (mTemplates.count(name)) + auto it = mTemplates.find(name); + if (it != mTemplates.end()) { - return mTemplates[name]; + return it->second; } else { @@ -1455,7 +1456,7 @@ LLNotificationTemplatePtr LLNotifications::getTemplate(const std::string& name) } } -bool LLNotifications::templateExists(const std::string& name) +bool LLNotifications::templateExists(std::string_view name) { return (mTemplates.count(name) != 0); } @@ -1740,7 +1741,7 @@ void LLNotifications::cancel(LLNotificationPtr pNotif) } } -void LLNotifications::cancelByName(const std::string& name) +void LLNotifications::cancelByName(std::string_view name) { LLMutexLock lock(&mItemsMutex); std::vector<LLNotificationPtr> notifs_to_cancel; @@ -1815,7 +1816,7 @@ LLNotificationPtr LLNotifications::find(LLUUID uuid) } } -std::string LLNotifications::getGlobalString(const std::string& key) const +std::string LLNotifications::getGlobalString(std::string_view key) const { GlobalStringMap::const_iterator it = mGlobalStrings.find(key); if (it != mGlobalStrings.end()) @@ -1826,7 +1827,7 @@ std::string LLNotifications::getGlobalString(const std::string& key) const { // if we don't have the key as a global, return the key itself so that the error // is self-diagnosing. - return key; + return std::string(key); } } @@ -1839,13 +1840,13 @@ bool LLNotifications::getIgnoreAllNotifications() return mIgnoreAllNotifications; } -void LLNotifications::setIgnored(const std::string& name, bool ignored) +void LLNotifications::setIgnored(std::string_view name, bool ignored) { LLNotificationTemplatePtr templatep = getTemplate(name); templatep->mForm->setIgnored(ignored); } -bool LLNotifications::getIgnored(const std::string& name) +bool LLNotifications::getIgnored(std::string_view name) { LLNotificationTemplatePtr templatep = getTemplate(name); return (mIgnoreAllNotifications) || ( (templatep->mForm->getIgnoreType() != LLNotificationForm::IGNORE_NO) && (templatep->mForm->getIgnored()) ); |