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@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Jochen Nitschke 2017-07-04 12:23:19 +02:00 committed by Noel Grandin
parent 27f61c4cfb
commit db714f4d76
2 changed files with 20 additions and 12 deletions

View file

@ -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() )

View file

@ -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;
}
};