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

View File

@@ -62,6 +62,7 @@
#include "dp_descriptioninfoset.hxx"
#include "dp_commandenvironments.hxx"
#include "dp_properties.hxx"
#include <algorithm>
using namespace ::dp_misc;
using namespace ::com::sun::star;
@@ -214,8 +215,7 @@ void PackageManagerImpl::initActivationLayer(
{
OUString const & tempEntry = tempEntries[ pos ];
const MatchTempDir match( tempEntry );
if (::std::find_if( id2temp.begin(), id2temp.end(), match ) ==
id2temp.end())
if (::std::none_of( id2temp.begin(), id2temp.end(), match ))
{
const OUString url(
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
//same identifier.
const MatchTempDir match(titleEncoded);
if (::std::find_if( id2temp.begin(), id2temp.end(), match ) ==
id2temp.end())
if (::std::none_of( id2temp.begin(), id2temp.end(), match ))
{
// 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/deployment/XPackageManager.hpp>
#include <boost/optional.hpp>
#include <algorithm>
#include <vector>
#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.
//Sometime programmers insert the same URL several times in the manifest
//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(
bindBundleItem( url, mediaType, false, OUString(), xCmdEnv ) );