summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorDaniel Robertson <danlrobertson89@gmail.com>2015-09-05 18:35:35 -0400
committerNoel Grandin <noelgrandin@gmail.com>2015-09-07 07:18:33 +0000
commit899c21ce5db0f4c3ad0bb6c9680e147f578b0894 (patch)
treef3b30afd828ee10df5205c57aaf69b0501bcace2 /dbaccess
parent3536eab550628ff4e07442066b7d1893519c03db (diff)
dbaccess: replace for_each with range-based for
Replace complex uses of ::std::for_each with a range-based for-loop. Change-Id: I82331f16cc1994dd9ef36eb80d67b64171cecc74 Reviewed-on: https://gerrit.libreoffice.org/18355 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/core/api/OptimisticSet.cxx78
-rw-r--r--dbaccess/source/core/dataaccess/databasecontext.cxx23
-rw-r--r--dbaccess/source/core/dataaccess/databasedocument.cxx26
-rw-r--r--dbaccess/source/ui/app/AppController.cxx24
-rw-r--r--dbaccess/source/ui/browser/genericcontroller.cxx28
-rw-r--r--dbaccess/source/ui/control/RelationControl.cxx9
-rw-r--r--dbaccess/source/ui/dlg/adminpages.cxx15
-rw-r--r--dbaccess/source/ui/dlg/adminpages.hxx24
-rw-r--r--dbaccess/source/ui/inc/ConnectionLine.hxx24
-rw-r--r--dbaccess/source/ui/inc/ConnectionLineData.hxx1
-rw-r--r--dbaccess/source/ui/inc/RefFunctor.hxx45
-rw-r--r--dbaccess/source/ui/querydesign/TableConnection.cxx11
-rw-r--r--dbaccess/source/ui/tabledesign/TableController.cxx5
13 files changed, 87 insertions, 226 deletions
diff --git a/dbaccess/source/core/api/OptimisticSet.cxx b/dbaccess/source/core/api/OptimisticSet.cxx
index 182b18dd13cc..73fa377ec7ae 100644
--- a/dbaccess/source/core/api/OptimisticSet.cxx
+++ b/dbaccess/source/core/api/OptimisticSet.cxx
@@ -471,47 +471,22 @@ void OptimisticSet::mergeColumnValues(sal_Int32 i_nColumnIndex,ORowSetValueVecto
}
}
-namespace
-{
- struct PositionFunctor : ::std::unary_function<SelectColumnsMetaData::value_type,bool>
- {
- sal_Int32 m_nPos;
- explicit PositionFunctor(sal_Int32 i_nPos)
- : m_nPos(i_nPos)
- {
- }
-
- inline bool operator()(const SelectColumnsMetaData::value_type& _aType)
- {
- return m_nPos == _aType.second.nPosition;
- }
- };
- struct TableNameFunctor : ::std::unary_function<SelectColumnsMetaData::value_type,bool>
- {
- OUString m_sTableName;
- explicit TableNameFunctor(const OUString& i_sTableName)
- : m_sTableName(i_sTableName)
- {
- }
-
- inline bool operator()(const SelectColumnsMetaData::value_type& _aType)
- {
- return m_sTableName == _aType.second.sTableName;
- }
- };
-}
-
bool OptimisticSet::updateColumnValues(const ORowSetValueVector::Vector& io_aCachedRow,ORowSetValueVector::Vector& io_aRow,const ::std::vector<sal_Int32>& i_aChangedColumns)
{
bool bRet = false;
- ::std::vector<sal_Int32>::const_iterator aColIdxIter = i_aChangedColumns.begin();
- for(;aColIdxIter != i_aChangedColumns.end();++aColIdxIter)
+ for( const auto& aColIdx : i_aChangedColumns )
{
- SelectColumnsMetaData::const_iterator aFind = ::std::find_if(m_pKeyColumnNames->begin(),m_pKeyColumnNames->end(),PositionFunctor(*aColIdxIter));
+ SelectColumnsMetaData::const_iterator aFind = ::std::find_if(
+ m_pKeyColumnNames->begin(),m_pKeyColumnNames->end(),
+ [&aColIdx]( const SelectColumnsMetaData::value_type& aType )
+ { return aType.second.nPosition == aColIdx; } );
if ( aFind != m_pKeyColumnNames->end() )
{
const OUString sTableName = aFind->second.sTableName;
- aFind = ::std::find_if(m_pKeyColumnNames->begin(),m_pKeyColumnNames->end(),TableNameFunctor(sTableName));
+ aFind = ::std::find_if( m_pKeyColumnNames->begin(),m_pKeyColumnNames->end(),
+ [&sTableName]
+ ( const SelectColumnsMetaData::value_type& rCurr )
+ { return rCurr.second.sTableName == sTableName; } );
while( aFind != m_pKeyColumnNames->end() )
{
io_aRow[aFind->second.nPosition].setSigned(io_aCachedRow[aFind->second.nPosition].isSigned());
@@ -522,14 +497,12 @@ bool OptimisticSet::updateColumnValues(const ORowSetValueVector::Vector& io_aCac
if ( aFind == m_pKeyColumnNames->end() )
{
bRet = true;
- SelectColumnsMetaData::const_iterator aIter = m_pColumnNames->begin();
- SelectColumnsMetaData::const_iterator aEnd = m_pColumnNames->end();
- for ( ;aIter != aEnd;++aIter )
+ for( const auto& aCol : *m_pColumnNames )
{
- if ( aIter->second.sTableName == sTableName )
+ if ( aCol.second.sTableName == sTableName )
{
- io_aRow[aIter->second.nPosition] = io_aCachedRow[aIter->second.nPosition];
- io_aRow[aIter->second.nPosition].setModified();
+ io_aRow[aCol.second.nPosition] = io_aCachedRow[aCol.second.nPosition];
+ io_aRow[aCol.second.nPosition].setModified();
}
}
}
@@ -541,15 +514,20 @@ bool OptimisticSet::updateColumnValues(const ORowSetValueVector::Vector& io_aCac
bool OptimisticSet::columnValuesUpdated(ORowSetValueVector::Vector& o_aCachedRow,const ORowSetValueVector::Vector& i_aRow)
{
bool bRet = false;
- SelectColumnsMetaData::const_iterator aIter = m_pColumnNames->begin();
- SelectColumnsMetaData::const_iterator aEnd = m_pColumnNames->end();
- for(;aIter != aEnd;++aIter)
+ for( const auto& aCol : *m_pColumnNames )
{
- SelectColumnsMetaData::const_iterator aFind = ::std::find_if(m_pKeyColumnNames->begin(),m_pKeyColumnNames->end(),PositionFunctor(aIter->second.nPosition));
+ sal_Int32 nPos = aCol.second.nPosition;
+ SelectColumnsMetaData::const_iterator aFind = ::std::find_if(
+ m_pKeyColumnNames->begin(),m_pKeyColumnNames->end(),
+ [&nPos] ( const SelectColumnsMetaData::value_type& aType )
+ { return aType.second.nPosition == nPos; } );
if ( aFind != m_pKeyColumnNames->end() )
{
const OUString sTableName = aFind->second.sTableName;
- aFind = ::std::find_if(m_pKeyColumnNames->begin(),m_pKeyColumnNames->end(),TableNameFunctor(sTableName));
+ aFind = ::std::find_if( m_pKeyColumnNames->begin(),m_pKeyColumnNames->end(),
+ [&sTableName]
+ ( const SelectColumnsMetaData::value_type& rCurr )
+ { return rCurr.second.sTableName == sTableName; } );
while( aFind != m_pKeyColumnNames->end() )
{
o_aCachedRow[aFind->second.nPosition].setSigned(i_aRow[aFind->second.nPosition].isSigned());
@@ -560,14 +538,12 @@ bool OptimisticSet::columnValuesUpdated(ORowSetValueVector::Vector& o_aCachedRow
if ( aFind == m_pKeyColumnNames->end() )
{
bRet = true;
- SelectColumnsMetaData::const_iterator aIter2 = m_pColumnNames->begin();
- SelectColumnsMetaData::const_iterator aEnd2 = m_pColumnNames->end();
- for ( ;aIter2 != aEnd2;++aIter2 )
+ for( const auto& aCol2 : *m_pColumnNames )
{
- if ( aIter2->second.sTableName == sTableName )
+ if ( aCol2.second.sTableName == sTableName )
{
- o_aCachedRow[aIter2->second.nPosition] = i_aRow[aIter2->second.nPosition];
- o_aCachedRow[aIter2->second.nPosition].setModified();
+ o_aCachedRow[aCol2.second.nPosition] = i_aRow[aCol2.second.nPosition];
+ o_aCachedRow[aCol2.second.nPosition].setModified();
}
}
fillMissingValues(o_aCachedRow);
diff --git a/dbaccess/source/core/dataaccess/databasecontext.cxx b/dbaccess/source/core/dataaccess/databasecontext.cxx
index 0f698a68621b..504fdcfbf4a7 100644
--- a/dbaccess/source/core/dataaccess/databasecontext.cxx
+++ b/dbaccess/source/core/dataaccess/databasecontext.cxx
@@ -131,30 +131,27 @@ namespace dbaccess
}
}
- struct TerminateFunctor : ::std::unary_function<ODatabaseModelImpl* , void>
+ void SAL_CALL DatabaseDocumentLoader::queryTermination( const lang::EventObject& /*Event*/ ) throw (TerminationVetoException, RuntimeException, std::exception)
{
- void operator()( const ODatabaseModelImpl* _pModelImpl ) const
+ ::std::list< const ODatabaseModelImpl* > aCpy(m_aDatabaseDocuments);
+ for( const auto& pCopy : aCpy )
{
try
{
- const Reference< XModel2> xModel( _pModelImpl ->getModel_noCreate(),UNO_QUERY_THROW );
- if ( !xModel->getControllers()->hasMoreElements() )
+ const Reference< XModel2 > xMod( pCopy->getModel_noCreate(),
+ UNO_QUERY_THROW );
+ if( !xMod->getControllers()->hasMoreElements() )
{
- Reference<util::XCloseable> xCloseable(xModel,UNO_QUERY_THROW);
- xCloseable->close(sal_False);
+ Reference< util::XCloseable > xClose( xMod,
+ UNO_QUERY_THROW );
+ xClose->close( sal_False );
}
}
- catch(const CloseVetoException&)
+ catch( const CloseVetoException& )
{
throw TerminationVetoException();
}
}
- };
-
- void SAL_CALL DatabaseDocumentLoader::queryTermination( const lang::EventObject& /*Event*/ ) throw (TerminationVetoException, RuntimeException, std::exception)
- {
- ::std::list< const ODatabaseModelImpl* > aCopy(m_aDatabaseDocuments);
- ::std::for_each(aCopy.begin(),aCopy.end(),TerminateFunctor());
}
void SAL_CALL DatabaseDocumentLoader::notifyTermination( const lang::EventObject& /*Event*/ ) throw (RuntimeException, std::exception)
diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx
index 7c764361b773..5ab756e88559 100644
--- a/dbaccess/source/core/dataaccess/databasedocument.cxx
+++ b/dbaccess/source/core/dataaccess/databasedocument.cxx
@@ -86,7 +86,6 @@
#include <boost/bind.hpp>
-#include <algorithm>
#include <functional>
#include <list>
@@ -1497,30 +1496,25 @@ void ODatabaseDocument::impl_closeControllerFrames_nolck_throw( bool _bDeliverOw
}
}
-struct DisposeControllerFrame : public ::std::unary_function< Reference< XController >, void >
+void ODatabaseDocument::impl_disposeControllerFrames_nothrow()
{
- void operator()( const Reference< XController >& _rxController ) const
+ Controllers aCopy;
+ aCopy.swap( m_aControllers ); // ensure m_aControllers is empty afterwards
+ for( const auto& rController : aCopy )
{
try
{
- if ( !_rxController.is() )
- return;
-
- Reference< XFrame > xFrame( _rxController->getFrame() );
- ::comphelper::disposeComponent( xFrame );
+ if( rController.is() )
+ {
+ Reference< XFrame > xFrame( rController->getFrame() );
+ ::comphelper::disposeComponent( xFrame );
+ }
}
catch( const Exception& )
{
DBG_UNHANDLED_EXCEPTION();
}
- };
-};
-
-void ODatabaseDocument::impl_disposeControllerFrames_nothrow()
-{
- Controllers aCopy;
- aCopy.swap( m_aControllers ); // ensure m_aControllers is empty afterwards
- ::std::for_each( aCopy.begin(), aCopy.end(), DisposeControllerFrame() );
+ }
}
void SAL_CALL ODatabaseDocument::close( sal_Bool _bDeliverOwnership ) throw (CloseVetoException, RuntimeException, std::exception)
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx
index 52e99495efae..69bb9279d5f4 100644
--- a/dbaccess/source/ui/app/AppController.cxx
+++ b/dbaccess/source/ui/app/AppController.cxx
@@ -121,7 +121,6 @@
#include "dlgsave.hxx"
#include "dbaccess_slotid.hrc"
-#include <algorithm>
#include <functional>
#include <boost/noncopyable.hpp>
@@ -185,20 +184,6 @@ Reference< XInterface > SAL_CALL OApplicationController::Create(const Reference<
return *(new OApplicationController( comphelper::getComponentContext(_rxFactory)));
}
-struct XContainerFunctor : public ::std::unary_function< OApplicationController::TContainerVector::value_type , bool>
-{
- Reference<XContainerListener> m_xContainerListener;
- explicit XContainerFunctor( const Reference<XContainerListener>& _xContainerListener)
- : m_xContainerListener(_xContainerListener){}
-
- bool operator() (const OApplicationController::TContainerVector::value_type& lhs) const
- {
- if ( lhs.is() )
- lhs->removeContainerListener(m_xContainerListener);
- return true;
- }
-};
-
// OApplicationController
class SelectionNotifier : public ::boost::noncopyable
{
@@ -339,7 +324,14 @@ void OApplicationController::disconnect()
void SAL_CALL OApplicationController::disposing()
{
- ::std::for_each(m_aCurrentContainers.begin(),m_aCurrentContainers.end(),XContainerFunctor(this));
+ for( const auto& rContainerListener : m_aCurrentContainers )
+ {
+ if( rContainerListener.is() )
+ {
+ rContainerListener->removeContainerListener( this );
+ }
+ }
+
m_aCurrentContainers.clear();
m_pSubComponentManager->disposing();
m_pSelectionNotifier->disposing();
diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx
index 5a9fd7386290..b7d6dffe5dbd 100644
--- a/dbaccess/source/ui/browser/genericcontroller.cxx
+++ b/dbaccess/source/ui/browser/genericcontroller.cxx
@@ -57,7 +57,6 @@
#include <com/sun/star/frame/status/Visibility.hpp>
#include <com/sun/star/util/XModifiable.hpp>
#include <rtl/ustring.hxx>
-#include <algorithm>
#include <o3tl/functional.hxx>
#include <boost/scoped_ptr.hpp>
#include <cppuhelper/implbase1.hxx>
@@ -403,23 +402,6 @@ void OGenericUnoController::attachFrame( const Reference< XFrame >& _rxFrame ) t
getView()->attachFrame( xFrame );
}
-struct CommandCollector : public ::std::unary_function< SupportedFeatures::value_type, void>
-{
- sal_uInt16 m_nFeature;
- StringBag& m_rFeatureCommands;
- CommandCollector( sal_uInt16 _nFeature, StringBag& _rFeatureCommands )
- :m_nFeature ( _nFeature )
- ,m_rFeatureCommands( _rFeatureCommands )
- {
- }
-
- void operator() ( const SupportedFeatures::value_type& lhs )
- {
- if ( lhs.second.nFeatureId == m_nFeature )
- m_rFeatureCommands.insert( lhs.first );
- }
-};
-
namespace
{
typedef ::std::vector< Any > States;
@@ -495,11 +477,11 @@ void OGenericUnoController::ImplBroadcastFeatureState(const OUString& _rFeature,
else
{ // no -> iterate through all listeners responsible for the URL
StringBag aFeatureCommands;
- ::std::for_each(
- m_aSupportedFeatures.begin(),
- m_aSupportedFeatures.end(),
- CommandCollector( nFeat, aFeatureCommands )
- );
+ for( const auto& rFeature : m_aSupportedFeatures )
+ {
+ if( rFeature.second.nFeatureId == nFeat )
+ aFeatureCommands.insert( rFeature.first );
+ }
// it is possible that listeners are registered or revoked while
// we are notifying them, so we must use a copy of m_arrStatusListener, not
diff --git a/dbaccess/source/ui/control/RelationControl.cxx b/dbaccess/source/ui/control/RelationControl.cxx
index d1603a2a1628..20c906f96441 100644
--- a/dbaccess/source/ui/control/RelationControl.cxx
+++ b/dbaccess/source/ui/control/RelationControl.cxx
@@ -35,7 +35,6 @@
#include "dbaccess_helpid.hrc"
#include <osl/diagnose.h>
-#include <algorithm>
#include <list>
using std::list;
#include <utility>
@@ -405,10 +404,10 @@ namespace dbaui
{
// no connection found so we clear our data
OConnectionLineDataVec& rLines = m_pConnData->GetConnLineDataList();
- ::std::for_each(rLines.begin(),
- rLines.end(),
- OUnaryRefFunctor<OConnectionLineData>( ::std::mem_fun(&OConnectionLineData::Reset))
- );
+ for( const auto& rLine : rLines )
+ {
+ rLine.get()->Reset();
+ }
m_pConnData->setReferencingTable(_pSource->GetData());
m_pConnData->setReferencedTable(_pDest->GetData());
diff --git a/dbaccess/source/ui/dlg/adminpages.cxx b/dbaccess/source/ui/dlg/adminpages.cxx
index 8e8b0f4a3080..82b68b3633e2 100644
--- a/dbaccess/source/ui/dlg/adminpages.cxx
+++ b/dbaccess/source/ui/dlg/adminpages.cxx
@@ -148,16 +148,25 @@ namespace dbaui
if ( _bSaveValue )
{
fillControls(aControlList);
- ::std::for_each(aControlList.begin(),aControlList.end(),TSaveValueWrapperFunctor());
+ for( const auto& pValueWrapper : aControlList )
+ {
+ pValueWrapper->SaveValue();
+ }
}
if ( bReadonly )
{
fillWindows(aControlList);
- ::std::for_each(aControlList.begin(),aControlList.end(),TDisableWrapperFunctor());
+ for( const auto& pValueWrapper : aControlList )
+ {
+ pValueWrapper->Disable();
+ }
}
- ::std::for_each(aControlList.begin(),aControlList.end(),TDeleteWrapperFunctor());
+ for( const auto& pValueWrapper : aControlList )
+ {
+ delete pValueWrapper;
+ }
aControlList.clear();
}
diff --git a/dbaccess/source/ui/dlg/adminpages.hxx b/dbaccess/source/ui/dlg/adminpages.hxx
index a87342fed9bb..552857c1e9cc 100644
--- a/dbaccess/source/ui/dlg/adminpages.hxx
+++ b/dbaccess/source/ui/dlg/adminpages.hxx
@@ -62,30 +62,6 @@ namespace dbaui
virtual bool Disable() SAL_OVERRIDE { m_pSaveValue->Disable(); return true;} // bool return value only for stl
};
- struct TSaveValueWrapperFunctor : public ::std::unary_function< ISaveValueWrapper, bool>
- {
- bool operator() (ISaveValueWrapper* lhs)
- {
- return lhs->SaveValue();
- }
- };
- struct TDisableWrapperFunctor : public ::std::unary_function< ISaveValueWrapper, bool>
- {
- bool operator() (ISaveValueWrapper* lhs)
- {
- return lhs->Disable();
- }
- };
-
- struct TDeleteWrapperFunctor : public ::std::unary_function< ISaveValueWrapper, bool>
- {
- bool operator() (ISaveValueWrapper* lhs)
- {
- delete lhs;
- return true;
- }
- };
-
// OGenericAdministrationPage
class IDatabaseSettingsDialog;
class IItemSetHelper;
diff --git a/dbaccess/source/ui/inc/ConnectionLine.hxx b/dbaccess/source/ui/inc/ConnectionLine.hxx
index 3918b6b80539..864a36405238 100644
--- a/dbaccess/source/ui/inc/ConnectionLine.hxx
+++ b/dbaccess/source/ui/inc/ConnectionLine.hxx
@@ -21,7 +21,6 @@
#include <tools/gen.hxx>
#include "ConnectionLineData.hxx"
-#include <functional>
#include <vcl/vclptr.hxx>
class OutputDevice;
@@ -69,29 +68,6 @@ namespace dbaui
Point getMidPoint() const;
};
- /// unary_function Functor object for class OConnectionLine returntype is void
- /// draws a connectionline object on outputdevice
- struct TConnectionLineDrawFunctor : std::unary_function<OConnectionLine*, void>
- {
- VclPtr<OutputDevice> pDevice;
- TConnectionLineDrawFunctor(OutputDevice* _pDevice)
- {
- pDevice = _pDevice;
- }
- inline void operator()(OConnectionLine* _pLine)
- {
- _pLine->Draw(pDevice);
- }
- };
- /// binary_function Functor object for class OConnectionLine returntype is bool
- /// checks if the point is on connectionline
- struct TConnectionLineCheckHitFunctor : ::std::binary_function<OConnectionLine*,Point,bool>
- {
- inline bool operator()(const OConnectionLine* lhs,const Point& rhs) const
- {
- return lhs->CheckHit(rhs);
- }
- };
}
#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_CONNECTIONLINE_HXX
diff --git a/dbaccess/source/ui/inc/ConnectionLineData.hxx b/dbaccess/source/ui/inc/ConnectionLineData.hxx
index 4feb939e48c7..629982e08086 100644
--- a/dbaccess/source/ui/inc/ConnectionLineData.hxx
+++ b/dbaccess/source/ui/inc/ConnectionLineData.hxx
@@ -24,7 +24,6 @@
#include <rtl/ref.hxx>
#include <salhelper/simplereferenceobject.hxx>
-#include "RefFunctor.hxx"
#include <rtl/ustring.hxx>
namespace dbaui
diff --git a/dbaccess/source/ui/inc/RefFunctor.hxx b/dbaccess/source/ui/inc/RefFunctor.hxx
deleted file mode 100644
index 5ac012cde334..000000000000
--- a/dbaccess/source/ui/inc/RefFunctor.hxx
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_REFFUNCTOR_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_REFFUNCTOR_HXX
-
-#include <rtl/ref.hxx>
-#ifndef INCLUDED_FUNCTIONAL
-#define INCLUDED_FUNCTIONAL
-#include <functional>
-#endif // INCLUDED_FUNCTIONAL
-
-namespace dbaui
-{
- template <class T> class OUnaryRefFunctor : public ::std::unary_function< ::rtl::Reference<T> ,void>
- {
- ::std::mem_fun_t<bool,T> m_aFunction;
- public:
- OUnaryRefFunctor(const ::std::mem_fun_t<bool,T>& _aFunc) : m_aFunction(_aFunc)
- {}
- inline void operator()(const ::rtl::Reference<T>& _aType) const
- {
- m_aFunction(_aType.get());
- }
- };
-} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_REFFUNCTOR_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/querydesign/TableConnection.cxx b/dbaccess/source/ui/querydesign/TableConnection.cxx
index de48a0790a80..46ed63cbaebe 100644
--- a/dbaccess/source/ui/querydesign/TableConnection.cxx
+++ b/dbaccess/source/ui/querydesign/TableConnection.cxx
@@ -23,7 +23,6 @@
#include "JoinTableView.hxx"
#include <comphelper/stl_types.hxx>
#include "ConnectionLineAccess.hxx"
-#include <algorithm>
using namespace dbaui;
using namespace comphelper;
@@ -112,7 +111,8 @@ namespace dbaui
bool OTableConnection::RecalcLines()
{
// call RecalcLines on each line
- ::std::for_each(m_vConnLine.begin(),m_vConnLine.end(),::std::mem_fun(&OConnectionLine::RecalcLine));
+ for( const auto& pLine : m_vConnLine )
+ pLine->RecalcLine();
return true;
}
OTableWindow* OTableConnection::GetSourceWin() const
@@ -153,7 +153,9 @@ namespace dbaui
// check if the point hit our line
return ::std::any_of(m_vConnLine.begin(),
m_vConnLine.end(),
- ::std::bind2nd(TConnectionLineCheckHitFunctor(),rMousePos));
+ [&rMousePos]
+ ( const OConnectionLine* pLine )
+ { return pLine->CheckHit( rMousePos ); } );
}
bool OTableConnection::InvalidateConnection()
@@ -196,7 +198,8 @@ namespace dbaui
void OTableConnection::Draw(vcl::RenderContext& rRenderContext, const Rectangle& /*rRect*/)
{
// Draw line
- std::for_each(m_vConnLine.begin(), m_vConnLine.end(), TConnectionLineDrawFunctor(&rRenderContext));
+ for( const auto& pLine : m_vConnLine )
+ pLine->Draw( &rRenderContext );
}
}
diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx
index 8c7bb1fe3b46..507bab4d14bb 100644
--- a/dbaccess/source/ui/tabledesign/TableController.cxx
+++ b/dbaccess/source/ui/tabledesign/TableController.cxx
@@ -1380,7 +1380,10 @@ void OTableController::assignTable()
setEditable( xMeta.is() && !xMeta->isReadOnly() && (isAlterAllowed() || isDropAllowed() || isAddAllowed()) );
if(!isEditable())
{
- ::std::for_each(m_vRowList.begin(),m_vRowList.end(),boost::bind( &OTableRow::SetReadOnly, _1, true));
+ for( const auto& rTableRow : m_vRowList )
+ {
+ rTableRow->SetReadOnly( true );
+ }
}
m_bNew = false;
// be notified when the table is in disposing