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

Jorenz Paragas j.paragas.237 at gmail.com
Tue Jul 28 23:53:06 PDT 2015


 connectivity/source/manager/mdrivermanager.cxx |   25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

New commits:
commit 0e9999b01e8a6932cbd30ca117038c9dd990414f
Author: Jorenz Paragas <j.paragas.237 at gmail.com>
Date:   Mon Jul 20 19:23:16 2015 -0700

    tdf#91112 replace o3tl::unary_compose with lambdas in connectivity
    
    The replaced code used o3tl::unary_compose directly instead of
    the helper function o3tl::compose1.
    
    Change-Id: Idb5cae2e2a2dae5f8bdc572f475ebb76171fd853
    Reviewed-on: https://gerrit.libreoffice.org/17249
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/connectivity/source/manager/mdrivermanager.cxx b/connectivity/source/manager/mdrivermanager.cxx
index 38175e6..8553ba4 100644
--- a/connectivity/source/manager/mdrivermanager.cxx
+++ b/connectivity/source/manager/mdrivermanager.cxx
@@ -147,14 +147,6 @@ Any SAL_CALL ODriverEnumeration::nextElement(  ) throw(NoSuchElementException, W
         }
     };
 
-    typedef ::o3tl::unary_compose< ExtractDriverFromAccess, EnsureDriver > ExtractAfterLoad_BASE;
-    /// an STL functor which loads a driver described by a DriverAccess, and extracts the SdbcDriver
-    struct ExtractAfterLoad : public ExtractAfterLoad_BASE
-    {
-        explicit ExtractAfterLoad( const Reference< XComponentContext > &rxContext )
-            : ExtractAfterLoad_BASE( ExtractDriverFromAccess(), EnsureDriver( rxContext ) ) {}
-    };
-
     struct ExtractDriverFromCollectionElement : public ::std::unary_function< DriverCollection::value_type, Reference<XDriver> >
     {
         Reference<XDriver> operator()( const DriverCollection::value_type& _rElement ) const
@@ -654,9 +646,12 @@ Reference< XDriver > OSDBCDriverManager::implGetDriverForURL(const OUString& _rU
             aFind = ::std::find_if(
                 m_aDriversBS.begin(),       // begin of search range
                 m_aDriversBS.end(),         // end of search range
-                o3tl::unary_compose< AcceptsURL, ExtractAfterLoad >( AcceptsURL( _rURL ), ExtractAfterLoad( m_xContext ) )
-                                            // compose two functors: extract the driver from the access, then ask the resulting driver for acceptance
-            );
+                [&_rURL, this] (DriverAccessArray::value_type driverAccess) {
+                    // extract the driver from the access, then ask the resulting driver for acceptance
+                    const DriverAccess &ensuredAccess = EnsureDriver(m_xContext)(driverAccess);
+                    const Reference<XDriver> driver = ExtractDriverFromAccess()(ensuredAccess);
+                    return AcceptsURL(_rURL)(driver);
+                });
         } // if ( m_aDriversBS.find(sDriverFactoryName ) == m_aDriversBS.end() )
         else
         {
@@ -675,9 +670,11 @@ Reference< XDriver > OSDBCDriverManager::implGetDriverForURL(const OUString& _rU
         DriverCollection::iterator aPos = ::std::find_if(
             m_aDriversRT.begin(),       // begin of search range
             m_aDriversRT.end(),         // end of search range
-            o3tl::unary_compose< AcceptsURL, ExtractDriverFromCollectionElement >( AcceptsURL( _rURL ), ExtractDriverFromCollectionElement() )
-                                        // compose two functors: extract the driver from the access, then ask the resulting driver for acceptance
-        );
+            [&_rURL] (DriverCollection::value_type element) {
+                // extract the driver from the collection element, then ask the resulting driver for acceptance
+                const Reference<XDriver> driver = ExtractDriverFromCollectionElement()(element);
+                return AcceptsURL(_rURL)(driver);
+            });
 
         if ( m_aDriversRT.end() != aPos )
             xReturn = aPos->second;


More information about the Libreoffice-commits mailing list