diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-02-20 01:10:07 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-02-20 07:17:38 +0100 |
commit | 6a143985bdc5d12d1f9e8cf8592440282986c099 (patch) | |
tree | 346e09d6ba1146b52a6a484a2883f3e898184648 /extensions/source/propctrlr/propcontroller.cxx | |
parent | d707a5e64ba53ddb7669cca725915527aa788a6b (diff) |
Simplify containers iterations in desktop, dtrans, editeng, extensions
Use range-based loop or replace with STL functions
Change-Id: Ic5389d123d0a6a32a8bb46b081165e94a7c55292
Reviewed-on: https://gerrit.libreoffice.org/68036
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'extensions/source/propctrlr/propcontroller.cxx')
-rw-r--r-- | extensions/source/propctrlr/propcontroller.cxx | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/extensions/source/propctrlr/propcontroller.cxx b/extensions/source/propctrlr/propcontroller.cxx index 062df51c042c..9f6fa9fcbaed 100644 --- a/extensions/source/propctrlr/propcontroller.cxx +++ b/extensions/source/propctrlr/propcontroller.cxx @@ -596,17 +596,10 @@ namespace pcr m_pView = nullptr; } - for ( InterfaceArray::iterator loop = m_aInspectedObjects.begin(); - loop != m_aInspectedObjects.end(); - ++loop - ) - { - if ( *loop == _rSource.Source ) - { - m_aInspectedObjects.erase( loop ); - break; - } - } + auto it = std::find_if(m_aInspectedObjects.begin(), m_aInspectedObjects.end(), + [&_rSource](const InterfaceArray::value_type& rxObj) { return rxObj == _rSource.Source; }); + if (it != m_aInspectedObjects.end()) + m_aInspectedObjects.erase(it); } @@ -1462,10 +1455,8 @@ namespace pcr bool OPropertyBrowserController::impl_findObjectProperty_nothrow( const OUString& _rName, OrderedPropertyMap::const_iterator* _pProperty ) { - OrderedPropertyMap::const_iterator search = m_aProperties.begin(); - for ( ; search != m_aProperties.end(); ++search ) - if ( search->second.Name == _rName ) - break; + OrderedPropertyMap::const_iterator search = std::find_if(m_aProperties.begin(), m_aProperties.end(), + [&_rName](const OrderedPropertyMap::value_type& rEntry) { return rEntry.second.Name == _rName; }); if ( _pProperty ) *_pProperty = search; return ( search != m_aProperties.end() ); |