summaryrefslogtreecommitdiff
path: root/basic/source/basmgr
diff options
context:
space:
mode:
authorArkadiy Illarionov <qarkai@gmail.com>2019-03-13 21:11:09 +0300
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-03-16 20:16:46 +0100
commit10a48c737d347bcce765c8fbe009bc1dd0bb0c4d (patch)
tree6688e9ca36964bcbf589e60452a331b49a81bfde /basic/source/basmgr
parentbb9728bbf9bb29ef2b6ca582a382f66e9adf2623 (diff)
Simplify containers iterations in basctl, basegfx, basic, bridges
Use range-based loop or replace with STL functions Change-Id: I8594740103bdc2091c2d03d4b92bbe8393f5378c Reviewed-on: https://gerrit.libreoffice.org/69223 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basic/source/basmgr')
-rw-r--r--basic/source/basmgr/basicmanagerrepository.cxx36
1 files changed, 14 insertions, 22 deletions
diff --git a/basic/source/basmgr/basicmanagerrepository.cxx b/basic/source/basmgr/basicmanagerrepository.cxx
index 1cc6eab188cf..c282eabacbcd 100644
--- a/basic/source/basmgr/basicmanagerrepository.cxx
+++ b/basic/source/basmgr/basicmanagerrepository.cxx
@@ -555,16 +555,13 @@ namespace basic
Reference< XInterface > xNormalizedSource( _rSource.Source, UNO_QUERY );
- for ( BasicManagerStore::iterator loop = m_aStore.begin();
- loop != m_aStore.end();
- ++loop
- )
+ BasicManagerStore::iterator it = std::find_if(m_aStore.begin(), m_aStore.end(),
+ [&xNormalizedSource](BasicManagerStore::reference rEntry) {
+ return rEntry.first.get() == xNormalizedSource.get(); });
+ if (it != m_aStore.end())
{
- if ( loop->first.get() == xNormalizedSource.get() )
- {
- impl_removeFromRepository( loop );
- return;
- }
+ impl_removeFromRepository( it );
+ return;
}
OSL_FAIL( "ImplRepository::_disposing: where does this come from?" );
@@ -580,20 +577,15 @@ namespace basic
BasicManager* pManager = dynamic_cast< BasicManager* >( &_rBC );
OSL_ENSURE( pManager, "ImplRepository::Notify: where does this come from?" );
- for ( BasicManagerStore::iterator loop = m_aStore.begin();
- loop != m_aStore.end();
- ++loop
- )
+ BasicManagerStore::iterator it = std::find_if(m_aStore.begin(), m_aStore.end(),
+ [&pManager](BasicManagerStore::reference rEntry) { return rEntry.second.get() == pManager; });
+ if (it != m_aStore.end())
{
- if ( loop->second.get() == pManager )
- {
- // a BasicManager which is still in our repository is being deleted.
- // That's bad, since by definition, we *own* all instances in our
- // repository.
- OSL_FAIL( "ImplRepository::Notify: nobody should tamper with the managers, except ourself!" );
- m_aStore.erase( loop );
- break;
- }
+ // a BasicManager which is still in our repository is being deleted.
+ // That's bad, since by definition, we *own* all instances in our
+ // repository.
+ OSL_FAIL( "ImplRepository::Notify: nobody should tamper with the managers, except ourself!" );
+ m_aStore.erase( it );
}
}