tdf#92459 Cleanup unclear lambdas

Replace lambdas used to select the first/second member of a pair with
the new simplified select1st/2nd from o3tl/compat_functional. There
should be no side effects due to this change.

Change-Id: I17f37796e0c4defe96a10aa491d192adb9eebb89
Reviewed-on: https://gerrit.libreoffice.org/17656
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
This commit is contained in:
Daniel Robertson
2015-08-11 14:51:35 -04:00
committed by Thorsten Behrens
parent ae6afadbc0
commit 87130a4e18
15 changed files with 38 additions and 37 deletions

View File

@@ -38,7 +38,7 @@
#include <cppuhelper/supportsservice.hxx> #include <cppuhelper/supportsservice.hxx>
#include <osl/mutex.hxx> #include <osl/mutex.hxx>
#include <osl/process.h> #include <osl/process.h>
#include <o3tl/compat_functional.hxx>
using namespace ::com::sun::star; using namespace ::com::sun::star;
using namespace ::com::sun::star::uno; using namespace ::com::sun::star::uno;
@@ -52,8 +52,10 @@ class CanvasFactory
lang::XMultiComponentFactory, lang::XMultiComponentFactory,
lang::XMultiServiceFactory > lang::XMultiServiceFactory >
{ {
typedef std::vector<std::pair<OUString, Sequence<OUString> > > AvailVector; typedef std::pair< OUString, Sequence< OUString > > AvailPair;
typedef std::vector<std::pair<OUString, OUString> > CacheVector; typedef std::pair< OUString, OUString > CachePair;
typedef std::vector< AvailPair > AvailVector;
typedef std::vector< CachePair > CacheVector;
mutable ::osl::Mutex m_mutex; mutable ::osl::Mutex m_mutex;
@@ -238,9 +240,7 @@ Sequence<OUString> CanvasFactory::getAvailableServiceNames()
std::transform(m_aAvailableImplementations.begin(), std::transform(m_aAvailableImplementations.begin(),
m_aAvailableImplementations.end(), m_aAvailableImplementations.end(),
aServiceNames.getArray(), aServiceNames.getArray(),
[](std::pair<OUString, Sequence<OUString> > const& ap) o3tl::select1st< AvailPair >());
{ return ap.first; }
);
return aServiceNames; return aServiceNames;
} }
@@ -326,7 +326,7 @@ Reference<XInterface> CanvasFactory::lookupAndUse(
if( (aMatch=std::find_if( if( (aMatch=std::find_if(
m_aCachedImplementations.begin(), m_aCachedImplementations.begin(),
aEnd, aEnd,
[&serviceName](std::pair<OUString, OUString> const& cp) [&serviceName](CachePair const& cp)
{ return serviceName.equals(cp.first); } { return serviceName.equals(cp.first); }
)) != aEnd) { )) != aEnd) {
Reference<XInterface> xCanvas( use( aMatch->second, args, xContext ) ); Reference<XInterface> xCanvas( use( aMatch->second, args, xContext ) );
@@ -340,7 +340,7 @@ Reference<XInterface> CanvasFactory::lookupAndUse(
if( (aAvailImplsMatch=std::find_if( if( (aAvailImplsMatch=std::find_if(
m_aAvailableImplementations.begin(), m_aAvailableImplementations.begin(),
aAvailEnd, aAvailEnd,
[&serviceName](std::pair<OUString, Sequence<OUString> > const& ap) [&serviceName](AvailPair const& ap)
{ return serviceName.equals(ap.first); } { return serviceName.equals(ap.first); }
)) == aAvailEnd ) { )) == aAvailEnd ) {
return Reference<XInterface>(); return Reference<XInterface>();
@@ -351,7 +351,7 @@ Reference<XInterface> CanvasFactory::lookupAndUse(
if( (aAAImplsMatch=std::find_if( if( (aAAImplsMatch=std::find_if(
m_aAAImplementations.begin(), m_aAAImplementations.begin(),
aAAEnd, aAAEnd,
[&serviceName](std::pair<OUString, Sequence<OUString> > const& ap) [&serviceName](AvailPair const& ap)
{ return serviceName.equals(ap.first); } { return serviceName.equals(ap.first); }
)) == aAAEnd) { )) == aAAEnd) {
return Reference<XInterface>(); return Reference<XInterface>();
@@ -362,7 +362,7 @@ Reference<XInterface> CanvasFactory::lookupAndUse(
if( (aAccelImplsMatch=std::find_if( if( (aAccelImplsMatch=std::find_if(
m_aAcceleratedImplementations.begin(), m_aAcceleratedImplementations.begin(),
aAccelEnd, aAccelEnd,
[&serviceName](std::pair<OUString, Sequence<OUString> > const& ap) [&serviceName](AvailPair const& ap)
{ return serviceName.equals(ap.first); } { return serviceName.equals(ap.first); }
)) == aAccelEnd ) { )) == aAccelEnd ) {
return Reference<XInterface>(); return Reference<XInterface>();

View File

@@ -48,6 +48,7 @@
#include <vcl/window.hxx> #include <vcl/window.hxx>
#include <vcl/graph.hxx> #include <vcl/graph.hxx>
#include <vcl/settings.hxx> #include <vcl/settings.hxx>
#include <o3tl/compat_functional.hxx>
#include <algorithm> #include <algorithm>
@@ -251,8 +252,7 @@ bool AccessibleBase::ImplUpdateChildren()
aAccChildren.reserve( aModelChildren.size()); aAccChildren.reserve( aModelChildren.size());
::std::transform( m_aChildOIDMap.begin(), m_aChildOIDMap.end(), ::std::transform( m_aChildOIDMap.begin(), m_aChildOIDMap.end(),
::std::back_inserter( aAccChildren ), ::std::back_inserter( aAccChildren ),
[]( const ::std::pair<ObjectIdentifier, tAccessible>& cp ) ::o3tl::select1st< ChildOIDMap::value_type >() );
{ return cp.first; } );
::std::sort( aModelChildren.begin(), aModelChildren.end()); ::std::sort( aModelChildren.begin(), aModelChildren.end());

View File

@@ -66,6 +66,7 @@
#include <vector> #include <vector>
#include <algorithm> #include <algorithm>
#include <functional> #include <functional>
#include <o3tl/compat_functional.hxx>
using namespace ::com::sun::star; using namespace ::com::sun::star;
using namespace ::com::sun::star::chart; using namespace ::com::sun::star::chart;
@@ -1459,8 +1460,7 @@ uno::Sequence< OUString > SAL_CALL ChartDocumentWrapper::getAvailableServiceName
::std::transform( rMap.begin(), rMap.end(), ::std::transform( rMap.begin(), rMap.end(),
aResult.getArray(), aResult.getArray(),
[]( const ::std::pair< OUString, eServiceType >& cp ) ::o3tl::select1st< tServiceNameMap::value_type >() );
{ return cp.first; } );
return aResult; return aResult;

View File

@@ -110,7 +110,7 @@ OUString lcl_ConvertRole( const OUString & rRoleString, bool bFromInternalToUI )
tTranslationMap::const_iterator aIt( tTranslationMap::const_iterator aIt(
::std::find_if( aTranslationMap.begin(), aTranslationMap.end(), ::std::find_if( aTranslationMap.begin(), aTranslationMap.end(),
[&rRoleString] [&rRoleString]
( const ::std::pair< OUString, OUString >& cp ) ( const tTranslationMap::value_type& cp )
{ return rRoleString == cp.second; } ) { return rRoleString == cp.second; } )
); );

View File

@@ -185,7 +185,7 @@ template< class MapType >
{ {
return ::std::find_if( rMap.begin(), rMap.end(), return ::std::find_if( rMap.begin(), rMap.end(),
[&rData] [&rData]
( const ::std::pair< typename MapType::key_type, typename MapType::mapped_type >& cp ) ( const typename MapType::value_type& cp )
{ return rData == cp.second; } ); { return rData == cp.second; } );
} }

View File

@@ -25,6 +25,7 @@
#include <algorithm> #include <algorithm>
#include <functional> #include <functional>
#include <o3tl/compat_functional.hxx>
namespace chart namespace chart
{ {
@@ -142,8 +143,7 @@ template< class Map >
{ {
::com::sun::star::uno::Sequence< typename Map::key_type > aResult( rCont.size()); ::com::sun::star::uno::Sequence< typename Map::key_type > aResult( rCont.size());
::std::transform( rCont.begin(), rCont.end(), aResult.getArray(), ::std::transform( rCont.begin(), rCont.end(), aResult.getArray(),
[]( const ::std::pair< typename Map::key_type, typename Map::mapped_type >& cp ) ::o3tl::select1st< typename Map::value_type >() );
{ return cp.first; } );
return aResult; return aResult;
} }
@@ -160,8 +160,7 @@ template< class Map >
{ {
::com::sun::star::uno::Sequence< typename Map::mapped_type > aResult( rCont.size()); ::com::sun::star::uno::Sequence< typename Map::mapped_type > aResult( rCont.size());
::std::transform( rCont.begin(), rCont.end(), aResult.getArray(), ::std::transform( rCont.begin(), rCont.end(), aResult.getArray(),
[]( const ::std::pair< typename Map::key_type, typename Map::mapped_type >& cp ) ::o3tl::select2nd< typename Map::value_type >() );
{ return cp.second; } );
return aResult; return aResult;
} }

View File

@@ -45,6 +45,7 @@
#include <algorithm> #include <algorithm>
#include <iterator> #include <iterator>
#include <functional> #include <functional>
#include <o3tl/compat_functional.hxx>
using namespace ::com::sun::star; using namespace ::com::sun::star;
@@ -574,8 +575,7 @@ uno::Sequence< OUString > SAL_CALL ChartTypeManager::getAvailableServiceNames()
// get own default templates // get own default templates
::std::transform( rMap.begin(), rMap.end(), ::std::back_inserter( aServices ), ::std::transform( rMap.begin(), rMap.end(), ::std::back_inserter( aServices ),
[]( const ::std::pair< OUString, TemplateId >& cp ) ::o3tl::select1st< tTemplateMapType::value_type >() );
{ return cp.first; } );
// add components that were registered in the context's factory // add components that were registered in the context's factory
uno::Reference< container::XContentEnumerationAccess > xEnumAcc( uno::Reference< container::XContentEnumerationAccess > xEnumAcc(

View File

@@ -26,6 +26,7 @@
#include <algorithm> #include <algorithm>
#include <functional> #include <functional>
#include <o3tl/compat_functional.hxx>
namespace dbaccess namespace dbaccess
{ {
@@ -203,8 +204,7 @@ namespace dbaccess
m_pData->rEventsData.begin(), m_pData->rEventsData.begin(),
m_pData->rEventsData.end(), m_pData->rEventsData.end(),
aNames.getArray(), aNames.getArray(),
[]( const ::std::pair< DocumentEventsData::key_type, DocumentEventsData::mapped_type >& cp ) ::o3tl::select1st< DocumentEventsData::value_type >()
{ return cp.first; }
); );
return aNames; return aNames;
} }

View File

@@ -58,6 +58,7 @@
#include <com/sun/star/util/XModifiable.hpp> #include <com/sun/star/util/XModifiable.hpp>
#include <rtl/ustring.hxx> #include <rtl/ustring.hxx>
#include <algorithm> #include <algorithm>
#include <o3tl/compat_functional.hxx>
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include <cppuhelper/implbase1.hxx> #include <cppuhelper/implbase1.hxx>
#include <limits> #include <limits>
@@ -1467,8 +1468,7 @@ Sequence< ::sal_Int16 > SAL_CALL OGenericUnoController::getSupportedCommandGroup
::std::transform( aCmdHashMap.begin(), ::std::transform( aCmdHashMap.begin(),
aCmdHashMap.end(), aCmdHashMap.end(),
aCommandGroups.getArray(), aCommandGroups.getArray(),
[]( const ::std::pair< CommandHashMap::key_type, CommandHashMap::mapped_type >& cp ) ::o3tl::select1st< CommandHashMap::value_type >()
{ return cp.first; }
); );
return aCommandGroups; return aCommandGroups;

View File

@@ -70,6 +70,7 @@
#include <algorithm> #include <algorithm>
#include <functional> #include <functional>
#include <o3tl/compat_functional.hxx>
namespace dbaui namespace dbaui
{ {
@@ -772,8 +773,7 @@ void ODbDataSourceAdministrationHelper::fillDatasourceInfo(const SfxItemSet& _rS
::std::transform(m_aIndirectPropTranslator.begin(), ::std::transform(m_aIndirectPropTranslator.begin(),
m_aIndirectPropTranslator.end(), m_aIndirectPropTranslator.end(),
::std::insert_iterator<StringSet>(aIndirectProps,aIndirectProps.begin()), ::std::insert_iterator<StringSet>(aIndirectProps,aIndirectProps.begin()),
[]( const ::std::pair< MapInt2String::key_type, MapInt2String::mapped_type >& cp ) ::o3tl::select2nd< MapInt2String::value_type >());
{ return cp.second; });
// now check the to-be-preserved props // now check the to-be-preserved props
::std::vector< sal_Int32 > aRemoveIndexes; ::std::vector< sal_Int32 > aRemoveIndexes;

View File

@@ -34,6 +34,7 @@
#include <functional> #include <functional>
#include <algorithm> #include <algorithm>
#include <o3tl/compat_functional.hxx>
namespace pcr namespace pcr
{ {
@@ -700,7 +701,7 @@ namespace pcr
_rElementNames.resize( rMapUINameToElement.size() ); _rElementNames.resize( rMapUINameToElement.size() );
::std::transform( rMapUINameToElement.begin(), rMapUINameToElement.end(), _rElementNames.begin(), ::std::transform( rMapUINameToElement.begin(), rMapUINameToElement.end(), _rElementNames.begin(),
[]( const ::std::pair< MapStringToPropertySet::key_type, MapStringToPropertySet::mapped_type>& cp) { return cp.first; } ); ::o3tl::select1st< MapStringToPropertySet::value_type >() );
} }

View File

@@ -68,6 +68,7 @@
#include <map> #include <map>
#include <algorithm> #include <algorithm>
#include <o3tl/compat_functional.hxx>
extern "C" void SAL_CALL createRegistryInfo_EventHandler() extern "C" void SAL_CALL createRegistryInfo_EventHandler()
{ {
@@ -775,7 +776,7 @@ namespace pcr
StlSyntaxSequence< Property > aReturn( aOrderedProperties.size() ); StlSyntaxSequence< Property > aReturn( aOrderedProperties.size() );
::std::transform( aOrderedProperties.begin(), aOrderedProperties.end(), aReturn.begin(), ::std::transform( aOrderedProperties.begin(), aOrderedProperties.end(), aReturn.begin(),
[]( const ::std::pair< EventId, Property >& cp ) { return cp.second; } ); ::o3tl::select2nd< std::map< EventId, Property >::value_type >() );
return aReturn; return aReturn;
} }

View File

@@ -41,6 +41,7 @@
#include <tools/debug.hxx> #include <tools/debug.hxx>
#include <algorithm> #include <algorithm>
#include <o3tl/compat_functional.hxx>
extern "C" void SAL_CALL createRegistryInfo_GenericPropertyHandler() extern "C" void SAL_CALL createRegistryInfo_GenericPropertyHandler()
{ {
@@ -530,8 +531,7 @@ namespace pcr
Sequence< Property > aReturn( m_aProperties.size() ); Sequence< Property > aReturn( m_aProperties.size() );
::std::transform( m_aProperties.begin(), m_aProperties.end(), ::std::transform( m_aProperties.begin(), m_aProperties.end(),
aReturn.getArray(), []( const ::std::pair< PropertyMap::key_type, PropertyMap::mapped_type >& cp ) aReturn.getArray(), ::o3tl::select2nd< PropertyMap::value_type >() );
{ return cp.second; } );
return aReturn; return aReturn;
} }

View File

@@ -23,6 +23,7 @@
#include "unohelper.hxx" #include "unohelper.hxx"
#include <algorithm> #include <algorithm>
#include <functional> #include <functional>
#include <o3tl/compat_functional.hxx>
#include <rtl/math.hxx> #include <rtl/math.hxx>
#include <rtl/ustrbuf.hxx> #include <rtl/ustrbuf.hxx>
#include <osl/diagnose.h> #include <osl/diagnose.h>
@@ -38,6 +39,7 @@ using xforms::Convert;
using com::sun::star::uno::Any; using com::sun::star::uno::Any;
using com::sun::star::uno::makeAny; using com::sun::star::uno::makeAny;
using namespace std; using namespace std;
using namespace o3tl;
using namespace utl; using namespace utl;
typedef com::sun::star::util::Date UNODate; typedef com::sun::star::util::Date UNODate;
@@ -305,9 +307,7 @@ Convert::Types_t Convert::getTypes()
{ {
Types_t aTypes( maMap.size() ); Types_t aTypes( maMap.size() );
transform( maMap.begin(), maMap.end(), aTypes.getArray(), transform( maMap.begin(), maMap.end(), aTypes.getArray(),
[] (::std::pair<const Type_t, Convert_t>& mpair) -> Type_t o3tl::select1st<Map_t::value_type>() );
{ return mpair.first; }
);
return aTypes; return aTypes;
} }

View File

@@ -29,6 +29,7 @@
#include <functional> #include <functional>
#include <algorithm> #include <algorithm>
#include <o3tl/compat_functional.hxx>
namespace xforms namespace xforms
{ {
@@ -182,8 +183,7 @@ namespace xforms
m_aRepository.begin(), m_aRepository.begin(),
m_aRepository.end(), m_aRepository.end(),
aNames.getArray(), aNames.getArray(),
[](::std::pair<const OUString, DataType>& rpair) -> OUString ::o3tl::select1st< Repository::value_type >()
{ return rpair.first; }
); );
return aNames; return aNames;
} }