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:
committed by
Thorsten Behrens
parent
ae6afadbc0
commit
87130a4e18
@@ -38,7 +38,7 @@
|
||||
#include <cppuhelper/supportsservice.hxx>
|
||||
#include <osl/mutex.hxx>
|
||||
#include <osl/process.h>
|
||||
|
||||
#include <o3tl/compat_functional.hxx>
|
||||
|
||||
using namespace ::com::sun::star;
|
||||
using namespace ::com::sun::star::uno;
|
||||
@@ -52,8 +52,10 @@ class CanvasFactory
|
||||
lang::XMultiComponentFactory,
|
||||
lang::XMultiServiceFactory >
|
||||
{
|
||||
typedef std::vector<std::pair<OUString, Sequence<OUString> > > AvailVector;
|
||||
typedef std::vector<std::pair<OUString, OUString> > CacheVector;
|
||||
typedef std::pair< OUString, Sequence< OUString > > AvailPair;
|
||||
typedef std::pair< OUString, OUString > CachePair;
|
||||
typedef std::vector< AvailPair > AvailVector;
|
||||
typedef std::vector< CachePair > CacheVector;
|
||||
|
||||
|
||||
mutable ::osl::Mutex m_mutex;
|
||||
@@ -238,9 +240,7 @@ Sequence<OUString> CanvasFactory::getAvailableServiceNames()
|
||||
std::transform(m_aAvailableImplementations.begin(),
|
||||
m_aAvailableImplementations.end(),
|
||||
aServiceNames.getArray(),
|
||||
[](std::pair<OUString, Sequence<OUString> > const& ap)
|
||||
{ return ap.first; }
|
||||
);
|
||||
o3tl::select1st< AvailPair >());
|
||||
return aServiceNames;
|
||||
}
|
||||
|
||||
@@ -326,7 +326,7 @@ Reference<XInterface> CanvasFactory::lookupAndUse(
|
||||
if( (aMatch=std::find_if(
|
||||
m_aCachedImplementations.begin(),
|
||||
aEnd,
|
||||
[&serviceName](std::pair<OUString, OUString> const& cp)
|
||||
[&serviceName](CachePair const& cp)
|
||||
{ return serviceName.equals(cp.first); }
|
||||
)) != aEnd) {
|
||||
Reference<XInterface> xCanvas( use( aMatch->second, args, xContext ) );
|
||||
@@ -340,7 +340,7 @@ Reference<XInterface> CanvasFactory::lookupAndUse(
|
||||
if( (aAvailImplsMatch=std::find_if(
|
||||
m_aAvailableImplementations.begin(),
|
||||
aAvailEnd,
|
||||
[&serviceName](std::pair<OUString, Sequence<OUString> > const& ap)
|
||||
[&serviceName](AvailPair const& ap)
|
||||
{ return serviceName.equals(ap.first); }
|
||||
)) == aAvailEnd ) {
|
||||
return Reference<XInterface>();
|
||||
@@ -351,7 +351,7 @@ Reference<XInterface> CanvasFactory::lookupAndUse(
|
||||
if( (aAAImplsMatch=std::find_if(
|
||||
m_aAAImplementations.begin(),
|
||||
aAAEnd,
|
||||
[&serviceName](std::pair<OUString, Sequence<OUString> > const& ap)
|
||||
[&serviceName](AvailPair const& ap)
|
||||
{ return serviceName.equals(ap.first); }
|
||||
)) == aAAEnd) {
|
||||
return Reference<XInterface>();
|
||||
@@ -362,7 +362,7 @@ Reference<XInterface> CanvasFactory::lookupAndUse(
|
||||
if( (aAccelImplsMatch=std::find_if(
|
||||
m_aAcceleratedImplementations.begin(),
|
||||
aAccelEnd,
|
||||
[&serviceName](std::pair<OUString, Sequence<OUString> > const& ap)
|
||||
[&serviceName](AvailPair const& ap)
|
||||
{ return serviceName.equals(ap.first); }
|
||||
)) == aAccelEnd ) {
|
||||
return Reference<XInterface>();
|
||||
|
@@ -48,6 +48,7 @@
|
||||
#include <vcl/window.hxx>
|
||||
#include <vcl/graph.hxx>
|
||||
#include <vcl/settings.hxx>
|
||||
#include <o3tl/compat_functional.hxx>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@@ -251,8 +252,7 @@ bool AccessibleBase::ImplUpdateChildren()
|
||||
aAccChildren.reserve( aModelChildren.size());
|
||||
::std::transform( m_aChildOIDMap.begin(), m_aChildOIDMap.end(),
|
||||
::std::back_inserter( aAccChildren ),
|
||||
[]( const ::std::pair<ObjectIdentifier, tAccessible>& cp )
|
||||
{ return cp.first; } );
|
||||
::o3tl::select1st< ChildOIDMap::value_type >() );
|
||||
|
||||
::std::sort( aModelChildren.begin(), aModelChildren.end());
|
||||
|
||||
|
@@ -66,6 +66,7 @@
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <o3tl/compat_functional.hxx>
|
||||
|
||||
using namespace ::com::sun::star;
|
||||
using namespace ::com::sun::star::chart;
|
||||
@@ -1459,8 +1460,7 @@ uno::Sequence< OUString > SAL_CALL ChartDocumentWrapper::getAvailableServiceName
|
||||
|
||||
::std::transform( rMap.begin(), rMap.end(),
|
||||
aResult.getArray(),
|
||||
[]( const ::std::pair< OUString, eServiceType >& cp )
|
||||
{ return cp.first; } );
|
||||
::o3tl::select1st< tServiceNameMap::value_type >() );
|
||||
|
||||
return aResult;
|
||||
|
||||
|
@@ -110,7 +110,7 @@ OUString lcl_ConvertRole( const OUString & rRoleString, bool bFromInternalToUI )
|
||||
tTranslationMap::const_iterator aIt(
|
||||
::std::find_if( aTranslationMap.begin(), aTranslationMap.end(),
|
||||
[&rRoleString]
|
||||
( const ::std::pair< OUString, OUString >& cp )
|
||||
( const tTranslationMap::value_type& cp )
|
||||
{ return rRoleString == cp.second; } )
|
||||
);
|
||||
|
||||
|
@@ -185,7 +185,7 @@ template< class MapType >
|
||||
{
|
||||
return ::std::find_if( rMap.begin(), rMap.end(),
|
||||
[&rData]
|
||||
( const ::std::pair< typename MapType::key_type, typename MapType::mapped_type >& cp )
|
||||
( const typename MapType::value_type& cp )
|
||||
{ return rData == cp.second; } );
|
||||
}
|
||||
|
||||
|
@@ -25,6 +25,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <o3tl/compat_functional.hxx>
|
||||
|
||||
namespace chart
|
||||
{
|
||||
@@ -142,8 +143,7 @@ template< class Map >
|
||||
{
|
||||
::com::sun::star::uno::Sequence< typename Map::key_type > aResult( rCont.size());
|
||||
::std::transform( rCont.begin(), rCont.end(), aResult.getArray(),
|
||||
[]( const ::std::pair< typename Map::key_type, typename Map::mapped_type >& cp )
|
||||
{ return cp.first; } );
|
||||
::o3tl::select1st< typename Map::value_type >() );
|
||||
return aResult;
|
||||
}
|
||||
|
||||
@@ -160,8 +160,7 @@ template< class Map >
|
||||
{
|
||||
::com::sun::star::uno::Sequence< typename Map::mapped_type > aResult( rCont.size());
|
||||
::std::transform( rCont.begin(), rCont.end(), aResult.getArray(),
|
||||
[]( const ::std::pair< typename Map::key_type, typename Map::mapped_type >& cp )
|
||||
{ return cp.second; } );
|
||||
::o3tl::select2nd< typename Map::value_type >() );
|
||||
return aResult;
|
||||
}
|
||||
|
||||
|
@@ -45,6 +45,7 @@
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <functional>
|
||||
#include <o3tl/compat_functional.hxx>
|
||||
|
||||
using namespace ::com::sun::star;
|
||||
|
||||
@@ -574,8 +575,7 @@ uno::Sequence< OUString > SAL_CALL ChartTypeManager::getAvailableServiceNames()
|
||||
|
||||
// get own default templates
|
||||
::std::transform( rMap.begin(), rMap.end(), ::std::back_inserter( aServices ),
|
||||
[]( const ::std::pair< OUString, TemplateId >& cp )
|
||||
{ return cp.first; } );
|
||||
::o3tl::select1st< tTemplateMapType::value_type >() );
|
||||
|
||||
// add components that were registered in the context's factory
|
||||
uno::Reference< container::XContentEnumerationAccess > xEnumAcc(
|
||||
|
@@ -26,6 +26,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <o3tl/compat_functional.hxx>
|
||||
|
||||
namespace dbaccess
|
||||
{
|
||||
@@ -203,8 +204,7 @@ namespace dbaccess
|
||||
m_pData->rEventsData.begin(),
|
||||
m_pData->rEventsData.end(),
|
||||
aNames.getArray(),
|
||||
[]( const ::std::pair< DocumentEventsData::key_type, DocumentEventsData::mapped_type >& cp )
|
||||
{ return cp.first; }
|
||||
::o3tl::select1st< DocumentEventsData::value_type >()
|
||||
);
|
||||
return aNames;
|
||||
}
|
||||
|
@@ -58,6 +58,7 @@
|
||||
#include <com/sun/star/util/XModifiable.hpp>
|
||||
#include <rtl/ustring.hxx>
|
||||
#include <algorithm>
|
||||
#include <o3tl/compat_functional.hxx>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <cppuhelper/implbase1.hxx>
|
||||
#include <limits>
|
||||
@@ -1467,8 +1468,7 @@ Sequence< ::sal_Int16 > SAL_CALL OGenericUnoController::getSupportedCommandGroup
|
||||
::std::transform( aCmdHashMap.begin(),
|
||||
aCmdHashMap.end(),
|
||||
aCommandGroups.getArray(),
|
||||
[]( const ::std::pair< CommandHashMap::key_type, CommandHashMap::mapped_type >& cp )
|
||||
{ return cp.first; }
|
||||
::o3tl::select1st< CommandHashMap::value_type >()
|
||||
);
|
||||
|
||||
return aCommandGroups;
|
||||
|
@@ -70,6 +70,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <o3tl/compat_functional.hxx>
|
||||
|
||||
namespace dbaui
|
||||
{
|
||||
@@ -772,8 +773,7 @@ void ODbDataSourceAdministrationHelper::fillDatasourceInfo(const SfxItemSet& _rS
|
||||
::std::transform(m_aIndirectPropTranslator.begin(),
|
||||
m_aIndirectPropTranslator.end(),
|
||||
::std::insert_iterator<StringSet>(aIndirectProps,aIndirectProps.begin()),
|
||||
[]( const ::std::pair< MapInt2String::key_type, MapInt2String::mapped_type >& cp )
|
||||
{ return cp.second; });
|
||||
::o3tl::select2nd< MapInt2String::value_type >());
|
||||
|
||||
// now check the to-be-preserved props
|
||||
::std::vector< sal_Int32 > aRemoveIndexes;
|
||||
|
@@ -34,6 +34,7 @@
|
||||
|
||||
#include <functional>
|
||||
#include <algorithm>
|
||||
#include <o3tl/compat_functional.hxx>
|
||||
|
||||
namespace pcr
|
||||
{
|
||||
@@ -700,7 +701,7 @@ namespace pcr
|
||||
|
||||
_rElementNames.resize( rMapUINameToElement.size() );
|
||||
::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 >() );
|
||||
}
|
||||
|
||||
|
||||
|
@@ -68,6 +68,7 @@
|
||||
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
#include <o3tl/compat_functional.hxx>
|
||||
|
||||
extern "C" void SAL_CALL createRegistryInfo_EventHandler()
|
||||
{
|
||||
@@ -775,7 +776,7 @@ namespace pcr
|
||||
|
||||
StlSyntaxSequence< Property > aReturn( aOrderedProperties.size() );
|
||||
::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;
|
||||
}
|
||||
|
||||
|
@@ -41,6 +41,7 @@
|
||||
#include <tools/debug.hxx>
|
||||
|
||||
#include <algorithm>
|
||||
#include <o3tl/compat_functional.hxx>
|
||||
|
||||
extern "C" void SAL_CALL createRegistryInfo_GenericPropertyHandler()
|
||||
{
|
||||
@@ -530,8 +531,7 @@ namespace pcr
|
||||
|
||||
Sequence< Property > aReturn( m_aProperties.size() );
|
||||
::std::transform( m_aProperties.begin(), m_aProperties.end(),
|
||||
aReturn.getArray(), []( const ::std::pair< PropertyMap::key_type, PropertyMap::mapped_type >& cp )
|
||||
{ return cp.second; } );
|
||||
aReturn.getArray(), ::o3tl::select2nd< PropertyMap::value_type >() );
|
||||
return aReturn;
|
||||
}
|
||||
|
||||
|
@@ -23,6 +23,7 @@
|
||||
#include "unohelper.hxx"
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <o3tl/compat_functional.hxx>
|
||||
#include <rtl/math.hxx>
|
||||
#include <rtl/ustrbuf.hxx>
|
||||
#include <osl/diagnose.h>
|
||||
@@ -38,6 +39,7 @@ using xforms::Convert;
|
||||
using com::sun::star::uno::Any;
|
||||
using com::sun::star::uno::makeAny;
|
||||
using namespace std;
|
||||
using namespace o3tl;
|
||||
using namespace utl;
|
||||
|
||||
typedef com::sun::star::util::Date UNODate;
|
||||
@@ -305,9 +307,7 @@ Convert::Types_t Convert::getTypes()
|
||||
{
|
||||
Types_t aTypes( maMap.size() );
|
||||
transform( maMap.begin(), maMap.end(), aTypes.getArray(),
|
||||
[] (::std::pair<const Type_t, Convert_t>& mpair) -> Type_t
|
||||
{ return mpair.first; }
|
||||
);
|
||||
o3tl::select1st<Map_t::value_type>() );
|
||||
return aTypes;
|
||||
}
|
||||
|
||||
|
@@ -29,6 +29,7 @@
|
||||
|
||||
#include <functional>
|
||||
#include <algorithm>
|
||||
#include <o3tl/compat_functional.hxx>
|
||||
|
||||
namespace xforms
|
||||
{
|
||||
@@ -182,8 +183,7 @@ namespace xforms
|
||||
m_aRepository.begin(),
|
||||
m_aRepository.end(),
|
||||
aNames.getArray(),
|
||||
[](::std::pair<const OUString, DataType>& rpair) -> OUString
|
||||
{ return rpair.first; }
|
||||
::o3tl::select1st< Repository::value_type >()
|
||||
);
|
||||
return aNames;
|
||||
}
|
||||
|
Reference in New Issue
Block a user