summaryrefslogtreecommitdiff
path: root/svl/source/notify
diff options
context:
space:
mode:
authorArkadiy Illarionov <qarkai@gmail.com>2018-11-24 23:39:59 +0300
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-11-25 12:29:05 +0100
commit260002b16f18634a7e1d10d4160378beb0cc0c5f (patch)
tree2528cb63cafa6c8e52ef1537802a737990db3445 /svl/source/notify
parent159b30d92f7a17f1d77417a2ed1836ea72699a0e (diff)
Simplify containers iterations in svgio, svl, svtools
Use range-based loop or replace with STL functions Change-Id: I98a3e55a14c8ac00188c5003f84194c2cc6795fb Reviewed-on: https://gerrit.libreoffice.org/63959 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svl/source/notify')
-rw-r--r--svl/source/notify/broadcast.cxx16
-rw-r--r--svl/source/notify/listener.cxx11
2 files changed, 11 insertions, 16 deletions
diff --git a/svl/source/notify/broadcast.cxx b/svl/source/notify/broadcast.cxx
index 626a48a332e9..9a63e4b2b67b 100644
--- a/svl/source/notify/broadcast.cxx
+++ b/svl/source/notify/broadcast.cxx
@@ -101,14 +101,14 @@ SvtBroadcaster::~SvtBroadcaster()
// listeners, with the exception of those that already asked to be removed
// during their own destruction
ListenersType::const_iterator dest(maDestructedListeners.begin());
- for (ListenersType::iterator it(maListeners.begin()); it != maListeners.end(); ++it)
+ for (auto& rpListener : maListeners)
{
// skip the destructed ones
- while (dest != maDestructedListeners.end() && (*dest < *it))
+ while (dest != maDestructedListeners.end() && (*dest < rpListener))
++dest;
- if (dest == maDestructedListeners.end() || *dest != *it)
- (*it)->BroadcasterDying(*this);
+ if (dest == maDestructedListeners.end() || *dest != rpListener)
+ rpListener->BroadcasterDying(*this);
}
}
@@ -118,14 +118,14 @@ void SvtBroadcaster::Broadcast( const SfxHint &rHint )
ListenersType::const_iterator dest(maDestructedListeners.begin());
ListenersType aListeners(maListeners); // this copy is important to avoid erasing entries while iterating
- for (ListenersType::iterator it(aListeners.begin()); it != aListeners.end(); ++it)
+ for (auto& rpListener : aListeners)
{
// skip the destructed ones
- while (dest != maDestructedListeners.end() && (*dest < *it))
+ while (dest != maDestructedListeners.end() && (*dest < rpListener))
++dest;
- if (dest == maDestructedListeners.end() || *dest != *it)
- (*it)->Notify(rHint);
+ if (dest == maDestructedListeners.end() || *dest != rpListener)
+ rpListener->Notify(rHint);
}
}
diff --git a/svl/source/notify/listener.cxx b/svl/source/notify/listener.cxx
index 6a54f6465c75..22d5508a3cef 100644
--- a/svl/source/notify/listener.cxx
+++ b/svl/source/notify/listener.cxx
@@ -76,11 +76,9 @@ void SvtListener::BroadcasterDying( SvtBroadcaster& rBroadcaster )
void SvtListener::EndListeningAll()
{
- BroadcastersType::iterator it = maBroadcasters.begin();
- BroadcastersType::const_iterator itEnd = maBroadcasters.end();
- for (; it != itEnd; ++it)
+ for (SvtBroadcaster* p : maBroadcasters)
{
- SvtBroadcaster& rBC = **it;
+ SvtBroadcaster& rBC = *p;
rBC.Remove(this);
}
maBroadcasters.clear();
@@ -92,11 +90,8 @@ void SvtListener::CopyAllBroadcasters( const SvtListener& r )
EndListeningAll();
BroadcastersType aCopy(r.maBroadcasters);
maBroadcasters.swap(aCopy);
- BroadcastersType::iterator it = maBroadcasters.begin();
- BroadcastersType::const_iterator itEnd = maBroadcasters.end();
- for (; it != itEnd; ++it)
+ for (SvtBroadcaster* p : maBroadcasters)
{
- SvtBroadcaster* p = *it;
p->Add(this);
}
}