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>
This commit is contained in:
Takeshi Abe
2015-05-18 14:27:44 +09:00
committed by Michael Stahl
parent 7fa3d4db1d
commit d75cdda84f
2 changed files with 12 additions and 17 deletions

View File

@@ -162,11 +162,9 @@ public:
else else
// a filter group -> search the sub filters // a filter group -> search the sub filters
bMatch = bMatch =
_rEntry.endSubFilters() != ::std::find_if( ::std::any_of(_rEntry.beginSubFilters(),
_rEntry.beginSubFilters(), _rEntry.endSubFilters(),
_rEntry.endSubFilters(), *this);
*this
);
return bMatch; return bMatch;
} }
@@ -221,11 +219,9 @@ bool FilterHelper::FilterNameExists( const rtl::OUString& rTitle )
if( m_pFilterList ) if( m_pFilterList )
bRet = bRet =
m_pFilterList->end() != ::std::find_if( ::std::any_of(m_pFilterList->begin(),
m_pFilterList->begin(), m_pFilterList->end(),
m_pFilterList->end(), FilterTitleMatch( rTitle ));
FilterTitleMatch( rTitle )
);
return bRet; return bRet;
} }
@@ -240,10 +236,9 @@ bool FilterHelper::FilterNameExists( const UnoFilterList& _rGroupedFilters )
const UnoFilterEntry* pStart = _rGroupedFilters.getConstArray(); const UnoFilterEntry* pStart = _rGroupedFilters.getConstArray();
const UnoFilterEntry* pEnd = pStart + _rGroupedFilters.getLength(); const UnoFilterEntry* pEnd = pStart + _rGroupedFilters.getLength();
for( ; pStart != pEnd; ++pStart ) for( ; pStart != pEnd; ++pStart )
if( m_pFilterList->end() != ::std::find_if( if( ::std::any_of(m_pFilterList->begin(),
m_pFilterList->begin(), m_pFilterList->end(),
m_pFilterList->end(), FilterTitleMatch( pStart->First ) ) )
FilterTitleMatch( pStart->First ) ) )
break; break;
bRet = (pStart != pEnd); bRet = (pStart != pEnd);

View File

@@ -358,7 +358,7 @@ namespace {
else else
// a filter group -> search the sub filters // a filter group -> search the sub filters
bMatch = bMatch =
_rEntry.endSubFilters() != ::std::find_if( ::std::any_of(
_rEntry.beginSubFilters(), _rEntry.beginSubFilters(),
_rEntry.endSubFilters(), _rEntry.endSubFilters(),
*this *this
@@ -380,7 +380,7 @@ bool SvtFilePicker::FilterNameExists( const OUString& rTitle )
if ( m_pFilterList ) if ( m_pFilterList )
bRet = bRet =
m_pFilterList->end() != ::std::find_if( ::std::any_of(
m_pFilterList->begin(), m_pFilterList->begin(),
m_pFilterList->end(), m_pFilterList->end(),
FilterTitleMatch( rTitle ) FilterTitleMatch( rTitle )
@@ -399,7 +399,7 @@ bool SvtFilePicker::FilterNameExists( const UnoFilterList& _rGroupedFilters )
const UnoFilterEntry* pStart = _rGroupedFilters.getConstArray(); const UnoFilterEntry* pStart = _rGroupedFilters.getConstArray();
const UnoFilterEntry* pEnd = pStart + _rGroupedFilters.getLength(); const UnoFilterEntry* pEnd = pStart + _rGroupedFilters.getLength();
for ( ; pStart != pEnd; ++pStart ) 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; break;
bRet = pStart != pEnd; bRet = pStart != pEnd;