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

Jochen Nitschke j.nitschke+logerrit at ok.de
Tue Jul 4 18:27:54 UTC 2017


 dbaccess/source/ui/browser/genericcontroller.cxx |   10 +++++-----
 include/dbaccess/genericcontroller.hxx           |   22 +++++++++++++++-------
 2 files changed, 20 insertions(+), 12 deletions(-)

New commits:
commit db714f4d76cb71c1124eb2f4902a816168f6513b
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date:   Tue Jul 4 12:23:19 2017 +0200

    make binary functors unary, related tdf#108782
    
    These functors were always used as unary functors with std::bind2nd.
    
    This patch is a preparation of removal of deprecated
    std::binary_function.
    
    Change-Id: Ifd120227ab0a0db4c93dd56a9d46feb602b1ae4c
    Reviewed-on: https://gerrit.libreoffice.org/39500
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx
index 5e5d83a5e8fd..6c0057e2eea8 100644
--- a/dbaccess/source/ui/browser/genericcontroller.cxx
+++ b/dbaccess/source/ui/browser/genericcontroller.cxx
@@ -506,7 +506,7 @@ bool OGenericUnoController::isFeatureSupported( sal_Int32 _nId )
     SupportedFeatures::const_iterator aFeaturePos = std::find_if(
         m_aSupportedFeatures.begin(),
         m_aSupportedFeatures.end(),
-        std::bind2nd( CompareFeatureById(), _nId )
+        CompareFeatureById(_nId)
     );
 
     return ( m_aSupportedFeatures.end() != aFeaturePos && !aFeaturePos->first.isEmpty());
@@ -539,7 +539,7 @@ void OGenericUnoController::InvalidateFeature_Impl()
             SupportedFeatures::const_iterator aFeaturePos = std::find_if(
                 m_aSupportedFeatures.begin(),
                 m_aSupportedFeatures.end(),
-                std::bind2nd( CompareFeatureById(), aNextFeature.nId )
+                CompareFeatureById( aNextFeature.nId )
             );
 
 #if OSL_DEBUG_LEVEL > 0
@@ -575,7 +575,7 @@ void OGenericUnoController::ImplInvalidateFeature( sal_Int32 _nId, const Referen
         SupportedFeatures::const_iterator aFeaturePos = std::find_if(
             m_aSupportedFeatures.begin(),
             m_aSupportedFeatures.end(),
-            std::bind2nd( CompareFeatureById(), _nId )
+            CompareFeatureById( _nId )
         );
         OSL_ENSURE( aFeaturePos != m_aSupportedFeatures.end(), "OGenericUnoController::ImplInvalidateFeature: invalidating an unsupported feature is suspicious, at least!" );
     }
@@ -760,7 +760,7 @@ void OGenericUnoController::removeStatusListener(const Reference< XStatusListene
     m_aFeaturesToInvalidate.erase(
         std::remove_if(   m_aFeaturesToInvalidate.begin(),
                             m_aFeaturesToInvalidate.end(),
-                            std::bind2nd(FindFeatureListener(),aListener))
+                            FindFeatureListener(aListener))
         ,m_aFeaturesToInvalidate.end());
 }
 
@@ -899,7 +899,7 @@ URL OGenericUnoController::getURLForId(sal_Int32 _nId) const
         SupportedFeatures::const_iterator aIter = std::find_if(
             m_aSupportedFeatures.begin(),
             m_aSupportedFeatures.end(),
-            std::bind2nd( CompareFeatureById(), _nId )
+            CompareFeatureById( _nId )
         );
 
         if ( m_aSupportedFeatures.end() != aIter && !aIter->first.isEmpty() )
diff --git a/include/dbaccess/genericcontroller.hxx b/include/dbaccess/genericcontroller.hxx
index a23dfa8d4f70..20bbc7688210 100644
--- a/include/dbaccess/genericcontroller.hxx
+++ b/include/dbaccess/genericcontroller.hxx
@@ -24,7 +24,6 @@
 
 #include <deque>
 #include <exception>
-#include <functional>
 #include <map>
 #include <memory>
 #include <vector>
@@ -177,12 +176,16 @@ namespace dbaui
                         >   SupportedFeatures;
 
 
-    struct CompareFeatureById : ::std::binary_function< SupportedFeatures::value_type, sal_Int32, bool >
+    class CompareFeatureById
     {
+        const sal_Int32 m_nId;
+    public:
+        CompareFeatureById(sal_Int32 _nId) : m_nId(_nId)
+        {}
 
-        bool operator()( const SupportedFeatures::value_type& _aType, sal_Int32 _nId ) const
+        bool operator()( const SupportedFeatures::value_type& _aType ) const
         {
-            return !!( _nId == _aType.second.nFeatureId );
+            return m_nId == _aType.second.nFeatureId;
         }
     };
 
@@ -199,12 +202,17 @@ namespace dbaui
     typedef ::std::deque< FeatureListener > FeatureListeners;
 
 
-    struct FindFeatureListener : ::std::binary_function< FeatureListener, css::uno::Reference< css::frame::XStatusListener >, bool >
+    class FindFeatureListener
     {
+        const css::uno::Reference< css::frame::XStatusListener >& m_xListener;
+    public:
+        FindFeatureListener(const css::uno::Reference< css::frame::XStatusListener >& _xListener)
+            : m_xListener(_xListener)
+        {}
 
-        bool operator()( const FeatureListener& lhs, const css::uno::Reference< css::frame::XStatusListener >& rhs ) const
+        bool operator()( const FeatureListener& lhs ) const
         {
-            return !!( lhs.xListener == rhs );
+            return lhs.xListener == m_xListener;
         }
     };
 


More information about the Libreoffice-commits mailing list