diff options
author | Jorenz Paragas <j.paragas.237@gmail.com> | 2015-07-20 19:23:16 -0700 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2015-07-29 06:52:35 +0000 |
commit | 0e9999b01e8a6932cbd30ca117038c9dd990414f (patch) | |
tree | d83ae4acb4edff54882745776df22a33c9c5f612 /connectivity/source/manager/mdrivermanager.cxx | |
parent | b97aa3faa03e5944aac8f3c35a8c198fba295e83 (diff) |
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@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'connectivity/source/manager/mdrivermanager.cxx')
-rw-r--r-- | connectivity/source/manager/mdrivermanager.cxx | 25 |
1 files changed, 11 insertions, 14 deletions
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<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; |