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

Jochen Nitschke j.nitschke+logerrit at ok.de
Thu Jul 6 06:30:09 UTC 2017


 dbaccess/source/core/api/SingleSelectQueryComposer.cxx |    8 ++++++--
 dbaccess/source/ui/control/tabletree.cxx               |    8 +++++---
 dbaccess/source/ui/dlg/adtabdlg.cxx                    |    5 ++++-
 dbaccess/source/ui/inc/WCopyTable.hxx                  |    4 ++--
 dbaccess/source/ui/misc/UITools.cxx                    |   14 ++++++++------
 5 files changed, 25 insertions(+), 14 deletions(-)

New commits:
commit ee96ea7236958a89b60c87f688070412835ead3f
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date:   Wed Jul 5 01:32:48 2017 +0200

    tdf#108782 replace std::bind2nd with lambda
    
    in preparation of removal of deprecated std::binary_function
    
    Change-Id: Ibbf9e4689301d1eb525ee965c75d07077291a6ac
    Reviewed-on: https://gerrit.libreoffice.org/39556
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
index 5d3e6e121dac..0558b34dcf13 100644
--- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
+++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
@@ -910,12 +910,16 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns(  )
                 if ( sColumnName.isEmpty() )
                     xProp->getPropertyValue(PROPERTY_NAME) >>= sColumnName;
 
-                aFindName = std::find_if(aNames.begin(),aNames.end(),std::bind2nd(aCaseCompare,sColumnName));
+                aFindName = std::find_if(aNames.begin(),aNames.end(),
+                                    [&aCaseCompare, &sColumnName](const OUString& lhs)
+                                    { return aCaseCompare(lhs, sColumnName); } );
                 sal_Int32 j = 0;
                 while ( aFindName != aNames.end() )
                 {
                     sColumnName += OUString::number(++j);
-                    aFindName = std::find_if(aNames.begin(),aNames.end(),std::bind2nd(aCaseCompare,sColumnName));
+                    aFindName = std::find_if(aNames.begin(),aNames.end(),
+                                        [&aCaseCompare, &sColumnName](const OUString& lhs)
+                                        { return aCaseCompare(lhs, sColumnName); } );
                 }
 
                 pColumn->setName(sColumnName);
diff --git a/dbaccess/source/ui/control/tabletree.cxx b/dbaccess/source/ui/control/tabletree.cxx
index b29cba9d1328..c42ba713a3ea 100644
--- a/dbaccess/source/ui/control/tabletree.cxx
+++ b/dbaccess/source/ui/control/tabletree.cxx
@@ -184,13 +184,15 @@ namespace
         ::comphelper::UStringMixEqual m_aEqualFunctor;
 
         OViewSetter(const Sequence< OUString>& _rViews,bool _bCase) : m_aViews(_rViews),m_aEqualFunctor(_bCase){}
-        OTableTreeListBox::TNames::value_type operator() (const OUString& lhs)
+        OTableTreeListBox::TNames::value_type operator() (const OUString& name)
         {
             OTableTreeListBox::TNames::value_type aRet;
-            aRet.first = lhs;
+            aRet.first = name;
             const OUString* pIter = m_aViews.getConstArray();
             const OUString* pEnd = m_aViews.getConstArray() + m_aViews.getLength();
-            aRet.second = std::any_of(pIter,pEnd,std::bind2nd(m_aEqualFunctor,lhs));
+            aRet.second = std::any_of(pIter, pEnd,
+                                      [this, &name](const OUString& lhs)
+                                      { return m_aEqualFunctor(lhs, name); } );
 
             return aRet;
         }
