desktop: simplify code by std::none_of

Change-Id: Ie69927f3a1e0a8049ea7e15f949e17d5b9f15fce
This commit is contained in:
Takeshi Abe
2015-05-18 14:10:21 +09:00
committed by David Tardon
parent 6a4a55d5f4
commit b4848def46
3 changed files with 9 additions and 8 deletions

View File

@@ -32,6 +32,7 @@
#include <cppuhelper/weakref.hxx> #include <cppuhelper/weakref.hxx>
#include <vcl/settings.hxx> #include <vcl/settings.hxx>
#include <vcl/builderfactory.hxx> #include <vcl/builderfactory.hxx>
#include <algorithm>
#define USER_PACKAGE_MANAGER "user" #define USER_PACKAGE_MANAGER "user"
#define SHARED_PACKAGE_MANAGER "shared" #define SHARED_PACKAGE_MANAGER "shared"
@@ -982,9 +983,8 @@ void ExtensionBox_Impl::addEventListenerOnce(
{ {
//make sure to only add the listener once //make sure to only add the listener once
cleanVecListenerAdded(); cleanVecListenerAdded();
if ( ::std::find_if(m_vListenerAdded.begin(), m_vListenerAdded.end(), if ( ::std::none_of(m_vListenerAdded.begin(), m_vListenerAdded.end(),
FindWeakRef(extension)) FindWeakRef(extension)) )
== m_vListenerAdded.end())
{ {
extension->addEventListener( uno::Reference< lang::XEventListener > ( extension->addEventListener( uno::Reference< lang::XEventListener > (
m_xRemoveListener, uno::UNO_QUERY ) ); m_xRemoveListener, uno::UNO_QUERY ) );

View File

@@ -62,6 +62,7 @@
#include "dp_descriptioninfoset.hxx" #include "dp_descriptioninfoset.hxx"
#include "dp_commandenvironments.hxx" #include "dp_commandenvironments.hxx"
#include "dp_properties.hxx" #include "dp_properties.hxx"
#include <algorithm>
using namespace ::dp_misc; using namespace ::dp_misc;
using namespace ::com::sun::star; using namespace ::com::sun::star;
@@ -214,8 +215,7 @@ void PackageManagerImpl::initActivationLayer(
{ {
OUString const & tempEntry = tempEntries[ pos ]; OUString const & tempEntry = tempEntries[ pos ];
const MatchTempDir match( tempEntry ); const MatchTempDir match( tempEntry );
if (::std::find_if( id2temp.begin(), id2temp.end(), match ) == if (::std::none_of( id2temp.begin(), id2temp.end(), match ))
id2temp.end())
{ {
const OUString url( const OUString url(
makeURL(m_activePackages_expanded, tempEntry ) ); makeURL(m_activePackages_expanded, tempEntry ) );
@@ -1336,8 +1336,7 @@ bool PackageManagerImpl::synchronizeAddedExtensions(
//installed the extension it was already checked if there is one with the //installed the extension it was already checked if there is one with the
//same identifier. //same identifier.
const MatchTempDir match(titleEncoded); const MatchTempDir match(titleEncoded);
if (::std::find_if( id2temp.begin(), id2temp.end(), match ) == if (::std::none_of( id2temp.begin(), id2temp.end(), match ))
id2temp.end())
{ {
// The folder was not found in the data base, so it must be // The folder was not found in the data base, so it must be

View File

@@ -65,6 +65,8 @@
#include <com/sun/star/xml/xpath/XXPathAPI.hpp> #include <com/sun/star/xml/xpath/XXPathAPI.hpp>
#include <com/sun/star/deployment/XPackageManager.hpp> #include <com/sun/star/deployment/XPackageManager.hpp>
#include <boost/optional.hpp> #include <boost/optional.hpp>
#include <algorithm>
#include <vector> #include <vector>
#include "dp_extbackenddb.hxx" #include "dp_extbackenddb.hxx"
@@ -1524,7 +1526,7 @@ void BackendImpl::PackageImpl::scanBundle(
//We make sure that we only create one XPackage for a particular URL. //We make sure that we only create one XPackage for a particular URL.
//Sometime programmers insert the same URL several times in the manifest //Sometime programmers insert the same URL several times in the manifest
//which may lead to DisposedExceptions. //which may lead to DisposedExceptions.
if (bundle.end() == std::find_if(bundle.begin(), bundle.end(), XPackage_eq(url))) if (std::none_of(bundle.begin(), bundle.end(), XPackage_eq(url)))
{ {
const Reference<deployment::XPackage> xPackage( const Reference<deployment::XPackage> xPackage(
bindBundleItem( url, mediaType, false, OUString(), xCmdEnv ) ); bindBundleItem( url, mediaType, false, OUString(), xCmdEnv ) );