summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorTakeshi Abe <tabe@fixedpoint.jp>2015-05-04 10:47:12 +0900
committerDavid Tardon <dtardon@redhat.com>2015-05-06 14:41:26 +0000
commit7d8b03256e851f2436c05a56df5f3f61c957ff70 (patch)
tree8553710dd1a0e45891fb0b3359dc12db3e08917a /dbaccess
parentf1097c868afe618d99f13c28418d5df23983601d (diff)
dbaccess: simplify code by using std::any_of/std::none_of
Change-Id: I03ed512ba20206ed38428efe324f54f79abe1933 Reviewed-on: https://gerrit.libreoffice.org/15616 Tested-by: Jenkins <ci@libreoffice.org> Tested-by: David Tardon <dtardon@redhat.com> Reviewed-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/ui/app/AppController.cxx2
-rw-r--r--dbaccess/source/ui/browser/dsbrowserDnD.cxx3
-rw-r--r--dbaccess/source/ui/browser/sbagrid.cxx6
-rw-r--r--dbaccess/source/ui/control/tabletree.cxx13
-rw-r--r--dbaccess/source/ui/inc/WCopyTable.hxx5
-rw-r--r--dbaccess/source/ui/querydesign/TableConnection.cxx7
-rw-r--r--dbaccess/source/ui/tabledesign/TableController.cxx20
7 files changed, 25 insertions, 31 deletions
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx
index ea2a6e76c98f..c07b651e13cf 100644
--- a/dbaccess/source/ui/app/AppController.cxx
+++ b/dbaccess/source/ui/app/AppController.cxx
@@ -2412,7 +2412,7 @@ sal_Int8 OApplicationController::queryDrop( const AcceptDropEvent& _rEvt, const
if ( eType != E_NONE && (eType != E_TABLE || !isConnectionReadOnly()) )
{
// check for the concrete type
- if(::std::find_if(_rFlavors.begin(),_rFlavors.end(),TAppSupportedSotFunctor(eType,true)) != _rFlavors.end())
+ if(::std::any_of(_rFlavors.begin(),_rFlavors.end(),TAppSupportedSotFunctor(eType,true)))
return DND_ACTION_COPY;
if ( eType == E_FORM || eType == E_REPORT )
{
diff --git a/dbaccess/source/ui/browser/dsbrowserDnD.cxx b/dbaccess/source/ui/browser/dsbrowserDnD.cxx
index 53bd5b45bcc7..5aadaaf0b6c1 100644
--- a/dbaccess/source/ui/browser/dsbrowserDnD.cxx
+++ b/dbaccess/source/ui/browser/dsbrowserDnD.cxx
@@ -39,6 +39,7 @@
#include <osl/diagnose.h>
#include "svtools/treelistentry.hxx"
+#include <algorithm>
#include <functional>
namespace dbaui
{
@@ -107,7 +108,7 @@ namespace dbaui
Reference<XStorable> xStore;
xStore = Reference<XStorable>( xChild.is() ? getDataSourceOrModel(xChild->getParent()) : Reference<XInterface>(),UNO_QUERY );
// check for the concrete type
- if ( xStore.is() && !xStore->isReadonly() && ::std::find_if(_rFlavors.begin(),_rFlavors.end(),TAppSupportedSotFunctor(E_TABLE,true)) != _rFlavors.end())
+ if ( xStore.is() && !xStore->isReadonly() && ::std::any_of(_rFlavors.begin(),_rFlavors.end(),TAppSupportedSotFunctor(E_TABLE,true)) )
return DND_ACTION_COPY;
}
}
diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx
index e8c728fffdf2..17b459202bc9 100644
--- a/dbaccess/source/ui/browser/sbagrid.cxx
+++ b/dbaccess/source/ui/browser/sbagrid.cxx
@@ -81,6 +81,7 @@
#include "UITools.hxx"
#include "TokenWriter.hxx"
#include <osl/diagnose.h>
+#include <algorithm>
using namespace ::com::sun::star::ui::dialogs;
using namespace ::com::sun::star::uno;
@@ -1355,7 +1356,7 @@ sal_Int8 SbaGridControl::AcceptDrop( const BrowserAcceptDropEvent& rEvt )
if(nAction != DND_ACTION_COPY && GetEmptyRow().Is())
{
const DataFlavorExVector& _rFlavors = GetDataFlavors();
- if(::std::find_if(_rFlavors.begin(),_rFlavors.end(),SbaGridControlPrec(true)) != _rFlavors.end())
+ if(::std::any_of(_rFlavors.begin(),_rFlavors.end(),SbaGridControlPrec(true)))
nAction = DND_ACTION_COPY;
}
@@ -1416,8 +1417,7 @@ sal_Int8 SbaGridControl::ExecuteDrop( const BrowserExecuteDropEvent& rEvt )
if(GetEmptyRow().Is())
{
const DataFlavorExVector& _rFlavors = GetDataFlavors();
- DataFlavorExVector::const_iterator aFind = ::std::find_if(_rFlavors.begin(),_rFlavors.end(),SbaGridControlPrec(true));
- if( aFind != _rFlavors.end())
+ if( ::std::any_of(_rFlavors.begin(),_rFlavors.end(),SbaGridControlPrec(true)) )
{
TransferableDataHelper aDropped( rEvt.maDropEvent.Transferable );
m_aDataDescriptor = ODataAccessObjectTransferable::extractObjectDescriptor(aDropped);
diff --git a/dbaccess/source/ui/control/tabletree.cxx b/dbaccess/source/ui/control/tabletree.cxx
index 6db98c998621..1d0eddbbfc2a 100644
--- a/dbaccess/source/ui/control/tabletree.cxx
+++ b/dbaccess/source/ui/control/tabletree.cxx
@@ -199,7 +199,7 @@ namespace
aRet.first = lhs;
const OUString* pIter = m_aViews.getConstArray();
const OUString* pEnd = m_aViews.getConstArray() + m_aViews.getLength();
- aRet.second = (::std::find_if(pIter,pEnd,::std::bind2nd(m_aEqualFunctor,lhs)) != pEnd);
+ aRet.second = ::std::any_of(pIter,pEnd,::std::bind2nd(m_aEqualFunctor,lhs));
return aRet;
}
@@ -260,14 +260,11 @@ void OTableTreeListBox::UpdateTableList( const Reference< XConnection >& _rxConn
if (haveVirtualRoot())
{
OUString sRootEntryText;
- TNames::const_iterator aViews = ::std::find_if(_rTables.begin(),_rTables.end(),
- ::o3tl::compose1(::std::bind2nd(::std::equal_to<sal_Bool>(),sal_False),::o3tl::select2nd<TNames::value_type>()));
- TNames::const_iterator aTables = ::std::find_if(_rTables.begin(),_rTables.end(),
- ::o3tl::compose1(::std::bind2nd(::std::equal_to<sal_Bool>(),sal_True),::o3tl::select2nd<TNames::value_type>()));
-
- if ( aViews == _rTables.end() )
+ if ( ::std::none_of(_rTables.begin(),_rTables.end(),
+ ::o3tl::compose1(::std::bind2nd(::std::equal_to<sal_Bool>(),sal_False),::o3tl::select2nd<TNames::value_type>())) )
sRootEntryText = ModuleRes(STR_ALL_TABLES);
- else if ( aTables == _rTables.end() )
+ else if ( ::std::none_of(_rTables.begin(),_rTables.end(),
+ ::o3tl::compose1(::std::bind2nd(::std::equal_to<sal_Bool>(),sal_True),::o3tl::select2nd<TNames::value_type>())) )
sRootEntryText = ModuleRes(STR_ALL_VIEWS);
else
sRootEntryText = ModuleRes(STR_ALL_TABLES_AND_VIEWS);
diff --git a/dbaccess/source/ui/inc/WCopyTable.hxx b/dbaccess/source/ui/inc/WCopyTable.hxx
index dfdaa60d1862..6ce0038320e8 100644
--- a/dbaccess/source/ui/inc/WCopyTable.hxx
+++ b/dbaccess/source/ui/inc/WCopyTable.hxx
@@ -40,6 +40,7 @@
#include <vcl/lstbox.hxx>
#include <functional>
#include <map>
+#include <algorithm>
namespace dbaui
{
@@ -87,8 +88,8 @@ namespace dbaui
bool operator()(const OUString& _sColumnName) const SAL_OVERRIDE
{
- return ::std::find_if(m_pVector->begin(),m_pVector->end(),
- ::std::bind2nd(m_aCase, _sColumnName)) != m_pVector->end();
+ return ::std::any_of(m_pVector->begin(),m_pVector->end(),
+ ::std::bind2nd(m_aCase, _sColumnName));
}
};
diff --git a/dbaccess/source/ui/querydesign/TableConnection.cxx b/dbaccess/source/ui/querydesign/TableConnection.cxx
index 457a58481c64..b0967c4cfbaa 100644
--- a/dbaccess/source/ui/querydesign/TableConnection.cxx
+++ b/dbaccess/source/ui/querydesign/TableConnection.cxx
@@ -151,10 +151,9 @@ namespace dbaui
bool OTableConnection::CheckHit( const Point& rMousePos ) const
{
// check if the point hit our line
- ::std::vector<OConnectionLine*>::const_iterator aIter = ::std::find_if(m_vConnLine.begin(),
- m_vConnLine.end(),
- ::std::bind2nd(TConnectionLineCheckHitFunctor(),rMousePos));
- return aIter != m_vConnLine.end();
+ return ::std::any_of(m_vConnLine.begin(),
+ m_vConnLine.end(),
+ ::std::bind2nd(TConnectionLineCheckHitFunctor(),rMousePos));
}
bool OTableConnection::InvalidateConnection()
diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx
index bb7df8cd65f8..8c7bb1fe3b46 100644
--- a/dbaccess/source/ui/tabledesign/TableController.cxx
+++ b/dbaccess/source/ui/tabledesign/TableController.cxx
@@ -197,18 +197,16 @@ FeatureState OTableController::GetState(sal_uInt16 _nId) const
aReturn.bEnabled = impl_isModified();
if ( aReturn.bEnabled )
{
- ::std::vector< ::boost::shared_ptr<OTableRow> >::const_iterator aIter = ::std::find_if(m_vRowList.begin(),m_vRowList.end(),
- ::boost::mem_fn(&OTableRow::isValid));
- aReturn.bEnabled = aIter != m_vRowList.end();
+ aReturn.bEnabled = ::std::any_of(m_vRowList.begin(),m_vRowList.end(),
+ ::boost::mem_fn(&OTableRow::isValid));
}
break;
case ID_BROWSER_SAVEASDOC:
aReturn.bEnabled = isConnected() && isEditable();
if ( aReturn.bEnabled )
{
- ::std::vector< ::boost::shared_ptr<OTableRow> >::const_iterator aIter = ::std::find_if(m_vRowList.begin(),m_vRowList.end(),
- ::boost::mem_fn(&OTableRow::isValid));
- aReturn.bEnabled = aIter != m_vRowList.end();
+ aReturn.bEnabled = ::std::any_of(m_vRowList.begin(),m_vRowList.end(),
+ ::boost::mem_fn(&OTableRow::isValid));
}
break;
@@ -230,9 +228,8 @@ FeatureState OTableController::GetState(sal_uInt16 _nId) const
);
if ( aReturn.bEnabled )
{
- ::std::vector< ::boost::shared_ptr<OTableRow> >::const_iterator aIter = ::std::find_if(m_vRowList.begin(),m_vRowList.end(),
- ::boost::mem_fn(&OTableRow::isValid));
- aReturn.bEnabled = aIter != m_vRowList.end();
+ aReturn.bEnabled = ::std::any_of(m_vRowList.begin(),m_vRowList.end(),
+ ::boost::mem_fn(&OTableRow::isValid));
}
break;
default:
@@ -559,9 +556,8 @@ sal_Bool SAL_CALL OTableController::suspend(sal_Bool /*_bSuspend*/) throw( Runti
bool bCheck = true;
if ( isModified() )
{
- ::std::vector< ::boost::shared_ptr<OTableRow> >::iterator aIter = ::std::find_if(m_vRowList.begin(),m_vRowList.end(),
- ::boost::mem_fn(&OTableRow::isValid));
- if ( aIter != m_vRowList.end() )
+ if ( ::std::any_of(m_vRowList.begin(),m_vRowList.end(),
+ ::boost::mem_fn(&OTableRow::isValid)) )
{
ScopedVclPtrInstance<MessageDialog> aQry(getView(), "TableDesignSaveModifiedDialog",
"dbaccess/ui/tabledesignsavemodifieddialog.ui");