diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2015-05-18 14:27:44 +0900 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-05-21 10:12:42 +0000 |
commit | d75cdda84fb98ec616b57a3dc0606d21c2413e47 (patch) | |
tree | 6aeac3e19883f89bb0dd62d218ad73906d5d3ad1 /fpicker | |
parent | 7fa3d4db1db47a7a62fdd66485a286d331a3587f (diff) |
fpicker: simplify code by std::any_of
Change-Id: I0f5a8b5d7f8f88a821793004c1574fcb6a7a4882
Reviewed-on: https://gerrit.libreoffice.org/15836
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'fpicker')
-rw-r--r-- | fpicker/source/aqua/FilterHelper.mm | 23 | ||||
-rw-r--r-- | fpicker/source/office/OfficeFilePicker.cxx | 6 |
2 files changed, 12 insertions, 17 deletions
diff --git a/fpicker/source/aqua/FilterHelper.mm b/fpicker/source/aqua/FilterHelper.mm index e37378d074dd..fecea53fee5b 100644 --- a/fpicker/source/aqua/FilterHelper.mm +++ b/fpicker/source/aqua/FilterHelper.mm @@ -162,11 +162,9 @@ public: else // a filter group -> search the sub filters bMatch = - _rEntry.endSubFilters() != ::std::find_if( - _rEntry.beginSubFilters(), - _rEntry.endSubFilters(), - *this - ); + ::std::any_of(_rEntry.beginSubFilters(), + _rEntry.endSubFilters(), + *this); return bMatch; } @@ -221,11 +219,9 @@ bool FilterHelper::FilterNameExists( const rtl::OUString& rTitle ) if( m_pFilterList ) bRet = - m_pFilterList->end() != ::std::find_if( - m_pFilterList->begin(), - m_pFilterList->end(), - FilterTitleMatch( rTitle ) - ); + ::std::any_of(m_pFilterList->begin(), + m_pFilterList->end(), + FilterTitleMatch( rTitle )); return bRet; } @@ -240,10 +236,9 @@ bool FilterHelper::FilterNameExists( const UnoFilterList& _rGroupedFilters ) const UnoFilterEntry* pStart = _rGroupedFilters.getConstArray(); const UnoFilterEntry* pEnd = pStart + _rGroupedFilters.getLength(); for( ; pStart != pEnd; ++pStart ) - if( m_pFilterList->end() != ::std::find_if( - m_pFilterList->begin(), - m_pFilterList->end(), - FilterTitleMatch( pStart->First ) ) ) + if( ::std::any_of(m_pFilterList->begin(), + m_pFilterList->end(), + FilterTitleMatch( pStart->First ) ) ) break; bRet = (pStart != pEnd); diff --git a/fpicker/source/office/OfficeFilePicker.cxx b/fpicker/source/office/OfficeFilePicker.cxx index 6fd28edfd242..20d6e1d448c9 100644 --- a/fpicker/source/office/OfficeFilePicker.cxx +++ b/fpicker/source/office/OfficeFilePicker.cxx @@ -358,7 +358,7 @@ namespace { else // a filter group -> search the sub filters bMatch = - _rEntry.endSubFilters() != ::std::find_if( + ::std::any_of( _rEntry.beginSubFilters(), _rEntry.endSubFilters(), *this @@ -380,7 +380,7 @@ bool SvtFilePicker::FilterNameExists( const OUString& rTitle ) if ( m_pFilterList ) bRet = - m_pFilterList->end() != ::std::find_if( + ::std::any_of( m_pFilterList->begin(), m_pFilterList->end(), FilterTitleMatch( rTitle ) @@ -399,7 +399,7 @@ bool SvtFilePicker::FilterNameExists( const UnoFilterList& _rGroupedFilters ) const UnoFilterEntry* pStart = _rGroupedFilters.getConstArray(); const UnoFilterEntry* pEnd = pStart + _rGroupedFilters.getLength(); for ( ; pStart != pEnd; ++pStart ) - if ( m_pFilterList->end() != ::std::find_if( m_pFilterList->begin(), m_pFilterList->end(), FilterTitleMatch( pStart->First ) ) ) + if ( ::std::any_of( m_pFilterList->begin(), m_pFilterList->end(), FilterTitleMatch( pStart->First ) ) ) break; bRet = pStart != pEnd; |