Skip to content

Commit

Permalink
tdf#91112 replace o3tl::compose1 with lambdas in connectivity
Browse files Browse the repository at this point in the history
Change-Id: I8f61471e08fe7f620d76bdcd72eb7f5c35931388
Reviewed-on: https://gerrit.libreoffice.org/16940
Tested-by: Jenkins <[email protected]>
Reviewed-by: Michael Stahl <[email protected]>
  • Loading branch information
Jjp137 authored and Michael Stahl committed Jul 13, 2015
1 parent a5db487 commit 6e7c923
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 44 deletions.
14 changes: 4 additions & 10 deletions connectivity/source/drivers/ado/AColumn.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
14 changes: 4 additions & 10 deletions connectivity/source/drivers/ado/AColumns.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
14 changes: 5 additions & 9 deletions connectivity/source/drivers/ado/AConnection.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
16 changes: 10 additions & 6 deletions connectivity/source/drivers/hsqldb/HDriver.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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() )
{
Expand Down
18 changes: 10 additions & 8 deletions connectivity/source/drivers/hsqldb/HStorageMap.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion connectivity/source/drivers/odbc/OResultSet.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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() )
{
Expand Down

0 comments on commit 6e7c923

Please sign in to comment.