diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2018-03-09 23:27:25 +0100 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2018-03-10 09:44:56 +0100 |
commit | 5b2fc10f0cc9f15525c7723764a1feebeceb0d5e (patch) | |
tree | 1d4159a006696d3072dc98fc989c3fbd58e32b7a /dbaccess/source/ui/control | |
parent | 7c693fc3f7218e1ca0c85a0de76ae84226391256 (diff) |
Modernize a bit more dbaccess
mainly by using for-range loops
but also by simplifying some simple algo
Change-Id: If04cd78e62f80f9575e24f3d50ff1e427454da79
Reviewed-on: https://gerrit.libreoffice.org/51019
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'dbaccess/source/ui/control')
-rw-r--r-- | dbaccess/source/ui/control/FieldDescControl.cxx | 6 | ||||
-rw-r--r-- | dbaccess/source/ui/control/RelationControl.cxx | 36 | ||||
-rw-r--r-- | dbaccess/source/ui/control/charsetlistbox.cxx | 6 | ||||
-rw-r--r-- | dbaccess/source/ui/control/tabletree.cxx | 16 |
4 files changed, 25 insertions, 39 deletions
diff --git a/dbaccess/source/ui/control/FieldDescControl.cxx b/dbaccess/source/ui/control/FieldDescControl.cxx index 937a7792b756..05525ceeb9f3 100644 --- a/dbaccess/source/ui/control/FieldDescControl.cxx +++ b/dbaccess/source/ui/control/FieldDescControl.cxx @@ -783,10 +783,8 @@ void OFieldDescControl::ActivateAggregate( EControlType eType ) m_pType->SetDropDownLineCount(20); { const OTypeInfoMap* pTypeInfo = getTypeInfo(); - OTypeInfoMap::const_iterator aIter = pTypeInfo->begin(); - OTypeInfoMap::const_iterator aEnd = pTypeInfo->end(); - for(;aIter != aEnd;++aIter) - m_pType->InsertEntry( aIter->second->aUIName ); + for (auto const& elem : *pTypeInfo) + m_pType->InsertEntry( elem.second->aUIName ); } m_pType->SelectEntryPos(0); InitializeControl(m_pType,HID_TAB_ENT_TYPE,true); diff --git a/dbaccess/source/ui/control/RelationControl.cxx b/dbaccess/source/ui/control/RelationControl.cxx index 6f0465d45410..ad2ea0ba783d 100644 --- a/dbaccess/source/ui/control/RelationControl.cxx +++ b/dbaccess/source/ui/control/RelationControl.cxx @@ -469,22 +469,20 @@ namespace dbaui OTableWindow* pInitialRight = nullptr; // Collect the names of all TabWins - OJoinTableView::OTableWindowMap::const_iterator aIter = m_pTableMap->begin(); - OJoinTableView::OTableWindowMap::const_iterator aEnd = m_pTableMap->end(); - for(;aIter != aEnd;++aIter) + for (auto const& elem : *m_pTableMap) { - m_pLeftTable->InsertEntry(aIter->first); - m_pRightTable->InsertEntry(aIter->first); + m_pLeftTable->InsertEntry(elem.first); + m_pRightTable->InsertEntry(elem.first); if (!pInitialLeft) { - pInitialLeft = aIter->second; - m_strCurrentLeft = aIter->first; + pInitialLeft = elem.second; + m_strCurrentLeft = elem.first; } else if (!pInitialRight) { - pInitialRight = aIter->second; - m_strCurrentRight = aIter->first; + pInitialRight = elem.second; + m_strCurrentRight = elem.first; } } @@ -602,30 +600,28 @@ namespace dbaui bool bValid = !rLines.empty(); if (bValid) { - OConnectionLineDataVec::const_iterator l(rLines.begin()); - const OConnectionLineDataVec::const_iterator le(rLines.end()); - for (; bValid && l!=le; ++l) + for (auto const& line : rLines) { - bValid = ! ((*l)->GetSourceFieldName().isEmpty() || (*l)->GetDestFieldName().isEmpty()); + bValid = ! (line->GetSourceFieldName().isEmpty() || line->GetDestFieldName().isEmpty()); + if (!bValid) + break; } } m_pParentDialog->setValid(bValid); - ORelationControl::ops_type::const_iterator i (m_pRC_Tables->m_ops.begin()); - const ORelationControl::ops_type::const_iterator e (m_pRC_Tables->m_ops.end()); m_pRC_Tables->DeactivateCell(); - for(; i != e; ++i) + for (auto const& elem : m_pRC_Tables->m_ops) { - switch(i->first) + switch(elem.first) { case ORelationControl::DELETE: - m_pRC_Tables->RowRemoved(i->second.first, i->second.second - i->second.first); + m_pRC_Tables->RowRemoved(elem.second.first, elem.second.second - elem.second.first); break; case ORelationControl::INSERT: - m_pRC_Tables->RowInserted(i->second.first, i->second.second - i->second.first); + m_pRC_Tables->RowInserted(elem.second.first, elem.second.second - elem.second.first); break; case ORelationControl::MODIFY: - for(OConnectionLineDataVec::size_type j = i->second.first; j < i->second.second; ++j) + for(OConnectionLineDataVec::size_type j = elem.second.first; j < elem.second.second; ++j) m_pRC_Tables->RowModified(j); break; } diff --git a/dbaccess/source/ui/control/charsetlistbox.cxx b/dbaccess/source/ui/control/charsetlistbox.cxx index 13ff25598c5d..7cc4b15a9212 100644 --- a/dbaccess/source/ui/control/charsetlistbox.cxx +++ b/dbaccess/source/ui/control/charsetlistbox.cxx @@ -31,11 +31,9 @@ namespace dbaui { SetDropDownLineCount( 20 ); - OCharsetDisplay::const_iterator charSet = m_aCharSets.begin(); - while ( charSet != m_aCharSets.end() ) + for (auto const& charset : m_aCharSets) { - InsertEntry( (*charSet).getDisplayName() ); - ++charSet; + InsertEntry( charset.getDisplayName() ); } } diff --git a/dbaccess/source/ui/control/tabletree.cxx b/dbaccess/source/ui/control/tabletree.cxx index 73c1620f5f2a..8ee5c648d37f 100644 --- a/dbaccess/source/ui/control/tabletree.cxx +++ b/dbaccess/source/ui/control/tabletree.cxx @@ -265,16 +265,13 @@ void OTableTreeListBox::UpdateTableList( const Reference< XConnection >& _rxConn return; // get the table/view names - TNames::const_iterator aIter = _rTables.begin(); - TNames::const_iterator aEnd = _rTables.end(); - Reference< XDatabaseMetaData > xMeta( _rxConnection->getMetaData(), UNO_QUERY_THROW ); - for ( ; aIter != aEnd; ++aIter ) + for (auto const& table : _rTables) { // add the entry implAddEntry( xMeta, - aIter->first, + table.first, false ); } @@ -296,14 +293,11 @@ void OTableTreeListBox::UpdateTableList( const Reference< XConnection >& _rxConn sal_Int32 nFolderType = bCatalogs ? DatabaseObjectContainer::CATALOG : DatabaseObjectContainer::SCHEMA; SvTreeListEntry* pRootEntry = getAllObjectsEntry(); - for ( std::vector< OUString >::const_iterator folder = aFolderNames.begin(); - folder != aFolderNames.end(); - ++folder - ) + for (auto const& folderName : aFolderNames) { - SvTreeListEntry* pFolder = GetEntryPosByName( *folder, pRootEntry ); + SvTreeListEntry* pFolder = GetEntryPosByName( folderName, pRootEntry ); if ( !pFolder ) - InsertEntry( *folder, pRootEntry, false, TREELIST_APPEND, reinterpret_cast< void* >( nFolderType ) ); + InsertEntry( folderName, pRootEntry, false, TREELIST_APPEND, reinterpret_cast< void* >( nFolderType ) ); } } } |