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

Jorenz Paragas j.paragas.237 at gmail.com
Mon Jul 13 05:23:55 PDT 2015


 connectivity/source/drivers/ado/AColumn.cxx        |   14 ++++----------
 connectivity/source/drivers/ado/AColumns.cxx       |   14 ++++----------
 connectivity/source/drivers/ado/AConnection.cxx    |   14 +++++---------
 connectivity/source/drivers/hsqldb/HDriver.cxx     |   16 ++++++++++------
 connectivity/source/drivers/hsqldb/HStorageMap.cxx |   18 ++++++++++--------
 connectivity/source/drivers/odbc/OResultSet.cxx    |    4 +++-
 6 files changed, 36 insertions(+), 44 deletions(-)

New commits:
commit 6e7c923d632c757c9a38a724cad2d55a84755570
Author: Jorenz Paragas <j.paragas.237 at gmail.com>
Date:   Fri Jul 10 21:07:51 2015 -0700

    tdf#91112 replace o3tl::compose1 with lambdas in connectivity
    
    Change-Id: I8f61471e08fe7f620d76bdcd72eb7f5c35931388
    Reviewed-on: https://gerrit.libreoffice.org/16940
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/connectivity/source/drivers/ado/AColumn.cxx b/connectivity/source/drivers/ado/AColumn.cxx
index 7a9769f..81e18c5 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 936510f1..66af0bc 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 319bc68..463db7f 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 87eb271..373f0e8 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 64566b1..dd84f84 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 a62686b..260f0a6 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() )
     {


More information about the Libreoffice-commits mailing list