diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2018-12-13 00:42:49 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-12-13 18:07:25 +0100 |
commit | 0f0f8bdc3e5c1534d608f8475d9d3e3df4faddaa (patch) | |
tree | ddeb138aafb32e64b7e065406359a79c2d12c4ff /sd/source/ui/remotecontrol/Server.cxx | |
parent | 3e06873d124c9f8f4cd2e5f5d619de3c99ca09bf (diff) |
Simplify containers iterations in sd/source/ui/[a-r]*
Use range-based loop or replace with STL functions
Change-Id: I063dc78205a4cd982c252a9b62c456e9660b8790
Reviewed-on: https://gerrit.libreoffice.org/65063
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd/source/ui/remotecontrol/Server.cxx')
-rw-r--r-- | sd/source/ui/remotecontrol/Server.cxx | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/sd/source/ui/remotecontrol/Server.cxx b/sd/source/ui/remotecontrol/Server.cxx index d3551eeccec0..57adc01cc127 100644 --- a/sd/source/ui/remotecontrol/Server.cxx +++ b/sd/source/ui/remotecontrol/Server.cxx @@ -202,10 +202,9 @@ void RemoteServer::presentationStarted( const css::uno::Reference< if ( !spServer ) return; MutexGuard aGuard( sDataMutex ); - for ( vector<Communicator*>::const_iterator aIt = sCommunicators.begin(); - aIt != sCommunicators.end(); ++aIt ) + for ( const auto& rpCommunicator : sCommunicators ) { - (*aIt)->presentationStarted( rController ); + rpCommunicator->presentationStarted( rController ); } } void RemoteServer::presentationStopped() @@ -213,10 +212,9 @@ void RemoteServer::presentationStopped() if ( !spServer ) return; MutexGuard aGuard( sDataMutex ); - for ( vector<Communicator*>::const_iterator aIt = sCommunicators.begin(); - aIt != sCommunicators.end(); ++aIt ) + for ( const auto& rpCommunicator : sCommunicators ) { - (*aIt)->disposeListener(); + rpCommunicator->disposeListener(); } } @@ -225,15 +223,9 @@ void RemoteServer::removeCommunicator( Communicator const * mCommunicator ) if ( !spServer ) return; MutexGuard aGuard( sDataMutex ); - for ( vector<Communicator*>::iterator aIt = sCommunicators.begin(); - aIt != sCommunicators.end(); ++aIt ) - { - if ( mCommunicator == *aIt ) - { - sCommunicators.erase( aIt ); - break; - } - } + auto aIt = std::find(sCommunicators.begin(), sCommunicators.end(), mCommunicator); + if (aIt != sCommunicators.end()) + sCommunicators.erase( aIt ); } std::vector< std::shared_ptr< ClientInfo > > RemoteServer::getClients() @@ -318,15 +310,9 @@ bool RemoteServer::connectClient( const std::shared_ptr< ClientInfo >& pClient, sCommunicators.push_back( pCommunicator ); - for ( vector< std::shared_ptr< ClientInfoInternal > >::iterator aIt = spServer->mAvailableClients.begin(); - aIt != spServer->mAvailableClients.end(); ++aIt ) - { - if ( pClient == *aIt ) - { - spServer->mAvailableClients.erase( aIt ); - break; - } - } + auto aIt = std::find(spServer->mAvailableClients.begin(), spServer->mAvailableClients.end(), pClient); + if (aIt != spServer->mAvailableClients.end()) + spServer->mAvailableClients.erase( aIt ); pCommunicator->launch(); return true; } |