diff options
author | Daniel Robertson <danlrobertson89@gmail.com> | 2015-08-11 14:51:35 -0400 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2015-08-11 22:29:12 +0000 |
commit | 87130a4e18347d055331ff53da3b1a79548ff24a (patch) | |
tree | f1d3cfe7b7a2a9e7c9b3efbeddf23da9e7b9845e | |
parent | ae6afadbc0c6ffcdbfd0db6bb3b0166295d5effd (diff) |
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>
-rw-r--r-- | canvas/source/factory/cf_service.cxx | 20 | ||||
-rw-r--r-- | chart2/source/controller/accessibility/AccessibleBase.cxx | 4 | ||||
-rw-r--r-- | chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx | 4 | ||||
-rw-r--r-- | chart2/source/controller/dialogs/DialogModel.cxx | 2 | ||||
-rw-r--r-- | chart2/source/inc/CommonFunctors.hxx | 2 | ||||
-rw-r--r-- | chart2/source/inc/ContainerHelper.hxx | 7 | ||||
-rw-r--r-- | chart2/source/model/template/ChartTypeManager.cxx | 4 | ||||
-rw-r--r-- | dbaccess/source/core/dataaccess/documentevents.cxx | 4 | ||||
-rw-r--r-- | dbaccess/source/ui/browser/genericcontroller.cxx | 4 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/DbAdminImpl.cxx | 4 | ||||
-rw-r--r-- | extensions/source/propctrlr/eformshelper.cxx | 3 | ||||
-rw-r--r-- | extensions/source/propctrlr/eventhandler.cxx | 3 | ||||
-rw-r--r-- | extensions/source/propctrlr/genericpropertyhandler.cxx | 4 | ||||
-rw-r--r-- | forms/source/xforms/convert.cxx | 6 | ||||
-rw-r--r-- | forms/source/xforms/datatyperepository.cxx | 4 |
15 files changed, 38 insertions, 37 deletions
diff --git a/canvas/source/factory/cf_service.cxx b/canvas/source/factory/cf_service.cxx index 677cf4271020..9d1d2b290cee 100644 --- a/canvas/source/factory/cf_service.cxx +++ b/canvas/source/factory/cf_service.cxx @@ -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>(); diff --git a/chart2/source/controller/accessibility/AccessibleBase.cxx b/chart2/source/controller/accessibility/AccessibleBase.cxx index dc3832dd5a29..d092640d0ea2 100644 --- a/chart2/source/controller/accessibility/AccessibleBase.cxx +++ b/chart2/source/controller/accessibility/AccessibleBase.cxx @@ -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()); diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx index d34d9977aa23..d89abccf42ae 100644 --- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx @@ -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; diff --git a/chart2/source/controller/dialogs/DialogModel.cxx b/chart2/source/controller/dialogs/DialogModel.cxx index e017ddc9e377..2a2d799fac22 100644 --- a/chart2/source/controller/dialogs/DialogModel.cxx +++ b/chart2/source/controller/dialogs/DialogModel.cxx @@ -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; } ) ); diff --git a/chart2/source/inc/CommonFunctors.hxx b/chart2/source/inc/CommonFunctors.hxx index 596af8ac9bfc..692b0da2fe8c 100644 --- a/chart2/source/inc/CommonFunctors.hxx +++ b/chart2/source/inc/CommonFunctors.hxx @@ -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; } ); } diff --git a/chart2/source/inc/ContainerHelper.hxx b/chart2/source/inc/ContainerHelper.hxx index 655a01eb22d3..7e6f68e8fbb6 100644 --- a/chart2/source/inc/ContainerHelper.hxx +++ b/chart2/source/inc/ContainerHelper.hxx @@ -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; } diff --git a/chart2/source/model/template/ChartTypeManager.cxx b/chart2/source/model/template/ChartTypeManager.cxx index 17abb3531318..69218d1ef702 100644 --- a/chart2/source/model/template/ChartTypeManager.cxx +++ b/chart2/source/model/template/ChartTypeManager.cxx @@ -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( diff --git a/dbaccess/source/core/dataaccess/documentevents.cxx b/dbaccess/source/core/dataaccess/documentevents.cxx index 9966a23880fa..40c0d18ff07b 100644 --- a/dbaccess/source/core/dataaccess/documentevents.cxx +++ b/dbaccess/source/core/dataaccess/documentevents.cxx @@ -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; } diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx index a22e8fd6ed2b..a290a0b52842 100644 --- a/dbaccess/source/ui/browser/genericcontroller.cxx +++ b/dbaccess/source/ui/browser/genericcontroller.cxx @@ -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; diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx index 2be611028c7b..2fe9262d62fd 100644 --- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx +++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx @@ -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; diff --git a/extensions/source/propctrlr/eformshelper.cxx b/extensions/source/propctrlr/eformshelper.cxx index 14731e1bebdb..a7672886958d 100644 --- a/extensions/source/propctrlr/eformshelper.cxx +++ b/extensions/source/propctrlr/eformshelper.cxx @@ -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 >() ); } diff --git a/extensions/source/propctrlr/eventhandler.cxx b/extensions/source/propctrlr/eventhandler.cxx index 6a15c56f034e..f030e6437660 100644 --- a/extensions/source/propctrlr/eventhandler.cxx +++ b/extensions/source/propctrlr/eventhandler.cxx @@ -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; } diff --git a/extensions/source/propctrlr/genericpropertyhandler.cxx b/extensions/source/propctrlr/genericpropertyhandler.cxx index af489cc70d45..de94363d82d7 100644 --- a/extensions/source/propctrlr/genericpropertyhandler.cxx +++ b/extensions/source/propctrlr/genericpropertyhandler.cxx @@ -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; } diff --git a/forms/source/xforms/convert.cxx b/forms/source/xforms/convert.cxx index 7ed865b6b2f6..1933daf7ae6f 100644 --- a/forms/source/xforms/convert.cxx +++ b/forms/source/xforms/convert.cxx @@ -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; } diff --git a/forms/source/xforms/datatyperepository.cxx b/forms/source/xforms/datatyperepository.cxx index ac5081a79378..55c45b67686e 100644 --- a/forms/source/xforms/datatyperepository.cxx +++ b/forms/source/xforms/datatyperepository.cxx @@ -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; } |