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

Jorenz Paragas j.paragas.237 at gmail.com
Thu Jun 25 03:17:37 PDT 2015


 dbaccess/source/core/dataaccess/definitioncontainer.cxx |   16 ++++++----------
 dbaccess/source/ui/control/tabletree.cxx                |    4 ++--
 dbaccess/source/ui/misc/DExport.cxx                     |    2 +-
 dbaccess/source/ui/misc/WColumnSelect.cxx               |   14 ++++++--------
 dbaccess/source/ui/misc/WCopyTable.cxx                  |   10 +++++-----
 5 files changed, 20 insertions(+), 26 deletions(-)

New commits:
commit f571a17484032bc2a09144ea8b97e91e1f8cc5a5
Author: Jorenz Paragas <j.paragas.237 at gmail.com>
Date:   Mon Jun 22 19:39:02 2015 -0700

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

diff --git a/dbaccess/source/core/dataaccess/definitioncontainer.cxx b/dbaccess/source/core/dataaccess/definitioncontainer.cxx
index 64c798c..22c7401 100644
--- a/dbaccess/source/core/dataaccess/definitioncontainer.cxx
+++ b/dbaccess/source/core/dataaccess/definitioncontainer.cxx
@@ -66,11 +66,9 @@ ODefinitionContainer_Impl::const_iterator ODefinitionContainer_Impl::find( TCont
     return ::std::find_if(
         m_aDefinitions.begin(),
         m_aDefinitions.end(),
-        ::o3tl::compose1(
-            ::std::bind2nd( ::std::equal_to< TContentPtr >(), _pDefinition ),
-            ::o3tl::select2nd< NamedDefinitions::value_type >()
-        )
-    );
+        [&_pDefinition] (NamedDefinitions::value_type namedDef) {
+            return namedDef.second == _pDefinition;
+        });
 }
 
 ODefinitionContainer_Impl::iterator ODefinitionContainer_Impl::find( TContentPtr _pDefinition )
@@ -78,11 +76,9 @@ ODefinitionContainer_Impl::iterator ODefinitionContainer_Impl::find( TContentPtr
     return ::std::find_if(
         m_aDefinitions.begin(),
         m_aDefinitions.end(),
-        ::o3tl::compose1(
-            ::std::bind2nd( ::std::equal_to< TContentPtr >(), _pDefinition ),
-            ::o3tl::select2nd< NamedDefinitions::value_type >()
-        )
-    );
+        [&_pDefinition] (NamedDefinitions::value_type namedDef) {
+            return namedDef.second == _pDefinition;
+        });
 }
 
 // ODefinitionContainer
diff --git a/dbaccess/source/ui/control/tabletree.cxx b/dbaccess/source/ui/control/tabletree.cxx
index 0bce936..789f774 100644
--- a/dbaccess/source/ui/control/tabletree.cxx
+++ b/dbaccess/source/ui/control/tabletree.cxx
@@ -262,10 +262,10 @@ void OTableTreeListBox::UpdateTableList( const Reference< XConnection >& _rxConn
         {
             OUString sRootEntryText;
             if ( ::std::none_of(_rTables.begin(),_rTables.end(),
-                                ::o3tl::compose1(::std::bind2nd(::std::equal_to<sal_Bool>(),sal_False),::o3tl::select2nd<TNames::value_type>())) )
+                                [&_rTables] (TNames::value_type name) { return name.second == sal_False; }) )
                 sRootEntryText  = ModuleRes(STR_ALL_TABLES);
             else if ( ::std::none_of(_rTables.begin(),_rTables.end(),
-                                     ::o3tl::compose1(::std::bind2nd(::std::equal_to<sal_Bool>(),sal_True),::o3tl::select2nd<TNames::value_type>())) )
+                                     [&_rTables] (TNames::value_type name) { return name.second == sal_True; }) )
                 sRootEntryText  = ModuleRes(STR_ALL_VIEWS);
             else
                 sRootEntryText  = ModuleRes(STR_ALL_TABLES_AND_VIEWS);
