diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2017-12-28 18:43:27 +0100 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2017-12-28 20:16:36 +0100 |
commit | f2dafc6e2ccaee058276d8ddb02bea3c9bc095a2 (patch) | |
tree | c116096c0c11522665f2279617e317d943bd0d50 /dbaccess | |
parent | 271a663d2f098f3f665cab6da2e13b265a7eab93 (diff) |
Use for-range loops in dbaccess
Change-Id: I0be3aba4f03dcaba188670548901e4aef59c5ec0
Reviewed-on: https://gerrit.libreoffice.org/47148
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/core/api/RowSetBase.cxx | 5 | ||||
-rw-r--r-- | dbaccess/source/core/api/RowSetCache.cxx | 13 | ||||
-rw-r--r-- | dbaccess/source/ui/browser/formadapter.cxx | 11 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/querycontroller.cxx | 4 |
4 files changed, 12 insertions, 21 deletions
diff --git a/dbaccess/source/core/api/RowSetBase.cxx b/dbaccess/source/core/api/RowSetBase.cxx index 48226e2d61c8..6cfe0b756002 100644 --- a/dbaccess/source/core/api/RowSetBase.cxx +++ b/dbaccess/source/core/api/RowSetBase.cxx @@ -1427,10 +1427,9 @@ void ORowSetNotifier::firePropertyChange() OSL_ENSURE(m_pImpl.get(),"Illegal CTor call, use the other one!"); if( m_pImpl.get() ) { - std::vector<sal_Int32>::const_iterator aIter = m_pImpl->aChangedColumns.begin(); - for(;aIter != m_pImpl->aChangedColumns.end();++aIter) + for (auto const& changedColumn : m_pImpl->aChangedColumns) { - m_pRowSet->firePropertyChange((*aIter)-1 ,m_pImpl->aRow[(*aIter)-1], ORowSetBase::GrantNotifierAccess()); + m_pRowSet->firePropertyChange(changedColumn-1 ,m_pImpl->aRow[changedColumn-1], ORowSetBase::GrantNotifierAccess()); } if ( !m_pImpl->aChangedColumns.empty() ) m_pRowSet->fireProperty(PROPERTY_ID_ISMODIFIED,true,false, ORowSetBase::GrantNotifierAccess()); diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx index 78bb0140f5a6..d635e12a7331 100644 --- a/dbaccess/source/core/api/RowSetCache.cxx +++ b/dbaccess/source/core/api/RowSetCache.cxx @@ -1723,19 +1723,14 @@ void ORowSetCache::impl_updateRowFromCache_throw(ORowSetValueVector::Vector& io_ { if ( o_ChangedColumns.size() > 1 ) { - ORowSetMatrix::const_iterator aIter = m_pMatrix->begin(); - for(;aIter != m_pMatrix->end();++aIter) + for (auto const& elem : *m_pMatrix) { - if ( aIter->is() && m_xCacheSet->updateColumnValues((*aIter)->get(),io_aRow,o_ChangedColumns)) + if ( elem.is() && m_xCacheSet->updateColumnValues(elem->get(),io_aRow,o_ChangedColumns)) { - break; + return; } } - - if ( aIter == m_pMatrix->end() ) - { - m_xCacheSet->fillMissingValues(io_aRow); - } + m_xCacheSet->fillMissingValues(io_aRow); } } diff --git a/dbaccess/source/ui/browser/formadapter.cxx b/dbaccess/source/ui/browser/formadapter.cxx index 1fd7948ceafc..4660111c2c01 100644 --- a/dbaccess/source/ui/browser/formadapter.cxx +++ b/dbaccess/source/ui/browser/formadapter.cxx @@ -1087,20 +1087,17 @@ void SAL_CALL SbaXFormAdapter::dispose() m_aContainerListeners.disposeAndClear(aEvt); // dispose all children - for ( std::vector< Reference< css::form::XFormComponent > >::const_iterator aIter = m_aChildren.begin(); - aIter != m_aChildren.end(); - ++aIter - ) + for (auto const& child : m_aChildren) { - Reference< css::beans::XPropertySet > xSet(*aIter, UNO_QUERY); + Reference< css::beans::XPropertySet > xSet(child, UNO_QUERY); if (xSet.is()) xSet->removePropertyChangeListener(PROPERTY_NAME, static_cast<css::beans::XPropertyChangeListener*>(this)); - Reference< css::container::XChild > xChild(*aIter, UNO_QUERY); + Reference< css::container::XChild > xChild(child, UNO_QUERY); if (xChild.is()) xChild->setParent(Reference< XInterface > ()); - Reference< css::lang::XComponent > xComp(*aIter, UNO_QUERY); + Reference< css::lang::XComponent > xComp(child, UNO_QUERY); if (xComp.is()) xComp->dispose(); } diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx index aadc8f0fe7fa..32bf474fad65 100644 --- a/dbaccess/source/ui/querydesign/querycontroller.cxx +++ b/dbaccess/source/ui/querydesign/querycontroller.cxx @@ -1643,8 +1643,8 @@ static OUString concatComment( const OUString& rQuery, const std::vector< Commen // Obtaining the needed size once should be faster than reallocating. // Also add a blank or linefeed for each comment. sal_Int32 nBufSize = nLen + nComments; - for (std::vector< CommentStrip >::const_iterator it( rComments.begin()); it != rComments.end(); ++it) - nBufSize += (*it).maComment.getLength(); + for (auto const& comment : rComments) + nBufSize += comment.maComment.getLength(); OUStringBuffer aBuf( nBufSize ); sal_Int32 nIndBeg = 0; sal_Int32 nIndLF = rQuery.indexOf('\n'); |