diff --git a/dbaccess/source/ui/dlg/adtabdlg.cxx b/dbaccess/source/ui/dlg/adtabdlg.cxx
index 8cbd1198bcb3..2a80aefc3efa 100644
--- a/dbaccess/source/ui/dlg/adtabdlg.cxx
+++ b/dbaccess/source/ui/dlg/adtabdlg.cxx
@@ -189,7 +189,10 @@ void TableListFacade::updateTableObjectList( bool _bAllowViews )
             const OUString* pViewEnd   = pViewBegin + sViews.getLength();
             ::comphelper::UStringMixEqual aEqualFunctor;
             for(;pViewBegin != pViewEnd;++pViewBegin)
-                aTables.erase(std::remove_if(aTables.begin(),aTables.end(),std::bind2nd(aEqualFunctor,*pViewBegin)),aTables.end());
+                aTables.erase(std::remove_if(aTables.begin(),aTables.end(),
+                                             [&aEqualFunctor, pViewBegin](const OUString& lhs)
+                                             { return aEqualFunctor(lhs, *pViewBegin); } )
+                              , aTables.end());
             sTables = Sequence< OUString>(aTables.data(), aTables.size());
             sViews = Sequence< OUString>();
         }
diff --git a/dbaccess/source/ui/inc/WCopyTable.hxx b/dbaccess/source/ui/inc/WCopyTable.hxx
index 68981577cc6c..893499d16ed5 100644
--- a/dbaccess/source/ui/inc/WCopyTable.hxx
+++ b/dbaccess/source/ui/inc/WCopyTable.hxx
@@ -38,7 +38,6 @@
 #include <com/sun/star/sdbcx/XKeysSupplier.hpp>
 #include <com/sun/star/task/XInteractionHandler.hpp>
 #include <vcl/lstbox.hxx>
-#include <functional>
 #include <map>
 #include <algorithm>
 
@@ -88,7 +87,8 @@ namespace dbaui
         bool operator()(const OUString& _sColumnName) const override
         {
             return std::any_of(m_pVector->begin(),m_pVector->end(),
-                std::bind2nd(m_aCase, _sColumnName));
+                [this, &_sColumnName](const OUString& lhs)
+                { return m_aCase(lhs, _sColumnName); });
         }
     };
 
diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx
index 23bbdaf58275..d1a1845ddc56 100644
--- a/dbaccess/source/ui/misc/UITools.cxx
+++ b/dbaccess/source/ui/misc/UITools.cxx
@@ -1034,14 +1034,16 @@ void fillAutoIncrementValue(const Reference<XPropertySet>& _xDatasource,
         _xDatasource->getPropertyValue(PROPERTY_INFO) >>= aInfo;
 
         // search the right propertyvalue
-        const PropertyValue* pValue =std::find_if(aInfo.getConstArray(),
-                                                    aInfo.getConstArray() + aInfo.getLength(),
-                                                    std::bind2nd(TPropertyValueEqualFunctor(),PROPERTY_AUTOINCREMENTCREATION));
+        const PropertyValue* pValue =std::find_if(aInfo.getConstArray(), aInfo.getConstArray() + aInfo.getLength(),
+                                            [](const PropertyValue& lhs)
+                                            {return TPropertyValueEqualFunctor()(lhs, PROPERTY_AUTOINCREMENTCREATION);} );
+
         if ( pValue && pValue != (aInfo.getConstArray() + aInfo.getLength()) )
             pValue->Value >>= _rsAutoIncrementValue;
-        pValue =std::find_if(aInfo.getConstArray(),
-                                                    aInfo.getConstArray() + aInfo.getLength(),
-                                                    std::bind2nd(TPropertyValueEqualFunctor(),OUString("IsAutoRetrievingEnabled") ));
+        pValue =std::find_if(aInfo.getConstArray(), aInfo.getConstArray() + aInfo.getLength(),
+                             [](const PropertyValue& lhs)
+                             {return TPropertyValueEqualFunctor()(lhs, "IsAutoRetrievingEnabled");} );
+
         if ( pValue && pValue != (aInfo.getConstArray() + aInfo.getLength()) )
             pValue->Value >>= _rAutoIncrementValueEnabled;
     }


More information about the Libreoffice-commits mailing list