diff options
author | Ansariel <ansariel.hiller@phoenixviewer.com> | 2024-01-09 00:16:52 +0100 |
---|---|---|
committer | Andrey Lihatskiy <alihatskiy@productengine.com> | 2024-01-09 20:44:50 +0200 |
commit | ba74152c823563a66729ea0a7fb7cab5bf58980d (patch) | |
tree | f84e51530d96cfa9512ffc42bce694a521415975 /indra/llui | |
parent | 8e3fb2da0f91729f4a7a663002c68abd80d4a3e7 (diff) |
Replace BOOST_FOREACH with standard C++ range-based for-loops
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llcommandmanager.cpp | 4 | ||||
-rw-r--r-- | indra/llui/llfloater.cpp | 8 | ||||
-rw-r--r-- | indra/llui/lllayoutstack.cpp | 41 | ||||
-rw-r--r-- | indra/llui/llloadingindicator.cpp | 3 | ||||
-rw-r--r-- | indra/llui/llmenugl.cpp | 3 | ||||
-rw-r--r-- | indra/llui/llnotifications.cpp | 17 | ||||
-rw-r--r-- | indra/llui/llnotificationslistener.cpp | 1 | ||||
-rw-r--r-- | indra/llui/lltoolbar.cpp | 13 | ||||
-rw-r--r-- | indra/llui/lluicolortable.cpp | 3 | ||||
-rw-r--r-- | indra/llui/llview.cpp | 27 |
10 files changed, 56 insertions, 64 deletions
diff --git a/indra/llui/llcommandmanager.cpp b/indra/llui/llcommandmanager.cpp index 3e159365e5..8ef7bd837f 100644 --- a/indra/llui/llcommandmanager.cpp +++ b/indra/llui/llcommandmanager.cpp @@ -34,8 +34,6 @@ #include "llerror.h" #include "llxuiparser.h" -#include <boost/foreach.hpp> - // // LLCommandId class @@ -182,7 +180,7 @@ bool LLCommandManager::load() return false; } - BOOST_FOREACH(LLCommand::Params& commandParams, commandsParams.commands) + for (const LLCommand::Params& commandParams : commandsParams.commands) { LLCommand * command = new LLCommand(commandParams); diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 2303cd24b7..a2beda5b9e 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -59,7 +59,6 @@ #include "llmultifloater.h" #include "llsdutil.h" #include "lluiusage.h" -#include <boost/foreach.hpp> // use this to control "jumping" behavior when Ctrl-Tabbing @@ -2385,7 +2384,7 @@ void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent) //{ // floaterp->translate(translate_x, translate_y); //} - BOOST_FOREACH(LLHandle<LLFloater> dependent_floater, floaterp->mDependents) + for (LLHandle<LLFloater> dependent_floater : floaterp->mDependents) { if (dependent_floater.get()) { @@ -2400,10 +2399,9 @@ void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent) void LLFloaterView::restoreAll() { // make sure all subwindows aren't minimized - child_list_t child_list = *(getChildList()); - for (child_list_const_iter_t child_it = child_list.begin(); child_it != child_list.end(); ++child_it) + for (auto child : *getChildList()) { - LLFloater* floaterp = dynamic_cast<LLFloater*>(*child_it); + LLFloater* floaterp = dynamic_cast<LLFloater*>(child); if (floaterp) { floaterp->setMinimized(FALSE); diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 7e4e828a88..9ccf3b1627 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -395,8 +395,7 @@ void LLLayoutStack::updateLayout() : getRect().getHeight(); // first, assign minimum dimensions - LLLayoutPanel* panelp = NULL; - BOOST_FOREACH(panelp, mPanels) + for (LLLayoutPanel* panelp : mPanels) { if (panelp->mAutoResize) { @@ -409,12 +408,15 @@ void LLLayoutStack::updateLayout() llassert(total_visible_fraction < 1.05f); // don't need spacing after last panel - space_to_distribute += panelp ? ll_round((F32)mPanelSpacing * panelp->getVisibleAmount()) : 0; + { + LLLayoutPanel* panelp = mPanels.empty() ? nullptr : mPanels.back(); + space_to_distribute += panelp ? ll_round((F32)mPanelSpacing * panelp->getVisibleAmount()) : 0; + } S32 remaining_space = space_to_distribute; if (space_to_distribute > 0 && total_visible_fraction > 0.f) { // give space proportionally to visible auto resize panels - BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + for (LLLayoutPanel* panelp : mPanels) { if (panelp->mAutoResize) { @@ -427,7 +429,7 @@ void LLLayoutStack::updateLayout() } // distribute any left over pixels to non-collapsed, visible panels - BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + for (LLLayoutPanel* panelp : mPanels) { if (remaining_space == 0) break; @@ -443,7 +445,7 @@ void LLLayoutStack::updateLayout() F32 cur_pos = (mOrientation == HORIZONTAL) ? 0.f : (F32)getRect().getHeight(); - BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + for (LLLayoutPanel* panelp : mPanels) { F32 panel_dim = llmax(panelp->getExpandedMinDim(), panelp->mTargetDim); @@ -538,7 +540,7 @@ LLLayoutPanel* LLLayoutStack::findEmbeddedPanel(LLPanel* panelp) const { if (!panelp) return NULL; - BOOST_FOREACH(LLLayoutPanel* p, mPanels) + for (LLLayoutPanel* p : mPanels) { if (p == panelp) { @@ -552,7 +554,7 @@ LLLayoutPanel* LLLayoutStack::findEmbeddedPanelByName(const std::string& name) c { LLLayoutPanel* result = NULL; - BOOST_FOREACH(LLLayoutPanel* p, mPanels) + for (LLLayoutPanel* p : mPanels) { if (p->getName() == name) { @@ -566,7 +568,7 @@ LLLayoutPanel* LLLayoutStack::findEmbeddedPanelByName(const std::string& name) c void LLLayoutStack::createResizeBar(LLLayoutPanel* panelp) { - BOOST_FOREACH(LLLayoutPanel* lp, mPanels) + for (LLLayoutPanel* lp : mPanels) { if (lp->mResizeBar == NULL) { @@ -669,7 +671,7 @@ void LLLayoutStack::updateFractionalSizes() { F32 total_resizable_dim = 0.f; - BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + for (LLLayoutPanel* panelp : mPanels) { if (panelp->mAutoResize) { @@ -677,7 +679,7 @@ void LLLayoutStack::updateFractionalSizes() } } - BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + for (LLLayoutPanel* panelp : mPanels) { if (panelp->mAutoResize) { @@ -698,7 +700,7 @@ void LLLayoutStack::normalizeFractionalSizes() S32 num_auto_resize_panels = 0; F32 total_fractional_size = 0.f; - BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + for (LLLayoutPanel* panelp : mPanels) { if (panelp->mAutoResize) { @@ -709,7 +711,7 @@ void LLLayoutStack::normalizeFractionalSizes() if (total_fractional_size == 0.f) { // equal distribution - BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + for (LLLayoutPanel* panelp : mPanels) { if (panelp->mAutoResize) { @@ -719,7 +721,7 @@ void LLLayoutStack::normalizeFractionalSizes() } else { // renormalize - BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + for (LLLayoutPanel* panelp : mPanels) { if (panelp->mAutoResize) { @@ -736,7 +738,7 @@ bool LLLayoutStack::animatePanels() // // animate visibility // - BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + for (LLLayoutPanel* panelp : mPanels) { if (panelp->getVisible()) { @@ -834,7 +836,7 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& LLLayoutPanel* other_resize_panel = NULL; LLLayoutPanel* following_panel = NULL; - BOOST_REVERSE_FOREACH(LLLayoutPanel* panelp, mPanels) + BOOST_REVERSE_FOREACH(LLLayoutPanel* panelp, mPanels) // Should replace this when C++20 reverse view adaptor becomes available... { if (panelp->mAutoResize) { @@ -883,7 +885,7 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& AFTER_RESIZED_PANEL } which_panel = BEFORE_RESIZED_PANEL; - BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + for (LLLayoutPanel* panelp : mPanels) { if (!panelp->getVisible() || panelp->mCollapsed) { @@ -974,6 +976,7 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& MIN_FRACTIONAL_SIZE, MAX_FRACTIONAL_SIZE); } + break; default: break; } @@ -990,8 +993,8 @@ void LLLayoutStack::reshape(S32 width, S32 height, BOOL called_from_parent) void LLLayoutStack::updateResizeBarLimits() { - LLLayoutPanel* previous_visible_panelp = NULL; - BOOST_REVERSE_FOREACH(LLLayoutPanel* visible_panelp, mPanels) + LLLayoutPanel* previous_visible_panelp{ nullptr }; + BOOST_REVERSE_FOREACH(LLLayoutPanel* visible_panelp, mPanels) // Should replace this when C++20 reverse view adaptor becomes available... { if (!visible_panelp->getVisible() || visible_panelp->mCollapsed) { diff --git a/indra/llui/llloadingindicator.cpp b/indra/llui/llloadingindicator.cpp index 1ede5b706f..e8b6b7e43b 100644 --- a/indra/llui/llloadingindicator.cpp +++ b/indra/llui/llloadingindicator.cpp @@ -34,7 +34,6 @@ // Project includes #include "lluictrlfactory.h" #include "lluiimage.h" -#include "boost/foreach.hpp" // registered in llui.cpp to avoid being left out by MS linker //static LLDefaultChildRegistry::Register<LLLoadingIndicator> r("loading_indicator"); @@ -52,7 +51,7 @@ LLLoadingIndicator::LLLoadingIndicator(const Params& p) void LLLoadingIndicator::initFromParams(const Params& p) { - BOOST_FOREACH(LLUIImage* image, p.images().image) + for (LLUIImage* image : p.images().image) { mImages.push_back(image); } diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index cebca70b59..76b50e0cdd 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -60,7 +60,6 @@ #include "v2math.h" #include <set> #include <boost/tokenizer.hpp> -#include <boost/foreach.hpp> // static LLMenuHolderGL *LLMenuGL::sMenuContainer = NULL; @@ -2156,7 +2155,7 @@ void LLMenuGL::arrange( void ) } else { - BOOST_FOREACH(LLMenuItemGL* itemp, mItems) + for (LLMenuItemGL* itemp : mItems) { // do first so LLMenuGLItemCall can call on_visible to determine if visible itemp->buildDrawLabel(); diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index d736aa6634..d5bfef132e 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -45,7 +45,6 @@ #include <algorithm> #include <boost/regex.hpp> -#include <boost/foreach.hpp> const std::string NOTIFICATION_PERSIST_VERSION = "0.93"; @@ -444,14 +443,14 @@ LLNotificationTemplate::LLNotificationTemplate(const LLNotificationTemplate::Par mSoundName = p.sound; } - BOOST_FOREACH(const LLNotificationTemplate::UniquenessContext& context, p.unique.contexts) + for (const LLNotificationTemplate::UniquenessContext& context : p.unique.contexts) { mUniqueContext.push_back(context.value); } LL_DEBUGS("Notifications") << "notification \"" << mName << "\": tag count is " << p.tags.size() << LL_ENDL; - BOOST_FOREACH(const LLNotificationTemplate::Tag& tag, p.tags) + for (const LLNotificationTemplate::Tag& tag : p.tags) { LL_DEBUGS("Notifications") << " tag \"" << std::string(tag.value) << "\"" << LL_ENDL; mTags.push_back(tag.value); @@ -1153,7 +1152,7 @@ LLNotificationChannel::LLNotificationChannel(const Params& p) LLInstanceTracker<LLNotificationChannel, std::string>(p.name.isProvided() ? p.name : LLUUID::generateNewID().asString()), mName(p.name.isProvided() ? p.name : LLUUID::generateNewID().asString()) { - BOOST_FOREACH(const std::string& source, p.sources) + for (const std::string& source : p.sources) { connectToChannel(source); } @@ -1521,7 +1520,7 @@ void replaceFormText(LLNotificationForm::Params& form, const std::string& patter form.ignore.text = replace; } - BOOST_FOREACH(LLNotificationForm::FormElement& element, form.form_elements.elements) + for (LLNotificationForm::FormElement& element : form.form_elements.elements) { if (element.button.isChosen() && element.button.text() == pattern) { @@ -1569,19 +1568,19 @@ bool LLNotifications::loadTemplates() mTemplates.clear(); - BOOST_FOREACH(LLNotificationTemplate::GlobalString& string, params.strings) + for (const LLNotificationTemplate::GlobalString& string : params.strings) { mGlobalStrings[string.name] = string.value; } std::map<std::string, LLNotificationForm::Params> form_templates; - BOOST_FOREACH(LLNotificationTemplate::Template& notification_template, params.templates) + for (const LLNotificationTemplate::Template& notification_template : params.templates) { form_templates[notification_template.name] = notification_template.form; } - BOOST_FOREACH(LLNotificationTemplate::Params& notification, params.notifications) + for (LLNotificationTemplate::Params& notification : params.notifications) { if (notification.form_ref.form_template.isChosen()) { @@ -1635,7 +1634,7 @@ bool LLNotifications::loadVisibilityRules() mVisibilityRules.clear(); - BOOST_FOREACH(LLNotificationVisibilityRule::Rule& rule, params.rules) + for (const LLNotificationVisibilityRule::Rule& rule : params.rules) { mVisibilityRules.push_back(LLNotificationVisibilityRulePtr(new LLNotificationVisibilityRule(rule))); } diff --git a/indra/llui/llnotificationslistener.cpp b/indra/llui/llnotificationslistener.cpp index e73ba1fbe9..02108c089c 100644 --- a/indra/llui/llnotificationslistener.cpp +++ b/indra/llui/llnotificationslistener.cpp @@ -32,7 +32,6 @@ #include "llnotificationtemplate.h" #include "llsd.h" #include "llui.h" -#include <boost/foreach.hpp> LLNotificationsListener::LLNotificationsListener(LLNotifications & notifications) : LLEventAPI("LLNotifications", diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 2707f7a15c..04772ddc73 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -27,7 +27,6 @@ #include "linden_common.h" -#include <boost/foreach.hpp> #include "lltoolbar.h" #include "llcommandmanager.h" @@ -219,7 +218,7 @@ void LLToolBar::initFromParams(const LLToolBar::Params& p) mCenteringStack->addChild(LLUICtrlFactory::create<LLLayoutPanel>(border_panel_p)); - BOOST_FOREACH(LLCommandId id, p.commands) + for (const LLCommandId& id : p.commands) { addCommand(id); } @@ -417,7 +416,7 @@ BOOL LLToolBar::handleRightMouseDown(S32 x, S32 y, MASK mask) // Determine which button the mouse was over during the click in case the context menu action // is intended to affect the button. mRightMouseTargetButton = NULL; - BOOST_FOREACH(LLToolBarButton* button, mButtons) + for (LLToolBarButton* button : mButtons) { LLRect button_rect; button->localRectToOtherView(button->getLocalRect(), &button_rect, this); @@ -505,7 +504,7 @@ void LLToolBar::setButtonType(LLToolBarEnums::ButtonType button_type) void LLToolBar::resizeButtonsInRow(std::vector<LLToolBarButton*>& buttons_in_row, S32 max_row_girth) { // make buttons in current row all same girth - BOOST_FOREACH(LLToolBarButton* button, buttons_in_row) + for (LLToolBarButton* button : buttons_in_row) { if (getOrientation(mSideType) == LLLayoutStack::HORIZONTAL) { @@ -693,7 +692,7 @@ void LLToolBar::updateLayoutAsNeeded() std::vector<LLToolBarButton*> buttons_in_row; - BOOST_FOREACH(LLToolBarButton* button, mButtons) + for (LLToolBarButton* button : mButtons) { button->reshape(button->mWidthRange.getMin(), button->mDesiredHeight); button->autoResize(); @@ -878,7 +877,7 @@ void LLToolBar::createButtons() { std::set<LLUUID> set_flashing; - BOOST_FOREACH(LLToolBarButton* button, mButtons) + for (LLToolBarButton* button : mButtons) { if (button->getFlashTimer() && button->getFlashTimer()->isFlashingInProgress()) { @@ -896,7 +895,7 @@ void LLToolBar::createButtons() mButtonMap.clear(); mRightMouseTargetButton = NULL; - BOOST_FOREACH(LLCommandId& command_id, mButtonCommands) + for (const LLCommandId& command_id : mButtonCommands) { LLToolBarButton* button = createButton(command_id); mButtons.push_back(button); diff --git a/indra/llui/lluicolortable.cpp b/indra/llui/lluicolortable.cpp index 096336045c..f43bdf1fdc 100644 --- a/indra/llui/lluicolortable.cpp +++ b/indra/llui/lluicolortable.cpp @@ -32,7 +32,6 @@ #include "llui.h" #include "lluicolortable.h" #include "lluictrlfactory.h" -#include <boost/foreach.hpp> LLUIColorTable::ColorParams::ColorParams() : value("value"), @@ -208,7 +207,7 @@ bool LLUIColorTable::loadFromSettings() // pass constraint=LLDir::ALL_SKINS because we want colors.xml from every // skin dir - BOOST_FOREACH(std::string colors_path, + for (const std::string& colors_path : gDirUtilp->findSkinnedFilenames(LLDir::SKINBASE, "colors.xml", LLDir::ALL_SKINS)) { result |= loadFromFilename(colors_path, mLoadedColors); diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index da7868d804..070cd4b107 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -32,7 +32,6 @@ #include <sstream> #include <boost/tokenizer.hpp> -#include <boost/foreach.hpp> #include <boost/bind.hpp> #include "llrender.h" @@ -592,7 +591,7 @@ void LLView::deleteAllChildren() void LLView::setAllChildrenEnabled(BOOL b) { - BOOST_FOREACH(LLView* viewp, mChildList) + for (LLView* viewp : mChildList) { viewp->setEnabled(b); } @@ -621,7 +620,7 @@ void LLView::onVisibilityChange ( BOOL new_visibility ) { BOOL old_visibility; BOOL log_visibility_change = LLViewerEventRecorder::instance().getLoggingStatus(); - BOOST_FOREACH(LLView* viewp, mChildList) + for (LLView* viewp : mChildList) { if (!viewp) { @@ -725,7 +724,7 @@ LLView* LLView::childrenHandleCharEvent(const std::string& desc, const METHOD& m { if ( getVisible() && getEnabled() ) { - BOOST_FOREACH(LLView* viewp, mChildList) + for (LLView* viewp : mChildList) { if ((viewp->*method)(c, mask, TRUE)) { @@ -744,7 +743,7 @@ LLView* LLView::childrenHandleCharEvent(const std::string& desc, const METHOD& m template <typename METHOD, typename XDATA> LLView* LLView::childrenHandleMouseEvent(const METHOD& method, S32 x, S32 y, XDATA extra, bool allow_mouse_block) { - BOOST_FOREACH(LLView* viewp, mChildList) + for (LLView* viewp : mChildList) { S32 local_x = x - viewp->getRect().mLeft; S32 local_y = y - viewp->getRect().mBottom; @@ -773,7 +772,7 @@ LLView* LLView::childrenHandleMouseEvent(const METHOD& method, S32 x, S32 y, XDA LLView* LLView::childrenHandleToolTip(S32 x, S32 y, MASK mask) { - BOOST_FOREACH(LLView* viewp, mChildList) + for (LLView* viewp : mChildList) { S32 local_x = x - viewp->getRect().mLeft; S32 local_y = y - viewp->getRect().mBottom; @@ -805,7 +804,7 @@ LLView* LLView::childrenHandleDragAndDrop(S32 x, S32 y, MASK mask, // default to not accepting drag and drop, will be overridden by handler *accept = ACCEPT_NO; - BOOST_FOREACH(LLView* viewp, mChildList) + for (LLView* viewp : mChildList) { S32 local_x = x - viewp->getRect().mLeft; S32 local_y = y - viewp->getRect().mBottom; @@ -831,7 +830,7 @@ LLView* LLView::childrenHandleDragAndDrop(S32 x, S32 y, MASK mask, LLView* LLView::childrenHandleHover(S32 x, S32 y, MASK mask) { - BOOST_FOREACH(LLView* viewp, mChildList) + for (LLView* viewp : mChildList) { S32 local_x = x - viewp->getRect().mLeft; S32 local_y = y - viewp->getRect().mBottom; @@ -859,7 +858,7 @@ LLView* LLView::childFromPoint(S32 x, S32 y, bool recur) if (!getVisible()) return NULL; - BOOST_FOREACH(LLView* viewp, mChildList) + for (LLView* viewp : mChildList) { S32 local_x = x - viewp->getRect().mLeft; S32 local_y = y - viewp->getRect().mBottom; @@ -1379,7 +1378,7 @@ void LLView::reshape(S32 width, S32 height, BOOL called_from_parent) mRect.mTop = getRect().mBottom + height; // move child views according to reshape flags - BOOST_FOREACH(LLView* viewp, mChildList) + for (LLView* viewp : mChildList) { if (viewp != NULL) { @@ -1451,7 +1450,7 @@ LLRect LLView::calcBoundingRect() { LLRect local_bounding_rect = LLRect::null; - BOOST_FOREACH(LLView* childp, mChildList) + for (LLView* childp : mChildList) { // ignore invisible and "top" children when calculating bounding rect // such as combobox popups @@ -1614,7 +1613,7 @@ LLView* LLView::findChildView(const std::string& name, BOOL recurse) const LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; // Look for direct children *first* - BOOST_FOREACH(LLView* childp, mChildList) + for (LLView* childp : mChildList) { llassert(childp); if (childp->getName() == name) @@ -1625,7 +1624,7 @@ LLView* LLView::findChildView(const std::string& name, BOOL recurse) const if (recurse) { // Look inside each child as well. - BOOST_FOREACH(LLView* childp, mChildList) + for (LLView* childp : mChildList) { llassert(childp); LLView* viewp = childp->findChildView(name, recurse); @@ -2800,7 +2799,7 @@ S32 LLView::notifyParent(const LLSD& info) bool LLView::notifyChildren(const LLSD& info) { bool ret = false; - BOOST_FOREACH(LLView* childp, mChildList) + for (LLView* childp : mChildList) { ret = ret || childp->notifyChildren(info); } |