diff --git a/dbaccess/source/ui/misc/DExport.cxx b/dbaccess/source/ui/misc/DExport.cxx
index 409469f..bc949e7 100644
--- a/dbaccess/source/ui/misc/DExport.cxx
+++ b/dbaccess/source/ui/misc/DExport.cxx
@@ -835,7 +835,7 @@ Reference< XPreparedStatement > ODatabaseExport::createPreparedStatment( const R
     for(size_t j=0; j < aInsertList.size() ;++i,++j)
     {
         ODatabaseExport::TPositions::const_iterator aFind = ::std::find_if(_rvColumns.begin(),_rvColumns.end(),
-            ::o3tl::compose1(::std::bind2nd(::std::equal_to<sal_Int32>(),i+1),::o3tl::select2nd<ODatabaseExport::TPositions::value_type>()));
+            [i] (ODatabaseExport::TPositions::value_type tPos) { return tPos.second == i+1; });
         if ( _rvColumns.end() != aFind && aFind->second != sal::static_int_cast< long >(CONTAINER_ENTRY_NOTFOUND) && aFind->first != sal::static_int_cast< long >(CONTAINER_ENTRY_NOTFOUND) )
         {
             OSL_ENSURE((aFind->first) < static_cast<sal_Int32>(aInsertList.size()),"aInsertList: Illegal index for vector");
diff --git a/dbaccess/source/ui/misc/WColumnSelect.cxx b/dbaccess/source/ui/misc/WColumnSelect.cxx
index aa4f7bc..ff363f9 100644
--- a/dbaccess/source/ui/misc/WColumnSelect.cxx
+++ b/dbaccess/source/ui/misc/WColumnSelect.cxx
@@ -340,10 +340,9 @@ void OWizColumnSelect::moveColumn(  ListBox* _pRight,
     {
         // find the new column in the dest name mapping to obtain the old column
         OCopyTableWizard::TNameMapping::iterator aIter = ::std::find_if(m_pParent->m_mNameMapping.begin(),m_pParent->m_mNameMapping.end(),
-                                                                ::o3tl::compose1(
-                                                                    ::std::bind2nd(_aCase, _sColumnName),
-                                                                    ::o3tl::select2nd<OCopyTableWizard::TNameMapping::value_type>())
-                                                                    );
+            [&_aCase, &_sColumnName] (OCopyTableWizard::TNameMapping::value_type nameMap) {
+                return _aCase(nameMap.second, _sColumnName);
+            });
 
         OSL_ENSURE(aIter != m_pParent->m_mNameMapping.end(),"Column must be defined");
         if ( aIter == m_pParent->m_mNameMapping.end() )
@@ -390,10 +389,9 @@ sal_uInt16 OWizColumnSelect::adjustColumnPosition( ListBox* _pLeft,
         {
             // find the new column in the dest name mapping to obtain the old column
             OCopyTableWizard::TNameMapping::iterator aIter = ::std::find_if(m_pParent->m_mNameMapping.begin(),m_pParent->m_mNameMapping.end(),
-                                                                    ::o3tl::compose1(
-                                                                    ::std::bind2nd(_aCase, sColumnString),
-                                                                    ::o3tl::select2nd<OCopyTableWizard::TNameMapping::value_type>())
-                                                                    );
+                [&_aCase, &sColumnString] (OCopyTableWizard::TNameMapping::value_type nameMap) {
+                    return _aCase(nameMap.second, sColumnString);
+                });
 
             OSL_ENSURE(aIter != m_pParent->m_mNameMapping.end(),"Column must be defined");
             const ODatabaseExport::TColumns& rSrcColumns = m_pParent->getSourceColumns();
diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx
index 844fa7f..a629a8d 100644
--- a/dbaccess/source/ui/misc/WCopyTable.cxx
+++ b/dbaccess/source/ui/misc/WCopyTable.cxx
@@ -876,8 +876,8 @@ IMPL_LINK_NOARG(OCopyTableWizard, ImplOKHdl)
                 {
                     if ( supportsPrimaryKey() )
                     {
-                        ODatabaseExport::TColumns::iterator aFind = ::std::find_if(m_vDestColumns.begin(),m_vDestColumns.end()
-                            ,::o3tl::compose1(::std::mem_fun(&OFieldDescription::IsPrimaryKey),::o3tl::select2nd<ODatabaseExport::TColumns::value_type>()));
+                        ODatabaseExport::TColumns::iterator aFind = ::std::find_if(m_vDestColumns.begin(),m_vDestColumns.end(),
+                            [] (ODatabaseExport::TColumns::value_type tCol) { return tCol.second->IsPrimaryKey(); });
                         if ( aFind == m_vDestColumns.end() && m_xInteractionHandler.is() )
                         {
 
@@ -1294,9 +1294,9 @@ Reference< XPropertySet > OCopyTableWizard::createTable()
                     ODatabaseExport::TPositions::iterator aPosFind = ::std::find_if(
                         m_vColumnPos.begin(),
                         m_vColumnPos.end(),
-                        ::o3tl::compose1(    ::std::bind2nd( ::std::equal_to< sal_Int32 >(), nPos ),
-                                            ::o3tl::select1st< ODatabaseExport::TPositions::value_type >()
-                        )
+                        [nPos] (ODatabaseExport::TPositions::value_type tPos) {
+                            return tPos.first == nPos;
+                        }
                     );
 
                     if ( m_vColumnPos.end() != aPosFind )


More information about the Libreoffice-commits mailing list