From 96fa0df15b2be95fc3c4dc3df8ad9b77a4baeebd Mon Sep 17 00:00:00 2001 From: Daniel Robertson Date: Wed, 23 Sep 2015 08:53:42 -0400 Subject: comphelper: replace for_each with range-based for Replace complex uses of ::std::for_each with a range-based for-loop. Change-Id: I57d3d2e830e7700b793e1836777cbe72504c6825 Reviewed-on: https://gerrit.libreoffice.org/18817 Tested-by: Jenkins Reviewed-by: Noel Grandin --- comphelper/source/property/MasterPropertySet.cxx | 36 +++++++++--------------- 1 file changed, 13 insertions(+), 23 deletions(-) (limited to 'comphelper/source/property/MasterPropertySet.cxx') diff --git a/comphelper/source/property/MasterPropertySet.cxx b/comphelper/source/property/MasterPropertySet.cxx index 358e6918fca6..e6c7ed2b9c90 100644 --- a/comphelper/source/property/MasterPropertySet.cxx +++ b/comphelper/source/property/MasterPropertySet.cxx @@ -78,12 +78,8 @@ MasterPropertySet::MasterPropertySet( comphelper::MasterPropertySetInfo* pInfo, MasterPropertySet::~MasterPropertySet() throw() { - SlaveMap::iterator aEnd = maSlaveMap.end(), aIter = maSlaveMap.begin(); - while (aIter != aEnd ) - { - delete (*aIter).second; - ++aIter; - } + for( auto& rSlave : maSlaveMap ) + delete rSlave.second; } // XPropertySet @@ -248,15 +244,13 @@ void SAL_CALL MasterPropertySet::setPropertyValues( const Sequence< OUString >& } _postSetValues(); - SlaveMap::const_iterator aSlaveIter = maSlaveMap.begin(), aSlaveEnd = maSlaveMap.end(); - while (aSlaveIter != aSlaveEnd) + for( const auto& rSlave : maSlaveMap ) { - if ( (*aSlaveIter).second->IsInit()) + if( rSlave.second->IsInit() ) { - (*aSlaveIter).second->mpSlave->_postSetValues(); - (*aSlaveIter).second->SetInit ( false ); + rSlave.second->mpSlave->_postSetValues(); + rSlave.second->SetInit( false ); } - ++aSlaveIter; } } } @@ -313,15 +307,13 @@ Sequence< Any > SAL_CALL MasterPropertySet::getPropertyValues( const Sequence< O } _postSetValues(); - SlaveMap::const_iterator aSlaveIter = maSlaveMap.begin(), aSlaveEnd = maSlaveMap.end(); - while (aSlaveIter != aSlaveEnd) + for( const auto& rSlave : maSlaveMap ) { - if ( (*aSlaveIter).second->IsInit()) + if( rSlave.second->IsInit() ) { - (*aSlaveIter).second->mpSlave->_postSetValues(); - (*aSlaveIter).second->SetInit ( false ); + rSlave.second->mpSlave->_postSetValues(); + rSlave.second->SetInit( false ); } - ++aSlaveIter; } } return aValues; @@ -415,15 +407,13 @@ Sequence< PropertyState > SAL_CALL MasterPropertySet::getPropertyStates( const S } } _postGetPropertyState(); - SlaveMap::const_iterator aSlaveIter = maSlaveMap.begin(), aSlaveEnd = maSlaveMap.end(); - while (aSlaveIter != aSlaveEnd) + for( const auto& rSlave : maSlaveMap ) { - if ( (*aSlaveIter).second->IsInit()) + if( rSlave.second->IsInit() ) { comphelper::ChainablePropertySet::_postGetPropertyState(); - (*aSlaveIter).second->SetInit ( false ); + rSlave.second->SetInit( false ); } - ++aSlaveIter; } } return aStates; -- cgit