diff options
author | Jorenz Paragas <j.paragas.237@gmail.com> | 2015-07-10 21:07:51 -0700 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-07-13 12:23:30 +0000 |
commit | 6e7c923d632c757c9a38a724cad2d55a84755570 (patch) | |
tree | ace0b3e4a9239b57292eb0de90e600ab25a38ab5 /connectivity | |
parent | a5db487caaf026e648b34d0fab58376230c1cc47 (diff) |
tdf#91112 replace o3tl::compose1 with lambdas in connectivity
Change-Id: I8f61471e08fe7f620d76bdcd72eb7f5c35931388
Reviewed-on: https://gerrit.libreoffice.org/16940
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/source/drivers/ado/AColumn.cxx | 14 | ||||
-rw-r--r-- | connectivity/source/drivers/ado/AColumns.cxx | 14 | ||||
-rw-r--r-- | connectivity/source/drivers/ado/AConnection.cxx | 14 | ||||
-rw-r--r-- | connectivity/source/drivers/hsqldb/HDriver.cxx | 16 | ||||
-rw-r--r-- | connectivity/source/drivers/hsqldb/HStorageMap.cxx | 18 | ||||
-rw-r--r-- | connectivity/source/drivers/odbc/OResultSet.cxx | 4 |
6 files changed, 36 insertions, 44 deletions
diff --git a/connectivity/source/drivers/ado/AColumn.cxx b/connectivity/source/drivers/ado/AColumn.cxx index 7a9769f0a6ae..81e18c5b1193 100644 --- a/connectivity/source/drivers/ado/AColumn.cxx +++ b/connectivity/source/drivers/ado/AColumn.cxx @@ -215,16 +215,10 @@ void OAdoColumn::fillPropertyValues() else if ( eType == adVarBinary && ADOS::isJetEngine(m_pConnection->getEngineType()) ) { ::comphelper::UStringMixEqual aCase(sal_False); - OTypeInfoMap::const_iterator aFind = ::std::find_if(pTypeInfoMap->begin(), - pTypeInfoMap->end(), - ::o3tl::compose1( - ::std::bind2nd(aCase, OUString("VarBinary")), - ::o3tl::compose1( - ::std::mem_fun(&OExtendedTypeInfo::getDBName), - ::o3tl::select2nd<OTypeInfoMap::value_type>()) - ) - - ); + OTypeInfoMap::const_iterator aFind = ::std::find_if(pTypeInfoMap->begin(), pTypeInfoMap->end(), + [&aCase] (OTypeInfoMap::value_type typeInfo) { + return aCase(typeInfo.second->getDBName(), OUString("VarBinary")); + }); if ( aFind != pTypeInfoMap->end() ) // change column type if necessary { diff --git a/connectivity/source/drivers/ado/AColumns.cxx b/connectivity/source/drivers/ado/AColumns.cxx index 936510f155e3..66af0bc58aeb 100644 --- a/connectivity/source/drivers/ado/AColumns.cxx +++ b/connectivity/source/drivers/ado/AColumns.cxx @@ -88,16 +88,10 @@ sdbcx::ObjectType OColumns::appendObject( const OUString&, const Reference< XPro const OTypeInfoMap* pTypeInfoMap = m_pConnection->getTypeInfo(); ::comphelper::UStringMixEqual aCase(sal_False); // search for typeinfo where the typename is equal sTypeName - OTypeInfoMap::const_iterator aFind = ::std::find_if(pTypeInfoMap->begin(), - pTypeInfoMap->end(), - ::o3tl::compose1( - ::std::bind2nd(aCase, sTypeName), - ::o3tl::compose1( - ::std::mem_fun(&OExtendedTypeInfo::getDBName), - ::o3tl::select2nd<OTypeInfoMap::value_type>()) - ) - - ); + OTypeInfoMap::const_iterator aFind = ::std::find_if(pTypeInfoMap->begin(), pTypeInfoMap->end(), + [&aCase, &sTypeName] (OTypeInfoMap::value_type typeInfo) { + return aCase(typeInfo.second->getDBName(), sTypeName); + }); if ( aFind != pTypeInfoMap->end() ) // change column type if necessary aColumn.put_Type(aFind->first); diff --git a/connectivity/source/drivers/ado/AConnection.cxx b/connectivity/source/drivers/ado/AConnection.cxx index 319bc688769e..463db7f4f833 100644 --- a/connectivity/source/drivers/ado/AConnection.cxx +++ b/connectivity/source/drivers/ado/AConnection.cxx @@ -598,15 +598,11 @@ const OExtendedTypeInfo* OConnection::getTypeInfoFromType(const OTypeInfoMap& _r { ::comphelper::UStringMixEqual aCase(sal_False); // search for typeinfo where the typename is equal _sTypeName - OTypeInfoMap::const_iterator aFind = ::std::find_if(_rTypeInfo.begin(), - _rTypeInfo.end(), - ::o3tl::compose1( - ::std::bind2nd(aCase, _sTypeName), - ::o3tl::compose1( - ::std::mem_fun(&OExtendedTypeInfo::getDBName), - ::o3tl::select2nd<OTypeInfoMap::value_type>()) - ) - ); + OTypeInfoMap::const_iterator aFind = ::std::find_if(_rTypeInfo.begin(), _rTypeInfo.end(), + [&aCase, &_sTypeName] (OTypeInfoMap::value_type typeInfo) { + return aCase(typeInfo.second->getDBName(), _sTypeName); + }); + if(aFind != _rTypeInfo.end()) pTypeInfo = aFind->second; } diff --git a/connectivity/source/drivers/hsqldb/HDriver.cxx b/connectivity/source/drivers/hsqldb/HDriver.cxx index 87eb271ecd1c..373f0e81e593 100644 --- a/connectivity/source/drivers/hsqldb/HDriver.cxx +++ b/connectivity/source/drivers/hsqldb/HDriver.cxx @@ -583,9 +583,11 @@ namespace connectivity if ( xStorage.is() ) { OUString sKey = StorageContainer::getRegisteredKey(xStorage); - TWeakPairVector::iterator i = ::std::find_if(m_aConnections.begin(),m_aConnections.end(),::o3tl::compose1( - ::std::bind2nd(::std::equal_to< OUString >(),sKey) - ,::o3tl::compose1(::o3tl::select1st<TWeakConnectionPair>(),::o3tl::select2nd< TWeakPair >()))); + TWeakPairVector::iterator i = ::std::find_if(m_aConnections.begin(),m_aConnections.end(), + [&sKey] (TWeakPairVector::value_type conn) { + return conn.second.first == sKey; + }); + if ( i != m_aConnections.end() ) shutdownConnection(i); } @@ -637,9 +639,11 @@ namespace connectivity OUString sKey = StorageContainer::getRegisteredKey(xStorage); if ( !sKey.isEmpty() ) { - TWeakPairVector::iterator i = ::std::find_if(m_aConnections.begin(),m_aConnections.end(),::o3tl::compose1( - ::std::bind2nd(::std::equal_to< OUString >(),sKey) - ,::o3tl::compose1(::o3tl::select1st<TWeakConnectionPair>(),::o3tl::select2nd< TWeakPair >()))); + TWeakPairVector::iterator i = ::std::find_if(m_aConnections.begin(), m_aConnections.end(), + [&sKey] (TWeakPairVector::value_type conn) { + return conn.second.first == sKey; + }); + OSL_ENSURE( i != m_aConnections.end(), "ODriverDelegator::preCommit: they're committing a storage which I do not know!" ); if ( i != m_aConnections.end() ) { diff --git a/connectivity/source/drivers/hsqldb/HStorageMap.cxx b/connectivity/source/drivers/hsqldb/HStorageMap.cxx index 64566b136e0e..dd84f849ec72 100644 --- a/connectivity/source/drivers/hsqldb/HStorageMap.cxx +++ b/connectivity/source/drivers/hsqldb/HStorageMap.cxx @@ -171,10 +171,11 @@ namespace connectivity TStorages& rMap = lcl_getStorageMap(); // check if the storage is already in our map TStorages::iterator aFind = ::std::find_if(rMap.begin(),rMap.end(), - ::o3tl::compose1( - ::std::bind2nd(::std::equal_to<Reference<XStorage> >(),_xStorage) - ,::o3tl::compose1(::o3tl::select1st<TStorageURLPair>(),::o3tl::compose1(::o3tl::select1st<TStorages::mapped_type>(),::o3tl::select2nd<TStorages::value_type>()))) - ); + [&_xStorage] (TStorages::value_type storage) { + // TStoragePair (second) -> TStorageURLPair (first) -> uno::Reference<XStorage> (first) + return storage.second.first.first == _xStorage; + }); + if ( aFind == rMap.end() ) { aFind = rMap.insert(TStorages::value_type(lcl_getNextCount(),TStorages::mapped_type(TStorageURLPair(_xStorage,_sURL),TStreamMap()))).first; @@ -202,10 +203,11 @@ namespace connectivity TStorages& rMap = lcl_getStorageMap(); // check if the storage is already in our map TStorages::iterator aFind = ::std::find_if(rMap.begin(),rMap.end(), - ::o3tl::compose1( - ::std::bind2nd(::std::equal_to<Reference<XStorage> >(),_xStorage) - ,::o3tl::compose1(::o3tl::select1st<TStorageURLPair>(),::o3tl::compose1(::o3tl::select1st<TStorages::mapped_type>(),::o3tl::select2nd<TStorages::value_type>()))) - ); + [&_xStorage] (TStorages::value_type storage) { + // TStoragePair (second) -> TStorageURLPair (first) -> uno::Reference<XStorage> (first) + return storage.second.first.first == _xStorage; + }); + if ( aFind != rMap.end() ) sKey = aFind->first; return sKey; diff --git a/connectivity/source/drivers/odbc/OResultSet.cxx b/connectivity/source/drivers/odbc/OResultSet.cxx index a62686b99272..260f0a6f02c2 100644 --- a/connectivity/source/drivers/odbc/OResultSet.cxx +++ b/connectivity/source/drivers/odbc/OResultSet.cxx @@ -1167,7 +1167,9 @@ Sequence<sal_Int8> OResultSet::impl_getBookmark( ) throw( SQLException, Runtim checkDisposed(OResultSet_BASE::rBHelper.bDisposed); TBookmarkPosMap::iterator aFind = ::std::find_if(m_aPosToBookmarks.begin(),m_aPosToBookmarks.end(), - ::o3tl::compose1(::std::bind2nd(::std::equal_to<sal_Int32>(),m_nRowPos),::o3tl::select2nd<TBookmarkPosMap::value_type>())); + [this] (TBookmarkPosMap::value_type bookmarkPos) { + return bookmarkPos.second == m_nRowPos; + }); if ( aFind == m_aPosToBookmarks.end() ) { |