diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-02-16 18:39:23 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-02-18 07:41:05 +0100 |
commit | 44841a6778821be3e68ab15819b39064b20e968f (patch) | |
tree | 8e9119cf35764f18f5b008e7758c6f950306fb8c /fpicker | |
parent | bcfbd24be02d2de5d4d27c147dc58c4515a9a0f5 (diff) |
Simplify containers iterations in [f-l]*
Use range-based loop or replace with STL functions
Change-Id: Ib3fab47318d1bfbb4df8f886a8cd9596525a420f
Reviewed-on: https://gerrit.libreoffice.org/67914
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'fpicker')
-rw-r--r-- | fpicker/source/office/OfficeFilePicker.cxx | 12 | ||||
-rw-r--r-- | fpicker/source/office/iodlg.cxx | 7 | ||||
-rw-r--r-- | fpicker/source/win32/FilterContainer.cxx | 12 |
3 files changed, 8 insertions, 23 deletions
diff --git a/fpicker/source/office/OfficeFilePicker.cxx b/fpicker/source/office/OfficeFilePicker.cxx index e5fc93325a0d..dd6712541722 100644 --- a/fpicker/source/office/OfficeFilePicker.cxx +++ b/fpicker/source/office/OfficeFilePicker.cxx @@ -573,17 +573,7 @@ Sequence< OUString > SAL_CALL SvtFilePicker::getSelectedFiles() return aEmpty; } - std::vector<OUString> aPathList(getDialog()->GetPathList()); - size_t nCount = aPathList.size(); - - Sequence< OUString > aFiles(nCount); - - for(size_t i = 0; i < aPathList.size(); ++i) - { - aFiles[i] = aPathList[i]; - } - - return aFiles; + return comphelper::containerToSequence(getDialog()->GetPathList()); } Sequence< OUString > SAL_CALL SvtFilePicker::getFiles() diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx index 8064dca1c8fe..b3e5ace8c95d 100644 --- a/fpicker/source/office/iodlg.cxx +++ b/fpicker/source/office/iodlg.cxx @@ -1767,12 +1767,9 @@ void SvtFileDialog::EnableUI( bool _bEnable ) if ( _bEnable ) { - for ( auto aLoop = m_aDisabledControls.begin(); - aLoop != m_aDisabledControls.end(); - ++aLoop - ) + for ( auto& rxControl : m_aDisabledControls ) { - (*aLoop)->Enable( false ); + rxControl->Enable( false ); } } } diff --git a/fpicker/source/win32/FilterContainer.cxx b/fpicker/source/win32/FilterContainer.cxx index 8b3ceb4926af..678c8791d5b7 100644 --- a/fpicker/source/win32/FilterContainer.cxx +++ b/fpicker/source/win32/FilterContainer.cxx @@ -19,6 +19,7 @@ #include <sal/config.h> +#include <algorithm> #include <memory> #include <stdexcept> #include <osl/diagnose.h> @@ -150,13 +151,10 @@ sal_Int32 CFilterContainer::getFilterTagPos( const OUString& aName ) const { if ( !m_vFilters.empty() ) { - sal_Int32 i = 0; - FILTER_VECTOR_T::const_iterator iter; - FILTER_VECTOR_T::const_iterator iter_end = m_vFilters.end( ); - - for ( iter = m_vFilters.begin( ); iter != iter_end; ++iter, ++i ) - if ( ( *iter ).first.equalsIgnoreAsciiCase( aName ) ) - return i; + FILTER_VECTOR_T::const_iterator iter = std::find_if(m_vFilters.begin(), m_vFilters.end(), + [&aName](const FILTER_ENTRY_T& rFilter) { return rFilter.first.equalsIgnoreAsciiCase(aName); }); + if (iter != m_vFilters.end()) + return std::distance(m_vFilters.begin(), iter); } return -1; |