[Libreoffice-commits] core.git: svtools/source

Takeshi Abe tabe at fixedpoint.jp
Thu May 21 03:08:00 PDT 2015


 svtools/source/contnr/fileview.cxx |   11 ++---------
 svtools/source/control/inettbc.cxx |   20 ++++++--------------
 2 files changed, 8 insertions(+), 23 deletions(-)

New commits:
commit 6e01306e2094e0e0ae731aed7162bb3371f274bc
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Mon May 18 16:15:12 2015 +0900

    svtools: simplify code by replacing std::find_if with std::any_of
    
    ... or std::none_of.
    
    Change-Id: Ib6af7f32d9495eca03e29dcea06ff3925b1cc7b7
    Reviewed-on: https://gerrit.libreoffice.org/15839
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx
index ada14a3..66aeece 100644
--- a/svtools/source/contnr/fileview.cxx
+++ b/svtools/source/contnr/fileview.cxx
@@ -1795,15 +1795,8 @@ void SvtFileView_Impl::FilterFolderContent_Impl( const OUString &rFilter )
                 bDelete = true;
             else
             {
-                // search for the first filter which matches
-                ::std::vector< WildCard >::const_iterator pMatchingFilter =
-                    ::std::find_if(
-                        aFilters.begin(),
-                        aFilters.end(),
-                        FilterMatch( sCompareString )
-                    );
-
-                bDelete = aFilters.end() == pMatchingFilter;
+                bDelete = ::std::none_of( aFilters.begin(), aFilters.end(),
+                                          FilterMatch( sCompareString ) );
             }
 
             if( bDelete )
diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx
index 6f669b0..997ce064e 100644
--- a/svtools/source/control/inettbc.cxx
+++ b/svtools/source/control/inettbc.cxx
@@ -241,14 +241,9 @@ IMPL_LINK_NOARG( SvtMatchContext_Impl, Select_Impl )
         {
             OUString sUpperURL( sURL.toAsciiUpperCase() );
 
-            ::std::vector< WildCard >::const_iterator aMatchingFilter =
-                ::std::find_if(
-                    pBox->pImp->m_aFilters.begin(),
-                    pBox->pImp->m_aFilters.end(),
-                    FilterMatch( sUpperURL )
-                );
-            if ( aMatchingFilter == pBox->pImp->m_aFilters.end() )
-
+            if ( ::std::none_of( pBox->pImp->m_aFilters.begin(),
+                                 pBox->pImp->m_aFilters.end(),
+                                 FilterMatch( sUpperURL ) ) )
             {   // this URL is not allowed
                 bValidCompletionsFiltered = true;
                 continue;
@@ -988,12 +983,9 @@ void SvtURLBox::UpdatePicklistForSmartProtocol_Impl()
                             OUString aUpperURL( aURL );
                             aUpperURL = aUpperURL.toAsciiUpperCase();
 
-                            bFound
-                                = (::std::find_if(
-                                    pImp->m_aFilters.begin(),
-                                    pImp->m_aFilters.end(),
-                                    FilterMatch( aUpperURL ) )
-                                        != pImp->m_aFilters.end());
+                            bFound = ::std::any_of(pImp->m_aFilters.begin(),
+                                                   pImp->m_aFilters.end(),
+                                                   FilterMatch( aUpperURL ) );
                         }
                         if ( bFound )
                         {


More information about the Libreoffice-commits mailing list