From 0e9999b01e8a6932cbd30ca117038c9dd990414f Mon Sep 17 00:00:00 2001 From: Jorenz Paragas Date: Mon, 20 Jul 2015 19:23:16 -0700 Subject: 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 Reviewed-by: Noel Grandin --- connectivity/source/manager/mdrivermanager.cxx | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'connectivity') diff --git a/connectivity/source/manager/mdrivermanager.cxx b/connectivity/source/manager/mdrivermanager.cxx index 38175e6c2f16..8553ba4e028e 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 > { Reference 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 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 driver = ExtractDriverFromCollectionElement()(element); + return AcceptsURL(_rURL)(driver); + }); if ( m_aDriversRT.end() != aPos ) xReturn = aPos->second; -- cgit