diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2017-12-30 09:43:25 +0100 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2018-01-11 09:39:27 +0100 |
commit | 4cb3e1c05a16af3dad03db9d789dc7ea061b33cf (patch) | |
tree | 78f0f8a67e2ecbc60abc9901c0721f44a73ad4e7 /dbaccess/source/ui/relationdesign | |
parent | 42bfd59b6ba9e7a53ba789f04694060cc43d9d88 (diff) |
Use for-range loops in dbaccess (part2)
Change-Id: I7a247584a88fa516c7d28068b3d860499f090c92
Reviewed-on: https://gerrit.libreoffice.org/47189
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'dbaccess/source/ui/relationdesign')
3 files changed, 30 insertions, 40 deletions
diff --git a/dbaccess/source/ui/relationdesign/RTableConnection.cxx b/dbaccess/source/ui/relationdesign/RTableConnection.cxx index 7f818429930f..b76016d14c1a 100644 --- a/dbaccess/source/ui/relationdesign/RTableConnection.cxx +++ b/dbaccess/source/ui/relationdesign/RTableConnection.cxx @@ -61,19 +61,17 @@ void ORelationTableConnection::Draw(vcl::RenderContext& rRenderContext, const to const OConnectionLine* pTopLine = nullptr; const std::vector<OConnectionLine*>& rConnLineList = GetConnLineList(); - std::vector<OConnectionLine*>::const_iterator aIter = rConnLineList.begin(); - std::vector<OConnectionLine*>::const_iterator aEnd = rConnLineList.end(); - for(;aIter != aEnd;++aIter) + for (auto const& elem : rConnLineList) { - if( (*aIter)->IsValid() ) + if( elem->IsValid() ) { - aBoundingRect = (*aIter)->GetBoundingRect(); + aBoundingRect = elem->GetBoundingRect(); nTemp = aBoundingRect.Top(); if(nTemp < nTop) { nTop = nTemp; - pTopLine = (*aIter); + pTopLine = elem; } } } diff --git a/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx b/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx index a4553e3913aa..e7a590c85866 100644 --- a/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx +++ b/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx @@ -109,13 +109,11 @@ void ORelationTableConnectionData::ChangeOrientation() { // exchange Source- and DestFieldName of the lines OUString sTempString; - OConnectionLineDataVec::const_iterator aIter = m_vConnLineData.begin(); - OConnectionLineDataVec::const_iterator aEnd = m_vConnLineData.end(); - for(;aIter != aEnd;++aIter) + for (auto const& elem : m_vConnLineData) { - sTempString = (*aIter)->GetSourceFieldName(); - (*aIter)->SetSourceFieldName( (*aIter)->GetDestFieldName() ); - (*aIter)->SetDestFieldName( sTempString ); + sTempString = elem->GetSourceFieldName(); + elem->SetSourceFieldName( elem->GetDestFieldName() ); + elem->SetDestFieldName( sTempString ); } // adapt member @@ -159,12 +157,10 @@ bool ORelationTableConnectionData::checkPrimaryKey(const Reference< XPropertySet for(;pKeyIter != pKeyEnd;++pKeyIter) { - OConnectionLineDataVec::const_iterator aIter = m_vConnLineData.begin(); - OConnectionLineDataVec::const_iterator aEnd = m_vConnLineData.end(); - for(;aIter != aEnd;++aIter) + for (auto const& elem : m_vConnLineData) { ++nValidLinesCount; - if ( (*aIter)->GetFieldName(_eEConnectionSide) == *pKeyIter ) + if ( elem->GetFieldName(_eEConnectionSide) == *pKeyIter ) { ++nPrimKeysCount; break; @@ -226,14 +222,16 @@ bool operator==(const ORelationTableConnectionData& lhs, const ORelationTableCon if ( bEqual ) { - std::vector< OConnectionLineDataRef >::const_iterator aIter = lhs.m_vConnLineData.begin(); - std::vector< OConnectionLineDataRef >::const_iterator aEnd = lhs.m_vConnLineData.end(); - for (sal_Int32 i = 0; aIter != aEnd; ++aIter,++i) + sal_Int32 i = 0; + for (auto const& elem : lhs.m_vConnLineData) { - if ( *(rhs.m_vConnLineData[i]) != **aIter ) + if ( *(rhs.m_vConnLineData[i]) != *elem ) + { + bEqual = false; break; + } + ++i; } - bEqual = aIter == aEnd; } return bEqual; } @@ -286,18 +284,16 @@ bool ORelationTableConnectionData::Update() Reference<XAppend> xColumnAppend(xColumns,UNO_QUERY); if ( xColumnFactory.is() ) { - OConnectionLineDataVec::const_iterator aIter = m_vConnLineData.begin(); - OConnectionLineDataVec::const_iterator aEnd = m_vConnLineData.end(); - for(;aIter != aEnd;++aIter) + for (auto const& elem : m_vConnLineData) { - if(!((*aIter)->GetSourceFieldName().isEmpty() || (*aIter)->GetDestFieldName().isEmpty())) + if(!(elem->GetSourceFieldName().isEmpty() || elem->GetDestFieldName().isEmpty())) { Reference<XPropertySet> xColumn; xColumn = xColumnFactory->createDataDescriptor(); if ( xColumn.is() ) { - xColumn->setPropertyValue(PROPERTY_NAME,makeAny((*aIter)->GetSourceFieldName())); - xColumn->setPropertyValue(PROPERTY_RELATEDCOLUMN,makeAny((*aIter)->GetDestFieldName())); + xColumn->setPropertyValue(PROPERTY_NAME,makeAny(elem->GetSourceFieldName())); + xColumn->setPropertyValue(PROPERTY_RELATEDCOLUMN,makeAny(elem->GetDestFieldName())); xColumnAppend->appendByDescriptor(xColumn); } } diff --git a/dbaccess/source/ui/relationdesign/RelationController.cxx b/dbaccess/source/ui/relationdesign/RelationController.cxx index 233141474c4c..dfafc9291c24 100644 --- a/dbaccess/source/ui/relationdesign/RelationController.cxx +++ b/dbaccess/source/ui/relationdesign/RelationController.cxx @@ -442,17 +442,15 @@ void ORelationController::mergeData(const TTableConnectionData& _aConnectionData std::copy( _aConnectionData.begin(), _aConnectionData.end(), std::back_inserter( m_vTableConnectionData )); // here we are finished, so we can collect the table from connection data - TTableConnectionData::const_iterator aConnDataIter = m_vTableConnectionData.begin(); - TTableConnectionData::const_iterator aConnDataEnd = m_vTableConnectionData.end(); - for(;aConnDataIter != aConnDataEnd;++aConnDataIter) + for (auto const& elem : m_vTableConnectionData) { - if ( !existsTable((*aConnDataIter)->getReferencingTable()->GetComposedName()) ) + if ( !existsTable(elem->getReferencingTable()->GetComposedName()) ) { - m_vTableData.push_back((*aConnDataIter)->getReferencingTable()); + m_vTableData.push_back(elem->getReferencingTable()); } - if ( !existsTable((*aConnDataIter)->getReferencedTable()->GetComposedName()) ) + if ( !existsTable(elem->getReferencedTable()->GetComposedName()) ) { - m_vTableData.push_back((*aConnDataIter)->getReferencedTable()); + m_vTableData.push_back(elem->getReferencedTable()); } } if ( m_nThreadEvent ) @@ -532,14 +530,12 @@ void ORelationController::loadData() TTableWindowData::value_type ORelationController::existsTable(const OUString& _rComposedTableName) const { ::comphelper::UStringMixEqual bCase(true); - TTableWindowData::const_iterator aIter = m_vTableData.begin(); - TTableWindowData::const_iterator aEnd = m_vTableData.end(); - for(;aIter != aEnd;++aIter) + for (auto const& elem : m_vTableData) { - if(bCase((*aIter)->GetComposedName(),_rComposedTableName)) - break; + if(bCase(elem->GetComposedName(),_rComposedTableName)) + return elem; } - return ( aIter != aEnd) ? *aIter : TTableWindowData::value_type(); + return TTableWindowData::value_type(); } void ORelationController::loadLayoutInformation() |