summaryrefslogtreecommitdiffstats
path: root/canvas
diff options
context:
space:
mode:
authorDaniel Robertson <danlrobertson89@gmail.com>2015-07-29 23:07:45 -0400
committerDavid Ostrovsky <david@ostrovsky.org>2015-07-31 17:03:35 +0000
commit1a5e176e626d70d19abe4ad6e3b5c8d54a7badd7 (patch)
treeb1e7f135dead1541a42bb657eb5526781068641c /canvas
parenttdf#92982 vcl rendercontext: handle empty repaint rect in PaintHelper (diff)
downloadcore-1a5e176e626d70d19abe4ad6e3b5c8d54a7badd7.tar.gz
core-1a5e176e626d70d19abe4ad6e3b5c8d54a7badd7.zip
tdf#92459 Replace select1st for lambda expressions
Replace all instances of select1st with lambda functions in canvas/source/factory/cf_service.cxx. Change-Id: I935282817fdf6496bd03752b8adb89e827ff28c5 Reviewed-on: https://gerrit.libreoffice.org/17409 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: David Ostrovsky <david@ostrovsky.org>
Diffstat (limited to 'canvas')
-rw-r--r--canvas/source/factory/cf_service.cxx84
1 files changed, 35 insertions, 49 deletions
diff --git a/canvas/source/factory/cf_service.cxx b/canvas/source/factory/cf_service.cxx
index 5177989db36d..301001cc25da 100644
--- a/canvas/source/factory/cf_service.cxx
+++ b/canvas/source/factory/cf_service.cxx
@@ -35,10 +35,8 @@
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
-#include <boost/bind.hpp>
#include <vector>
#include <utility>
-#include <o3tl/compat_functional.hxx>
#include <algorithm>
@@ -54,10 +52,8 @@ class CanvasFactory
lang::XMultiComponentFactory,
lang::XMultiServiceFactory >
{
- typedef std::pair<OUString,Sequence<OUString> > AvailPair;
- typedef std::pair<OUString,OUString> CachePair;
- typedef std::vector< AvailPair > AvailVector;
- typedef std::vector< CachePair > CacheVector;
+ typedef std::vector<std::pair<OUString, Sequence<OUString> > > AvailVector;
+ typedef std::vector<std::pair<OUString, OUString> > CacheVector;
mutable ::osl::Mutex m_mutex;
@@ -242,7 +238,9 @@ Sequence<OUString> CanvasFactory::getAvailableServiceNames()
std::transform(m_aAvailableImplementations.begin(),
m_aAvailableImplementations.end(),
aServiceNames.getArray(),
- o3tl::select1st<AvailPair>());
+ [](std::pair<OUString, Sequence<OUString> > const& ap)
+ { return ap.first; }
+ );
return aServiceNames;
}
@@ -325,14 +323,12 @@ Reference<XInterface> CanvasFactory::lookupAndUse(
// try to reuse last working implementation for given service name
const CacheVector::iterator aEnd(m_aCachedImplementations.end());
CacheVector::iterator aMatch;
- if( (aMatch=std::find_if(m_aCachedImplementations.begin(),
- aEnd,
- boost::bind(&OUString::equals,
- boost::cref(serviceName),
- boost::bind(
- o3tl::select1st<CachePair>(),
- _1)))) != aEnd )
- {
+ if( (aMatch=std::find_if(
+ m_aCachedImplementations.begin(),
+ aEnd,
+ [&serviceName](std::pair<OUString, OUString> const& cp)
+ { return serviceName.equals(cp.first); }
+ )) != aEnd) {
Reference<XInterface> xCanvas( use( aMatch->second, args, xContext ) );
if(xCanvas.is())
return xCanvas;
@@ -341,40 +337,34 @@ Reference<XInterface> CanvasFactory::lookupAndUse(
// lookup in available service list
const AvailVector::const_iterator aAvailEnd(m_aAvailableImplementations.end());
AvailVector::const_iterator aAvailImplsMatch;
- if( (aAvailImplsMatch=std::find_if(m_aAvailableImplementations.begin(),
- aAvailEnd,
- boost::bind(&OUString::equals,
- boost::cref(serviceName),
- boost::bind(
- o3tl::select1st<AvailPair>(),
- _1)))) == aAvailEnd )
- {
+ if( (aAvailImplsMatch=std::find_if(
+ m_aAvailableImplementations.begin(),
+ aAvailEnd,
+ [&serviceName](std::pair<OUString, Sequence<OUString> > const& ap)
+ { return serviceName.equals(ap.first); }
+ )) == aAvailEnd ) {
return Reference<XInterface>();
}
const AvailVector::const_iterator aAAEnd(m_aAAImplementations.end());
AvailVector::const_iterator aAAImplsMatch;
- if( (aAAImplsMatch=std::find_if(m_aAAImplementations.begin(),
- aAAEnd,
- boost::bind(&OUString::equals,
- boost::cref(serviceName),
- boost::bind(
- o3tl::select1st<AvailPair>(),
- _1)))) == aAAEnd )
- {
+ if( (aAAImplsMatch=std::find_if(
+ m_aAAImplementations.begin(),
+ aAAEnd,
+ [&serviceName](std::pair<OUString, Sequence<OUString> > const& ap)
+ { return serviceName.equals(ap.first); }
+ )) == aAAEnd) {
return Reference<XInterface>();
}
const AvailVector::const_iterator aAccelEnd(m_aAcceleratedImplementations.end());
AvailVector::const_iterator aAccelImplsMatch;
- if( (aAccelImplsMatch=std::find_if(m_aAcceleratedImplementations.begin(),
- aAccelEnd,
- boost::bind(&OUString::equals,
- boost::cref(serviceName),
- boost::bind(
- o3tl::select1st<AvailPair>(),
- _1)))) == aAccelEnd )
- {
+ if( (aAccelImplsMatch=std::find_if(
+ m_aAcceleratedImplementations.begin(),
+ aAccelEnd,
+ [&serviceName](std::pair<OUString, Sequence<OUString> > const& ap)
+ { return serviceName.equals(ap.first); }
+ )) == aAccelEnd ) {
return Reference<XInterface>();
}
@@ -403,22 +393,18 @@ Reference<XInterface> CanvasFactory::lookupAndUse(
const bool bIsAcceleratedImpl(
std::any_of(pFirstAccelImpl,
pEndAccelImpl,
- boost::bind(&OUString::equals,
- boost::cref(aCurrName),
- boost::bind(
- &OUString::trim,
- _1))) );
+ [&aCurrName](OUString const& src)
+ { return aCurrName.equals(src.trim()); }
+ ));
// check whether given canvas service is listed in the
// sequence of "antialiasing canvas implementations"
const bool bIsAAImpl(
std::any_of(pFirstAAImpl,
pEndAAImpl,
- boost::bind(&OUString::equals,
- boost::cref(aCurrName),
- boost::bind(
- &OUString::trim,
- _1))) );
+ [&aCurrName](OUString const& src)
+ { return aCurrName.equals(src.trim()); }
+ ));
// try to instantiate canvas *only* if either accel and AA
// property match preference, *or*, if there's a mismatch, only