summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2018-03-09 23:27:25 +0100
committerJulien Nabet <serval2412@yahoo.fr>2018-03-10 09:44:56 +0100
commit5b2fc10f0cc9f15525c7723764a1feebeceb0d5e (patch)
tree1d4159a006696d3072dc98fc989c3fbd58e32b7a
parent7c693fc3f7218e1ca0c85a0de76ae84226391256 (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>
-rw-r--r--dbaccess/source/core/dataaccess/bookmarkcontainer.cxx10
-rw-r--r--dbaccess/source/core/dataaccess/connection.cxx10
-rw-r--r--dbaccess/source/core/dataaccess/databasecontext.cxx8
-rw-r--r--dbaccess/source/core/dataaccess/databasedocument.cxx21
-rw-r--r--dbaccess/source/core/dataaccess/definitioncontainer.cxx32
-rw-r--r--dbaccess/source/core/dataaccess/documentcontainer.cxx12
-rw-r--r--dbaccess/source/core/dataaccess/myucp_datasupplier.cxx8
-rw-r--r--dbaccess/source/core/misc/DatabaseDataProvider.cxx30
-rw-r--r--dbaccess/source/core/misc/PropertyForward.cxx6
-rw-r--r--dbaccess/source/core/misc/dsntypes.cxx58
-rw-r--r--dbaccess/source/core/recovery/dbdocrecovery.cxx45
-rw-r--r--dbaccess/source/ext/macromigration/migrationengine.cxx10
-rw-r--r--dbaccess/source/ext/macromigration/migrationlog.cxx49
-rw-r--r--dbaccess/source/ext/macromigration/progressmixer.cxx11
-rw-r--r--dbaccess/source/filter/hsqldb/createparser.cxx4
-rw-r--r--dbaccess/source/filter/xml/xmlAutoStyle.cxx12
-rw-r--r--dbaccess/source/filter/xml/xmlExport.cxx15
-rw-r--r--dbaccess/source/ui/app/AppController.cxx25
-rw-r--r--dbaccess/source/ui/app/AppControllerGen.cxx19
-rw-r--r--dbaccess/source/ui/app/AppDetailView.cxx22
-rw-r--r--dbaccess/source/ui/app/subcomponentmanager.cxx48
-rw-r--r--dbaccess/source/ui/browser/genericcontroller.cxx50
-rw-r--r--dbaccess/source/ui/browser/sbagrid.cxx18
-rw-r--r--dbaccess/source/ui/browser/unodatbr.cxx70
-rw-r--r--dbaccess/source/ui/control/FieldDescControl.cxx6
-rw-r--r--dbaccess/source/ui/control/RelationControl.cxx36
-rw-r--r--dbaccess/source/ui/control/charsetlistbox.cxx6
-rw-r--r--dbaccess/source/ui/control/tabletree.cxx16
-rw-r--r--dbaccess/source/ui/dlg/DbAdminImpl.cxx75
-rw-r--r--dbaccess/source/ui/dlg/DriverSettings.cxx7
-rw-r--r--dbaccess/source/ui/dlg/advancedsettings.cxx48
-rw-r--r--dbaccess/source/ui/dlg/dbadmin.cxx7
-rw-r--r--dbaccess/source/ui/dlg/dbwizsetup.cxx15
-rw-r--r--dbaccess/source/ui/dlg/dsselect.cxx7
-rw-r--r--dbaccess/source/ui/dlg/generalpage.cxx8
-rw-r--r--dbaccess/source/ui/dlg/indexdialog.cxx48
-rw-r--r--dbaccess/source/ui/dlg/indexfieldscontrol.cxx10
-rw-r--r--dbaccess/source/ui/dlg/paramdialog.cxx14
-rw-r--r--dbaccess/source/ui/dlg/sqlmessage.cxx17
-rw-r--r--dbaccess/source/ui/inc/TableFieldDescription.hxx12
-rw-r--r--dbaccess/source/ui/misc/DExport.cxx36
-rw-r--r--dbaccess/source/ui/misc/RowSetDrop.cxx44
42 files changed, 395 insertions, 610 deletions
diff --git a/dbaccess/source/core/dataaccess/bookmarkcontainer.cxx b/dbaccess/source/core/dataaccess/bookmarkcontainer.cxx
index 5933753ade29..efd31622c215 100644
--- a/dbaccess/source/core/dataaccess/bookmarkcontainer.cxx
+++ b/dbaccess/source/core/dataaccess/bookmarkcontainer.cxx
@@ -245,13 +245,11 @@ Sequence< OUString > SAL_CALL OBookmarkContainer::getElementNames( )
Sequence< OUString > aNames(m_aBookmarks.size());
OUString* pNames = aNames.getArray();
- ;
- for ( MapIteratorVector::const_iterator aNameIter = m_aBookmarksIndexed.begin();
- aNameIter != m_aBookmarksIndexed.end();
- ++pNames, ++aNameIter
- )
+
+ for (auto const& bookmarkIndexed : m_aBookmarksIndexed)
{
- *pNames = (*aNameIter)->first;
+ *pNames = bookmarkIndexed->first;
+ ++pNames;
}
return aNames;
diff --git a/dbaccess/source/core/dataaccess/connection.cxx b/dbaccess/source/core/dataaccess/connection.cxx
index c0fc854971f5..c56b2e027b0a 100644
--- a/dbaccess/source/core/dataaccess/connection.cxx
+++ b/dbaccess/source/core/dataaccess/connection.cxx
@@ -457,10 +457,9 @@ void OConnection::disposing()
OSubComponent::disposing();
OConnectionWrapper::disposing();
- connectivity::OWeakRefArray::const_iterator aEnd = m_aStatements.end();
- for (connectivity::OWeakRefArray::const_iterator i = m_aStatements.begin(); aEnd != i; ++i)
+ for (auto const& statement : m_aStatements)
{
- Reference<XComponent> xComp(i->get(),UNO_QUERY);
+ Reference<XComponent> xComp(statement.get(),UNO_QUERY);
::comphelper::disposeComponent(xComp);
}
m_aStatements.clear();
@@ -473,10 +472,9 @@ void OConnection::disposing()
::comphelper::disposeComponent(m_xQueries);
- connectivity::OWeakRefArray::const_iterator aComposerEnd = m_aComposers.end();
- for (connectivity::OWeakRefArray::const_iterator j = m_aComposers.begin(); aComposerEnd != j; ++j)
+ for (auto const& composer : m_aComposers)
{
- Reference<XComponent> xComp(j->get(),UNO_QUERY);
+ Reference<XComponent> xComp(composer.get(),UNO_QUERY);
::comphelper::disposeComponent(xComp);
}
diff --git a/dbaccess/source/core/dataaccess/databasecontext.cxx b/dbaccess/source/core/dataaccess/databasecontext.cxx
index 0432b9a2e665..784bfe896537 100644
--- a/dbaccess/source/core/dataaccess/databasecontext.cxx
+++ b/dbaccess/source/core/dataaccess/databasecontext.cxx
@@ -275,13 +275,9 @@ void ODatabaseContext::disposing()
// dispose the data sources
// disposing seems to remove elements, so work on copy for valid iterators
ObjectCache objCopy(m_aDatabaseObjects);
- ObjectCache::const_iterator const aEnd = objCopy.end();
- for ( ObjectCache::const_iterator aIter = objCopy.begin();
- aIter != aEnd;
- ++aIter
- )
+ for (auto const& elem : objCopy)
{
- rtl::Reference< ODatabaseModelImpl > obj(aIter->second);
+ rtl::Reference< ODatabaseModelImpl > obj(elem.second);
// make sure obj is acquired and does not delete itself from within
// dispose()
obj->dispose();
diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx
index 388a95f4fe47..6d50cc1faa16 100644
--- a/dbaccess/source/core/dataaccess/databasedocument.cxx
+++ b/dbaccess/source/core/dataaccess/databasedocument.cxx
@@ -610,12 +610,9 @@ sal_Bool SAL_CALL ODatabaseDocument::wasModifiedSinceLastSave()
try
{
- for ( Controllers::const_iterator ctrl = m_aControllers.begin();
- ctrl != m_aControllers.end();
- ++ctrl
- )
+ for (auto const& controller : m_aControllers)
{
- if ( lcl_hasAnyModifiedSubComponent_throw( *ctrl ) )
+ if ( lcl_hasAnyModifiedSubComponent_throw(controller) )
return true;
}
}
@@ -800,12 +797,9 @@ void SAL_CALL ODatabaseDocument::connectController( const Reference< XController
DocumentGuard aGuard(*this, DocumentGuard::DefaultMethod);
#if OSL_DEBUG_LEVEL > 0
- for ( Controllers::const_iterator controller = m_aControllers.begin();
- controller != m_aControllers.end();
- ++controller
- )
+ for (auto const& controller : m_aControllers)
{
- OSL_ENSURE( *controller != _xController, "ODatabaseDocument::connectController: this controller is already connected!" );
+ OSL_ENSURE( controller != _xController, "ODatabaseDocument::connectController: this controller is already connected!" );
}
#endif
@@ -1429,15 +1423,14 @@ void ODatabaseDocument::impl_closeControllerFrames_nolck_throw( bool _bDeliverOw
{
Controllers aCopy = m_aControllers;
- Controllers::const_iterator aEnd = aCopy.end();
- for ( Controllers::const_iterator aIter = aCopy.begin(); aIter != aEnd ; ++aIter )
+ for (auto const& elem : aCopy)
{
- if ( !aIter->is() )
+ if ( !elem.is() )
continue;
try
{
- Reference< XCloseable> xFrame( (*aIter)->getFrame(), UNO_QUERY );
+ Reference< XCloseable> xFrame( elem->getFrame(), UNO_QUERY );
if ( xFrame.is() )
xFrame->close( _bDeliverOwnership );
}
diff --git a/dbaccess/source/core/dataaccess/definitioncontainer.cxx b/dbaccess/source/core/dataaccess/definitioncontainer.cxx
index 900aa0ae782d..7faf8186989f 100644
--- a/dbaccess/source/core/dataaccess/definitioncontainer.cxx
+++ b/dbaccess/source/core/dataaccess/definitioncontainer.cxx
@@ -98,13 +98,9 @@ ODefinitionContainer::ODefinitionContainer( const Reference< XComponentContext
m_pImpl->m_aProps.bIsFolder = true;
const ODefinitionContainer_Impl& rDefinitions( getDefinitions() );
- ODefinitionContainer_Impl::const_iterator aEnd = rDefinitions.end();
- for ( ODefinitionContainer_Impl::const_iterator aDefinition = rDefinitions.begin();
- aDefinition != aEnd;
- ++aDefinition
- )
+ for (auto const& definition : rDefinitions)
m_aDocuments.push_back(
- m_aDocumentMap.emplace(aDefinition->first, Documents::mapped_type() ).first );
+ m_aDocumentMap.emplace(definition.first, Documents::mapped_type() ).first );
}
@@ -120,12 +116,9 @@ void SAL_CALL ODefinitionContainer::disposing()
m_aContainerListeners.disposeAndClear(aEvt);
// dispose our elements
- Documents::const_iterator aIter = m_aDocumentMap.begin();
- Documents::const_iterator aEnd = m_aDocumentMap.end();
-
- for (; aIter != aEnd; ++aIter)
+ for (auto const& elem : m_aDocumentMap)
{
- Reference<XContent> xProp = aIter->second;
+ Reference<XContent> xProp = elem.second;
if ( xProp.is() )
{
removeObjectListener(xProp);
@@ -428,13 +421,10 @@ Sequence< OUString > SAL_CALL ODefinitionContainer::getElementNames( )
Sequence< OUString > aNames(m_aDocumentMap.size());
OUString* pNames = aNames.getArray();
- Documents::const_iterator aEnd = m_aDocumentMap.end();
- for ( Documents::const_iterator aNameIter = m_aDocumentMap.begin();
- aNameIter != aEnd;
- ++pNames, ++aNameIter
- )
+ for (auto const& elem : m_aDocumentMap)
{
- *pNames = aNameIter->first;
+ *pNames = elem.first;
+ ++pNames;
}
return aNames;
@@ -452,15 +442,13 @@ void SAL_CALL ODefinitionContainer::disposing( const EventObject& _rSource )
MutexGuard aGuard(m_aMutex);
Reference< XContent > xSource(_rSource.Source, UNO_QUERY);
// it's one of our documents ....
- Documents::iterator aIter = m_aDocumentMap.begin();
- Documents::const_iterator aEnd = m_aDocumentMap.end();
- for (;aIter != aEnd;++aIter )
+ for (auto & elem : m_aDocumentMap)
{
- if ( xSource == aIter->second.get() )
+ if ( xSource == elem.second.get() )
{
removeObjectListener(xSource);
// and clear our document map/vector, so the object will be recreated on next access
- aIter->second = Documents::mapped_type();
+ elem.second = Documents::mapped_type();
}
}
}
diff --git a/dbaccess/source/core/dataaccess/documentcontainer.cxx b/dbaccess/source/core/dataaccess/documentcontainer.cxx
index 6416074e4aea..ba9d44f70aa7 100644
--- a/dbaccess/source/core/dataaccess/documentcontainer.cxx
+++ b/dbaccess/source/core/dataaccess/documentcontainer.cxx
@@ -651,11 +651,9 @@ void ODocumentContainer::getPropertyDefaultByHandle( sal_Int32 /*_nHandle*/, Any
void SAL_CALL ODocumentContainer::commit( )
{
MutexGuard aGuard(m_aMutex);
- Documents::const_iterator aIter = m_aDocumentMap.begin();
- Documents::const_iterator aEnd = m_aDocumentMap.end();
- for (; aIter != aEnd ; ++aIter)
+ for (auto const& elem : m_aDocumentMap)
{
- Reference<XTransactedObject> xTrans(aIter->second.get(),UNO_QUERY);
+ Reference<XTransactedObject> xTrans(elem.second.get(),UNO_QUERY);
if ( xTrans.is() )
xTrans->commit();
}
@@ -667,11 +665,9 @@ void SAL_CALL ODocumentContainer::commit( )
void SAL_CALL ODocumentContainer::revert( )
{
MutexGuard aGuard(m_aMutex);
- Documents::const_iterator aIter = m_aDocumentMap.begin();
- Documents::const_iterator aEnd = m_aDocumentMap.end();
- for (; aIter != aEnd ; ++aIter)
+ for (auto const& elem : m_aDocumentMap)
{
- Reference<XTransactedObject> xTrans(aIter->second.get(),UNO_QUERY);
+ Reference<XTransactedObject> xTrans(elem.second.get(),UNO_QUERY);
if ( xTrans.is() )
xTrans->revert();
}
diff --git a/dbaccess/source/core/dataaccess/myucp_datasupplier.cxx b/dbaccess/source/core/dataaccess/myucp_datasupplier.cxx
index 6f1d6e67e55c..258e00c10a6a 100644
--- a/dbaccess/source/core/dataaccess/myucp_datasupplier.cxx
+++ b/dbaccess/source/core/dataaccess/myucp_datasupplier.cxx
@@ -75,13 +75,9 @@ struct DataSupplier_Impl
DataSupplier_Impl::~DataSupplier_Impl()
{
- ResultList::const_iterator it = m_aResults.begin();
- ResultList::const_iterator end = m_aResults.end();
-
- while ( it != end )
+ for (auto const& result : m_aResults)
{
- delete *it;
- ++it;
+ delete result;
}
}
diff --git a/dbaccess/source/core/misc/DatabaseDataProvider.cxx b/dbaccess/source/core/misc/DatabaseDataProvider.cxx
index 618331c61c06..50bc73bb52f4 100644
--- a/dbaccess/source/core/misc/DatabaseDataProvider.cxx
+++ b/dbaccess/source/core/misc/DatabaseDataProvider.cxx
@@ -727,20 +727,18 @@ void DatabaseDataProvider::impl_fillInternalDataProvider_throw(bool _bHasCategor
uno::Reference< sdbc::XResultSetMetaDataSupplier > xSuppMeta( m_xRowSet,uno::UNO_QUERY_THROW );
uno::Reference< sdbc::XColumnLocate > xColumnLocate( m_xRowSet, uno::UNO_QUERY_THROW );
- for ( ColumnDescriptions::iterator col = aColumns.begin();
- col != aColumns.end();
- ++col
- )
+ sal_Int32 columnIndex = 0;
+ for (auto & column : aColumns)
{
- col->nResultSetPosition = xColumnLocate->findColumn( col->sName );
+ column.nResultSetPosition = xColumnLocate->findColumn( column.sName );
- const uno::Reference< beans::XPropertySet > xColumn( xColumns->getByName( col->sName ), uno::UNO_QUERY_THROW );
+ const uno::Reference< beans::XPropertySet > xColumn( xColumns->getByName( column.sName ), uno::UNO_QUERY_THROW );
const uno::Any aNumberFormat( xColumn->getPropertyValue( PROPERTY_NUMBERFORMAT ) );
- OSL_VERIFY( xColumn->getPropertyValue( PROPERTY_TYPE ) >>= col->nDataType );
+ OSL_VERIFY( xColumn->getPropertyValue( PROPERTY_TYPE ) >>= column.nDataType );
- const sal_Int32 columnIndex = col - aColumns.begin();
const OUString sRangeName = OUString::number( columnIndex );
m_aNumberFormats.emplace( sRangeName, aNumberFormat );
+ ++columnIndex;
}
std::vector< OUString > aRowLabels;
@@ -755,15 +753,17 @@ void DatabaseDataProvider::impl_fillInternalDataProvider_throw(bool _bHasCategor
aRowLabels.push_back( aValue.getString() );
std::vector< double > aRow;
- for ( ColumnDescriptions::const_iterator col = aColumns.begin();
- col != aColumns.end();
- ++col
- )
+ bool bFirstLoop = true;
+ for (auto const& column : aColumns)
{
- if ( bFirstColumnIsCategory && ( col == aColumns.begin() ) )
- continue;
+ if (bFirstLoop)
+ {
+ bFirstLoop = false;
+ if (bFirstColumnIsCategory)
+ continue;
+ }
- aValue.fill( col->nResultSetPosition, col->nDataType, xRow );
+ aValue.fill( column.nResultSetPosition, column.nDataType, xRow );
if ( aValue.isNull() )
{
double nValue;
diff --git a/dbaccess/source/core/misc/PropertyForward.cxx b/dbaccess/source/core/misc/PropertyForward.cxx
index 326be3059883..6d3527685981 100644
--- a/dbaccess/source/core/misc/PropertyForward.cxx
+++ b/dbaccess/source/core/misc/PropertyForward.cxx
@@ -53,10 +53,8 @@ namespace dbaccess
_xSource->addPropertyChangeListener( OUString(), this );
else
{
- std::vector< OUString >::const_iterator aIter = _aPropertyList.begin();
- std::vector< OUString >::const_iterator aEnd = _aPropertyList.end();
- for (; aIter != aEnd ; ++aIter )
- _xSource->addPropertyChangeListener( *aIter, this );
+ for (auto const& property : _aPropertyList)
+ _xSource->addPropertyChangeListener(property, this);
}
}
catch( const Exception& )
diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx
index 194aff4717ab..361208c161d5 100644
--- a/dbaccess/source/core/misc/dsntypes.cxx
+++ b/dbaccess/source/core/misc/dsntypes.cxx
@@ -84,21 +84,19 @@ OUString ODsnTypeCollection::cutPrefix(const OUString& _sURL) const
{
OUString sRet;
OUString sOldPattern;
- StringVector::const_iterator aIter = m_aDsnPrefixes.begin();
- StringVector::const_iterator aEnd = m_aDsnPrefixes.end();
- for(;aIter != aEnd;++aIter)
+ for (auto const& dsnPrefix : m_aDsnPrefixes)
{
- WildCard aWildCard(*aIter);
- if ( sOldPattern.getLength() < aIter->getLength() && aWildCard.Matches(_sURL) )
+ WildCard aWildCard(dsnPrefix);
+ if ( sOldPattern.getLength() < dsnPrefix.getLength() && aWildCard.Matches(_sURL) )
{
// This relies on the fact that all patterns are of the form
// foo*
// that is, the very concept of "prefix" applies.
- OUString prefix(comphelper::string::stripEnd(*aIter, '*'));
+ OUString prefix(comphelper::string::stripEnd(dsnPrefix, '*'));
OSL_ENSURE(prefix.getLength() <= _sURL.getLength(), "How can A match B when A shorter than B?");
sRet = _sURL.copy(prefix.getLength());
- sOldPattern = *aIter;
+ sOldPattern = dsnPrefix;
}
}
@@ -109,19 +107,17 @@ OUString ODsnTypeCollection::getPrefix(const OUString& _sURL) const
{
OUString sRet;
OUString sOldPattern;
- StringVector::const_iterator aIter = m_aDsnPrefixes.begin();
- StringVector::const_iterator aEnd = m_aDsnPrefixes.end();
- for(;aIter != aEnd;++aIter)
+ for (auto const& dsnPrefix : m_aDsnPrefixes)
{
- WildCard aWildCard(*aIter);
- if ( sOldPattern.getLength() < aIter->getLength() && aWildCard.Matches(_sURL) )
+ WildCard aWildCard(dsnPrefix);
+ if ( sOldPattern.getLength() < dsnPrefix.getLength() && aWildCard.Matches(_sURL) )
{
// This relies on the fact that all patterns are of the form
// foo*
// that is, the very concept of "prefix" applies.
- sRet = comphelper::string::stripEnd(*aIter, '*');
+ sRet = comphelper::string::stripEnd(dsnPrefix, '*');
OSL_ENSURE(sRet.getLength() <= _sURL.getLength(), "How can A match B when A shorter than B?");
- sOldPattern = *aIter;
+ sOldPattern = dsnPrefix;
}
}
@@ -138,15 +134,13 @@ bool ODsnTypeCollection::isConnectionUrlRequired(const OUString& _sURL) const
{
OUString sRet;
OUString sOldPattern;
- StringVector::const_iterator aIter = m_aDsnPrefixes.begin();
- StringVector::const_iterator aEnd = m_aDsnPrefixes.end();
- for(;aIter != aEnd;++aIter)
+ for (auto const& dsnPrefix : m_aDsnPrefixes)
{
- WildCard aWildCard(*aIter);
- if ( sOldPattern.getLength() < aIter->getLength() && aWildCard.Matches(_sURL) )
+ WildCard aWildCard(dsnPrefix);
+ if ( sOldPattern.getLength() < dsnPrefix.getLength() && aWildCard.Matches(_sURL) )
{
- sRet = *aIter;
- sOldPattern = *aIter;
+ sRet = dsnPrefix;
+ sOldPattern = dsnPrefix;
}
}
return sRet.getLength() > 0 && sRet[sRet.getLength()-1] == '*';
@@ -487,14 +481,12 @@ void ODsnTypeCollection::fillPageIds(const OUString& _sURL,std::vector<sal_Int16
OUString ODsnTypeCollection::getType(const OUString& _sURL) const
{
OUString sOldPattern;
- StringVector::const_iterator aIter = m_aDsnPrefixes.begin();
- StringVector::const_iterator aEnd = m_aDsnPrefixes.end();
- for(;aIter != aEnd;++aIter)
+ for (auto const& dsnPrefix : m_aDsnPrefixes)
{
- WildCard aWildCard(*aIter);
- if ( sOldPattern.getLength() < aIter->getLength() && aWildCard.Matches(_sURL) )
+ WildCard aWildCard(dsnPrefix);
+ if ( sOldPattern.getLength() < dsnPrefix.getLength() && aWildCard.Matches(_sURL) )
{
- sOldPattern = *aIter;
+ sOldPattern = dsnPrefix;
}
}
return sOldPattern;
@@ -504,16 +496,16 @@ sal_Int32 ODsnTypeCollection::getIndexOf(const OUString& _sURL) const
{
sal_Int32 nRet = -1;
OUString sOldPattern;
- StringVector::const_iterator aIter = m_aDsnPrefixes.begin();
- StringVector::const_iterator aEnd = m_aDsnPrefixes.end();
- for(sal_Int32 i = 0;aIter != aEnd;++aIter,++i)
+ sal_Int32 i = 0;
+ for (auto const& dsnPrefix : m_aDsnPrefixes)
{
- WildCard aWildCard(*aIter);
- if ( sOldPattern.getLength() < aIter->getLength() && aWildCard.Matches(_sURL) )
+ WildCard aWildCard(dsnPrefix);
+ if ( sOldPattern.getLength() < dsnPrefix.getLength() && aWildCard.Matches(_sURL) )
{
nRet = i;
- sOldPattern = *aIter;
+ sOldPattern = dsnPrefix;
}
+ ++i;
}
return nRet;
diff --git a/dbaccess/source/core/recovery/dbdocrecovery.cxx b/dbaccess/source/core/recovery/dbdocrecovery.cxx
index 847dee39c9a0..8e91ddeea5ef 100644
--- a/dbaccess/source/core/recovery/dbdocrecovery.cxx
+++ b/dbaccess/source/core/recovery/dbdocrecovery.cxx
@@ -104,13 +104,10 @@ namespace dbaccess
aTextOutput.writeLine( "[storages]" );
- for ( MapStringToCompDesc::const_iterator stor = i_mapStorageToCompDesc.begin();
- stor != i_mapStorageToCompDesc.end();
- ++stor
- )
+ for (auto const& elem : i_mapStorageToCompDesc)
{
OUStringBuffer aLine;
- lcl_getPersistentRepresentation( *stor, aLine );
+ lcl_getPersistentRepresentation(elem, aLine);
aTextOutput.writeLine( aLine.makeStringAndClear() );
}
@@ -242,12 +239,9 @@ namespace dbaccess
MapCompTypeToCompDescs aMapCompDescs;
- for ( std::vector< Reference< XController > >::const_iterator ctrl = i_rControllers.begin();
- ctrl != i_rControllers.end();
- ++ctrl
- )
+ for (auto const& controller : i_rControllers)
{
- Reference< XDatabaseDocumentUI > xDatabaseUI( *ctrl, UNO_QUERY_THROW );
+ Reference< XDatabaseDocumentUI > xDatabaseUI(controller, UNO_QUERY_THROW);
Sequence< Reference< XComponent > > aComponents( xDatabaseUI->getSubComponents() );
for ( auto const & component : aComponents )
@@ -257,14 +251,11 @@ namespace dbaccess
}
}
- for ( MapCompTypeToCompDescs::const_iterator map = aMapCompDescs.begin();
- map != aMapCompDescs.end();
- ++map
- )
+ for (auto const& elem : aMapCompDescs)
{
Reference< XStorage > xComponentsStor( xRecoveryStorage->openStorageElement(
- SubComponentRecovery::getComponentsStorageName( map->first ), ElementModes::WRITE | ElementModes::NOCREATE ) );
- lcl_writeObjectMap_throw( m_pData->aContext, xComponentsStor, map->second );
+ SubComponentRecovery::getComponentsStorageName( elem.first ), ElementModes::WRITE | ElementModes::NOCREATE ) );
+ lcl_writeObjectMap_throw( m_pData->aContext, xComponentsStor, elem.second );
tools::stor::commitStorageIfWriteable( xComponentsStor );
}
}
@@ -301,29 +292,23 @@ namespace dbaccess
}
// recover all sub components as indicated by the map
- for ( MapCompTypeToCompDescs::const_iterator map = aMapCompDescs.begin();
- map != aMapCompDescs.end();
- ++map
- )
+ for (auto const& elemMapCompDescs : aMapCompDescs)
{
- const SubComponentType eComponentType = map->first;
+ const SubComponentType eComponentType = elemMapCompDescs.first;
// the storage for all components of the current type
Reference< XStorage > xComponentsStor( xRecoveryStorage->openStorageElement(
SubComponentRecovery::getComponentsStorageName( eComponentType ), ElementModes::READ ), UNO_QUERY_THROW );
// loop through all components of this type
- for ( MapStringToCompDesc::const_iterator stor = map->second.begin();
- stor != map->second.end();
- ++stor
- )
+ for (auto const& elem : elemMapCompDescs.second)
{
- const OUString sComponentName( stor->second.sName );
- if ( !xComponentsStor->hasByName( stor->first ) )
+ const OUString sComponentName(elem.second.sName);
+ if ( !xComponentsStor->hasByName(elem.first) )
{
SAL_WARN( "dbaccess",
"DatabaseDocumentRecovery::recoverSubDocuments: inconsistent recovery storage: storage '" <<
- stor->first <<
+ elem.first <<
"' not found in '" <<
SubComponentRecovery::getComponentsStorageName( eComponentType ) <<
"', but required per map file!" );
@@ -335,9 +320,9 @@ namespace dbaccess
xDocumentUI->connect();
// recover the single component
- Reference< XStorage > xCompStor( xComponentsStor->openStorageElement( stor->first, ElementModes::READ ) );
+ Reference< XStorage > xCompStor( xComponentsStor->openStorageElement( elem.first, ElementModes::READ ) );
SubComponentRecovery aComponentRecovery( m_pData->aContext, xDocumentUI, eComponentType );
- Reference< XComponent > xSubComponent( aComponentRecovery.recoverFromStorage( xCompStor, sComponentName, stor->second.bForEditing ) );
+ Reference< XComponent > xSubComponent( aComponentRecovery.recoverFromStorage( xCompStor, sComponentName, elem.second.bForEditing ) );
// at the moment, we only store, during session save, sub components which are modified. So, set this
// recovered sub component to "modified", too.
diff --git a/dbaccess/source/ext/macromigration/migrationengine.cxx b/dbaccess/source/ext/macromigration/migrationengine.cxx
index f98d71a7fe49..75741516a5de 100644
--- a/dbaccess/source/ext/macromigration/migrationengine.cxx
+++ b/dbaccess/source/ext/macromigration/migrationengine.cxx
@@ -929,12 +929,9 @@ namespace dbmm
m_rProgress.start( nOverallRange );
- for ( SubDocuments::const_iterator doc = m_aSubDocs.begin();
- doc != m_aSubDocs.end();
- ++doc
- )
+ sal_Int32 nOverallProgressValue = 1;
+ for (auto const& subDoc : m_aSubDocs)
{
- sal_Int32 nOverallProgressValue( doc - m_aSubDocs.begin() + 1 );
// update overall progress text
OUString sOverallProgress(
sProgressSkeleton.replaceFirst("$current$",
@@ -942,11 +939,12 @@ namespace dbmm
m_rProgress.setOverallProgressText( sOverallProgress );
// migrate document
- if ( !impl_handleDocument_nothrow( *doc ) )
+ if ( !impl_handleDocument_nothrow(subDoc) )
return false;
// update overall progress value
m_rProgress.setOverallProgressValue( nOverallProgressValue );
+ ++nOverallProgressValue;
}
// commit the root storage of the database document, for all changes made so far to take effect
diff --git a/dbaccess/source/ext/macromigration/migrationlog.cxx b/dbaccess/source/ext/macromigration/migrationlog.cxx
index a046a68c6ae9..6a0b71b12bfe 100644
--- a/dbaccess/source/ext/macromigration/migrationlog.cxx
+++ b/dbaccess/source/ext/macromigration/migrationlog.cxx
@@ -117,12 +117,11 @@ namespace dbmm
{
#if OSL_DEBUG_LEVEL > 0
bool bAlreadyKnown = false;
- for ( DocumentLogs::const_iterator doc = m_pData->aDocumentLogs.begin();
- doc != m_pData->aDocumentLogs.end() && !bAlreadyKnown;
- ++doc
- )
+ for (auto const& documentLog : m_pData->aDocumentLogs)
{
- bAlreadyKnown = ( doc->second.eType == _eType ) && ( doc->second.sName == _rName );
+ bAlreadyKnown = ( documentLog.second.eType == _eType ) && ( documentLog.second.sName == _rName );
+ if (bAlreadyKnown)
+ break;
}
OSL_ENSURE( !bAlreadyKnown, "MigrationLog::startedDocument: document is already known!" );
#endif
@@ -165,15 +164,12 @@ namespace dbmm
}
const DocumentEntry& rDocEntry( docPos->second );
- for ( std::vector< LibraryEntry >::const_iterator lib = rDocEntry.aMovedLibraries.begin();
- lib != rDocEntry.aMovedLibraries.end();
- ++lib
- )
+ for (auto const& elem : rDocEntry.aMovedLibraries)
{
- if ( ( _eScriptType == lib->eType )
- && ( _rOriginalLibName == lib->sOldName )
+ if ( ( _eScriptType == elem.eType )
+ && ( _rOriginalLibName == elem.sOldName )
)
- return lib->sNewName;
+ return elem.sNewName;
}
OSL_FAIL( "MigrationLog::getNewLibraryName: doc is known, but library isn't!" );
@@ -348,21 +344,18 @@ namespace dbmm
OUString sException( DBA_RES( STR_EXCEPTION ) );
- for ( ErrorLog::const_iterator error = _rErrors.begin();
- error != _rErrors.end();
- ++error
- )
+ for (auto const& error : _rErrors)
{
_rBuffer.append( '-' );
_rBuffer.append( ' ' );
- lcl_appendErrorDescription( _rBuffer, *error );
+ lcl_appendErrorDescription(_rBuffer, error);
_rBuffer.append( '\n' );
- if ( !error->aCaughtException.hasValue() )
+ if ( !error.aCaughtException.hasValue() )
continue;
_rBuffer.append( sException );
- _rBuffer.append( ::comphelper::anyToString( error->aCaughtException ) );
+ _rBuffer.append( ::comphelper::anyToString( error.aCaughtException ) );
_rBuffer.append( '\n' );
_rBuffer.append( '\n' );
}
@@ -402,12 +395,9 @@ namespace dbmm
{
OUString sMovedLibTemplate( DBA_RES( STR_MOVED_LIBRARY ) );
- for ( DocumentLogs::const_iterator doc = m_pData->aDocumentLogs.begin();
- doc != m_pData->aDocumentLogs.end();
- ++doc
- )
+ for (auto const& documentLog : m_pData->aDocumentLogs)
{
- const DocumentEntry& rDoc( doc->second );
+ const DocumentEntry& rDoc( documentLog.second );
if ( rDoc.aMovedLibraries.empty() )
continue;
@@ -417,15 +407,12 @@ namespace dbmm
aBuffer.append( "=== " + sDocTitle + " ===\n" );
- for ( std::vector< LibraryEntry >::const_iterator lib = rDoc.aMovedLibraries.begin();
- lib != rDoc.aMovedLibraries.end();
- ++lib
- )
+ for (auto const& elem : rDoc.aMovedLibraries)
{
OUString sMovedLib( sMovedLibTemplate );
- sMovedLib = sMovedLib.replaceAll( "$type$", getScriptTypeDisplayName( lib->eType ) );
- sMovedLib = sMovedLib.replaceAll( "$old$", lib->sOldName );
- sMovedLib = sMovedLib.replaceAll( "$new$", lib->sNewName );
+ sMovedLib = sMovedLib.replaceAll( "$type$", getScriptTypeDisplayName( elem.eType ) );
+ sMovedLib = sMovedLib.replaceAll( "$old$", elem.sOldName );
+ sMovedLib = sMovedLib.replaceAll( "$new$", elem.sNewName );
aBuffer.append( sMovedLib + "\n" );
}
diff --git a/dbaccess/source/ext/macromigration/progressmixer.cxx b/dbaccess/source/ext/macromigration/progressmixer.cxx
index 60318112bdb0..9a75db868b15 100644
--- a/dbaccess/source/ext/macromigration/progressmixer.cxx
+++ b/dbaccess/source/ext/macromigration/progressmixer.cxx
@@ -97,16 +97,13 @@ namespace dbmm
// tell the single phases their "overall starting point"
PhaseWeight nRunningWeight( 0 );
- for ( Phases::iterator phase = _rData.aPhases.begin();
- phase != _rData.aPhases.end();
- ++phase
- )
+ for (auto & phase : _rData.aPhases)
{
- phase->second.nGlobalStart = static_cast<sal_uInt32>( nRunningWeight * _rData.nOverallStretch );
- nRunningWeight += phase->second.nWeight;
+ phase.second.nGlobalStart = static_cast<sal_uInt32>( nRunningWeight * _rData.nOverallStretch );
+ nRunningWeight += phase.second.nWeight;
sal_uInt32 nNextPhaseStart = static_cast<sal_uInt32>( nRunningWeight * _rData.nOverallStretch );
- phase->second.nGlobalRange = nNextPhaseStart - phase->second.nGlobalStart;
+ phase.second.nGlobalRange = nNextPhaseStart - phase.second.nGlobalStart;
}
_rData.rConsumer.start( OVERALL_RANGE );
diff --git a/dbaccess/source/filter/hsqldb/createparser.cxx b/dbaccess/source/filter/hsqldb/createparser.cxx
index 8e7f12391e0f..bbc9bd755f8a 100644
--- a/dbaccess/source/filter/hsqldb/createparser.cxx
+++ b/dbaccess/source/filter/hsqldb/createparser.cxx
@@ -73,9 +73,9 @@ std::vector<OUString> lcl_splitColumnPart(const OUString& sColumnPart)
std::vector<OUString> sReturn;
OUStringBuffer current;
- for (auto it = sParts.begin(); it != sParts.end(); ++it)
+ for (auto const& part : sParts)
{
- current.append(*it);
+ current.append(part);
if (current.lastIndexOf("(") > current.lastIndexOf(")"))
current.append(","); // it was false split
else
diff --git a/dbaccess/source/filter/xml/xmlAutoStyle.cxx b/dbaccess/source/filter/xml/xmlAutoStyle.cxx
index cfa5829f2ad5..c9e328867b7a 100644
--- a/dbaccess/source/filter/xml/xmlAutoStyle.cxx
+++ b/dbaccess/source/filter/xml/xmlAutoStyle.cxx
@@ -39,24 +39,22 @@ void OXMLAutoStylePoolP::exportStyleAttributes(
if ( nFamily == XML_STYLE_FAMILY_TABLE_COLUMN )
{
rtl::Reference< XMLPropertySetMapper > aPropMapper = rODBExport.GetColumnStylesPropertySetMapper();
- std::vector< XMLPropertyState >::const_iterator i = rProperties.begin();
- std::vector< XMLPropertyState >::const_iterator aEnd = rProperties.end();
- for ( ; i != aEnd ; ++i )
+ for (auto const& property : rProperties)
{
- sal_Int16 nContextID = aPropMapper->GetEntryContextId(i->mnIndex);
+ sal_Int16 nContextID = aPropMapper->GetEntryContextId(property.mnIndex);
switch (nContextID)
{
case CTF_DB_NUMBERFORMAT :
{
sal_Int32 nNumberFormat = 0;
- if ( i->maValue >>= nNumberFormat )
+ if ( property.maValue >>= nNumberFormat )
{
OUString sAttrValue = rODBExport.getDataStyleName(nNumberFormat);
if ( !sAttrValue.isEmpty() )
{
GetExport().AddAttribute(
- aPropMapper->GetEntryNameSpace(i->mnIndex),
- aPropMapper->GetEntryXMLName(i->mnIndex),
+ aPropMapper->GetEntryNameSpace(property.mnIndex),
+ aPropMapper->GetEntryXMLName(property.mnIndex),
sAttrValue );
}
}
diff --git a/dbaccess/source/filter/xml/xmlExport.cxx b/dbaccess/source/filter/xml/xmlExport.cxx
index 5c7bfb047e67..29ecde32b0ce 100644
--- a/dbaccess/source/filter/xml/xmlExport.cxx
+++ b/dbaccess/source/filter/xml/xmlExport.cxx
@@ -1176,29 +1176,26 @@ void ODBExport::exportAutoStyle(XPropertySet* _xProp)
std::vector< XMLPropertyState > aPropStates = i.first->Filter( _xProp );
if ( !aPropStates.empty() )
{
- std::vector< XMLPropertyState >::iterator aItr = aPropStates.begin();
- std::vector< XMLPropertyState >::const_iterator aEnd = aPropStates.end();
const rtl::Reference < XMLPropertySetMapper >& pStyle = i.first->getPropertySetMapper();
- while ( aItr != aEnd )
+ for (auto & propState : aPropStates)
{
- if ( aItr->mnIndex != -1 )
+ if ( propState.mnIndex != -1 )
{
- switch ( pStyle->GetEntryContextId(aItr->mnIndex) )
+ switch ( pStyle->GetEntryContextId(propState.mnIndex) )
{
case CTF_DB_NUMBERFORMAT:
{
sal_Int32 nNumberFormat = -1;
- if ( aItr->maValue >>= nNumberFormat )
+ if ( propState.maValue >>= nNumberFormat )
addDataStyle(nNumberFormat);
}
break;
case CTF_DB_COLUMN_TEXT_ALIGN:
- if ( !aItr->maValue.hasValue() )
- aItr->maValue <<= css::awt::TextAlign::LEFT;
+ if ( !propState.maValue.hasValue() )
+ propState.maValue <<= css::awt::TextAlign::LEFT;
break;
}
}
- ++aItr;
}
}
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx
index d5339f785a0d..c0cc5dded3b9 100644
--- a/dbaccess/source/ui/app/AppController.cxx
+++ b/dbaccess/source/ui/app/AppController.cxx
@@ -769,12 +769,11 @@ FeatureState OApplicationController::GetState(sal_uInt16 _nId) const
std::vector< OUString > aSelected;
getSelectionElementNames( aSelected );
bool bAlterableViews = true;
- for ( std::vector< OUString >::const_iterator selectedName = aSelected.begin();
- bAlterableViews && ( selectedName != aSelected.end() ) ;
- ++selectedName
- )
+ for (auto const& selectedName : aSelected)
{
- bAlterableViews &= impl_isAlterableView_nothrow( *selectedName );
+ bAlterableViews &= impl_isAlterableView_nothrow(selectedName);
+ if (!bAlterableViews)
+ break;
}
aReturn.bEnabled = bAlterableViews;
}
@@ -1047,9 +1046,8 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa
ScopedVclPtr<SfxAbstractPasteDialog> pDlg(pFact->CreatePasteDialog( getView() ));
std::vector<SotClipboardFormatId> aFormatIds;
getSupportedFormats(getContainer()->getElementType(),aFormatIds);
- const std::vector<SotClipboardFormatId>::const_iterator aEnd = aFormatIds.end();
- for (std::vector<SotClipboardFormatId>::const_iterator aIter = aFormatIds.begin();aIter != aEnd; ++aIter)
- pDlg->Insert(*aIter,"");
+ for (auto const& formatId : aFormatIds)
+ pDlg->Insert(formatId,"");
const TransferableDataHelper& rClipboard = getViewClipboard();
pasteFormat(pDlg->GetFormat(rClipboard.GetTransferable()));
@@ -2788,18 +2786,15 @@ sal_Bool SAL_CALL OApplicationController::select( const Any& _aSelection )
}
}
}
- for ( SelectionByElementType::const_iterator sel = aSelectedElements.begin();
- sel != aSelectedElements.end();
- ++sel
- )
+ for (auto const& selectedElement : aSelectedElements)
{
- if ( sel->first == m_eCurrentType )
+ if ( selectedElement.first == m_eCurrentType )
{
- getContainer()->selectElements( comphelper::containerToSequence(sel->second) );
+ getContainer()->selectElements( comphelper::containerToSequence(selectedElement.second) );
}
else
{
- m_aPendingSelection[ sel->first ] = sel->second;
+ m_aPendingSelection[ selectedElement.first ] = selectedElement.second;
}
}
diff --git a/dbaccess/source/ui/app/AppControllerGen.cxx b/dbaccess/source/ui/app/AppControllerGen.cxx
index 99a04d7b76e7..98daf558b3cf 100644
--- a/dbaccess/source/ui/app/AppControllerGen.cxx
+++ b/dbaccess/source/ui/app/AppControllerGen.cxx
@@ -690,15 +690,14 @@ void OApplicationController::doAction(sal_uInt16 _nId, const ElementOpenMode _eO
}
std::vector< std::pair< OUString ,Reference< XModel > > > aComponents;
- std::vector< OUString>::const_iterator aEnd = aList.end();
- for (std::vector< OUString>::const_iterator aIter = aList.begin(); aIter != aEnd; ++aIter)
+ for (auto const& elem : aList)
{
if ( SID_DB_APP_CONVERTTOVIEW == _nId )
- convertToView(*aIter);
+ convertToView(elem);
else
{
- Reference< XModel > xModel( openElementWithArguments( *aIter, eType, eOpenMode, _nId,aArguments ), UNO_QUERY );
- aComponents.emplace_back( *aIter, xModel );
+ Reference< XModel > xModel( openElementWithArguments( elem, eType, eOpenMode, _nId,aArguments ), UNO_QUERY );
+ aComponents.emplace_back( elem, xModel );
}
}
@@ -706,19 +705,19 @@ void OApplicationController::doAction(sal_uInt16 _nId, const ElementOpenMode _eO
if ( _eOpenMode == E_OPEN_FOR_MAIL )
{
- std::vector< std::pair< OUString ,Reference< XModel > > >::const_iterator componentIter = aComponents.begin();
- std::vector< std::pair< OUString ,Reference< XModel > > >::const_iterator componentEnd = aComponents.end();
SfxMailModel aSendMail;
SfxMailModel::SendMailResult eResult = SfxMailModel::SEND_MAIL_OK;
- for (; componentIter != componentEnd && SfxMailModel::SEND_MAIL_OK == eResult; ++componentIter)
+ for (auto const& component : aComponents)
{
try
{
- Reference< XModel > xModel(componentIter->second,UNO_QUERY);
+ Reference< XModel > xModel(component.second,UNO_QUERY);
// Send document as e-Mail using stored/default type
- eResult = aSendMail.AttachDocument(xModel,componentIter->first);
+ eResult = aSendMail.AttachDocument(xModel,component.first);
::comphelper::disposeComponent(xModel);
+ if (eResult != SfxMailModel::SEND_MAIL_OK)
+ break;
}
catch(const Exception&)
{
diff --git a/dbaccess/source/ui/app/AppDetailView.cxx b/dbaccess/source/ui/app/AppDetailView.cxx
index e66afd50f6af..e42ca5a4df06 100644
--- a/dbaccess/source/ui/app/AppDetailView.cxx
+++ b/dbaccess/source/ui/app/AppDetailView.cxx
@@ -472,9 +472,11 @@ void OTasksWindow::fillTaskEntryList( const TaskEntryList& _rList )
// copy the commands so we can use them with the config managers
Sequence< OUString > aCommands( _rList.size() );
OUString* pCommands = aCommands.getArray();
- TaskEntryList::const_iterator aEnd = _rList.end();
- for ( TaskEntryList::const_iterator pCopyTask = _rList.begin(); pCopyTask != aEnd; ++pCopyTask, ++pCommands )
- *pCommands = pCopyTask->sUNOCommand;
+ for (auto const& copyTask : _rList)
+ {
+ *pCommands = copyTask.sUNOCommand;
+ ++pCommands;
+ }
Sequence< Reference< XGraphic> > aImages = xImageMgr->getImages(
ImageType::SIZE_DEFAULT | ImageType::COLOR_NORMAL ,
@@ -483,14 +485,15 @@ void OTasksWindow::fillTaskEntryList( const TaskEntryList& _rList )
const Reference< XGraphic >* pImages( aImages.getConstArray() );
- for ( TaskEntryList::const_iterator pTask = _rList.begin(); pTask != aEnd; ++pTask, ++pImages )
+ for (auto const& task : _rList)
{
- SvTreeListEntry* pEntry = m_aCreation->InsertEntry( pTask->sTitle );
- pEntry->SetUserData( new TaskEntry( *pTask ) );
+ SvTreeListEntry* pEntry = m_aCreation->InsertEntry(task.sTitle);
+ pEntry->SetUserData( new TaskEntry(task) );
Image aImage( *pImages );
m_aCreation->SetExpandedEntryBmp( pEntry, aImage );
m_aCreation->SetCollapsedEntryBmp( pEntry, aImage );
+ ++pImages;
}
}
catch(Exception&)
@@ -717,12 +720,9 @@ void OApplicationDetailView::impl_fillTaskPaneData( ElementType _eType, TaskPane
}
// for the remaining entries, assign mnemonics
- for ( TaskEntryList::const_iterator pTask = rList.begin();
- pTask != rList.end();
- ++pTask
- )
+ for (auto const& task : rList)
{
- aAllMnemonics.CreateMnemonic( pTask->sTitle );
+ aAllMnemonics.CreateMnemonic(task.sTitle);
// don't do this for now, until our task window really supports mnemonics
}
}
diff --git a/dbaccess/source/ui/app/subcomponentmanager.cxx b/dbaccess/source/ui/app/subcomponentmanager.cxx
index 0ede91bdbabc..493339887d9c 100644
--- a/dbaccess/source/ui/app/subcomponentmanager.cxx
+++ b/dbaccess/source/ui/app/subcomponentmanager.cxx
@@ -337,25 +337,22 @@ namespace dbaui
return;
// find the sub component whose name changed
- for ( SubComponents::iterator comp = m_pData->m_aComponents.begin();
- comp != m_pData->m_aComponents.end();
- ++comp
- )
+ for (auto & component : m_pData->m_aComponents)
{
- if ( comp->xDocumentDefinitionProperties != i_rEvent.Source )
+ if ( component.xDocumentDefinitionProperties != i_rEvent.Source )
continue;
OUString sNewName;
OSL_VERIFY( i_rEvent.NewValue >>= sNewName );
#if OSL_DEBUG_LEVEL > 0
- OUString sOldKnownName( comp->sName );
+ OUString sOldKnownName( component.sName );
OUString sOldName;
OSL_VERIFY( i_rEvent.OldValue >>= sOldName );
OSL_ENSURE( sOldName == sOldKnownName, "SubComponentManager::propertyChange: inconsistency in the old names!" );
#endif
- comp->sName = sNewName;
+ component.sName = sNewName;
break;
}
}
@@ -430,12 +427,9 @@ namespace dbaui
try
{
SubComponents aWorkingCopy( m_pData->m_aComponents );
- for ( SubComponents::const_iterator comp = aWorkingCopy.begin();
- comp != aWorkingCopy.end();
- ++comp
- )
+ for (auto const& elem : aWorkingCopy)
{
- lcl_closeComponent( *comp );
+ lcl_closeComponent(elem);
}
}
catch ( const Exception& )
@@ -521,15 +515,12 @@ namespace dbaui
ENSURE_OR_RETURN_FALSE( !i_rName.isEmpty(), "SubComponentManager::closeSubFrames: illegal name!" );
SubComponents aWorkingCopy( m_pData->m_aComponents );
- for ( SubComponents::const_iterator comp = aWorkingCopy.begin();
- comp != aWorkingCopy.end();
- ++comp
- )
+ for (auto const& elem : aWorkingCopy)
{
- if ( ( comp->sName != i_rName ) || ( comp->nComponentType != _nComponentType ) )
+ if ( ( elem.sName != i_rName ) || ( elem.nComponentType != _nComponentType ) )
continue;
- if ( !lcl_closeComponent( *comp ) )
+ if ( !lcl_closeComponent(elem) )
return false;
}
@@ -539,24 +530,21 @@ namespace dbaui
bool SubComponentManager::lookupSubComponent( const Reference< XComponent >& i_rComponent,
OUString& o_rName, sal_Int32& o_rComponentType )
{
- for ( SubComponents::const_iterator comp = m_pData->m_aComponents.begin();
- comp != m_pData->m_aComponents.end();
- ++comp
- )
+ for (auto const& component : m_pData->m_aComponents)
{
- if ( ( comp->xModel.is()
- && ( comp->xModel == i_rComponent )
+ if ( ( component.xModel.is()
+ && ( component.xModel == i_rComponent )
)
- || ( comp->xController.is()
- && ( comp->xController == i_rComponent )
+ || ( component.xController.is()
+ && ( component.xController == i_rComponent )
)
- || ( comp->xFrame.is()
- && ( comp->xFrame == i_rComponent )
+ || ( component.xFrame.is()
+ && ( component.xFrame == i_rComponent )
)
)
{
- o_rName = comp->sName;
- o_rComponentType = comp->nComponentType;
+ o_rName = component.sName;
+ o_rComponentType = component.nComponentType;
return true;
}
}
diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx
index 474104a89191..0081edd43106 100644
--- a/dbaccess/source/ui/browser/genericcontroller.cxx
+++ b/dbaccess/source/ui/browser/genericcontroller.cxx
@@ -366,12 +366,9 @@ namespace
void lcl_notifyMultipleStates( XStatusListener& _rListener, FeatureStateEvent& _rEvent, const States& _rStates )
{
- for ( States::const_iterator state = _rStates.begin();
- state != _rStates.end();
- ++state
- )
+ for (auto const& elem : _rStates)
{
- _rEvent.State = *state;
+ _rEvent.State = elem;
_rListener.statusChanged( _rEvent );
}
}
@@ -445,18 +442,14 @@ void OGenericUnoController::ImplBroadcastFeatureState(const OUString& _rFeature,
// we are notifying them, so we must use a copy of m_arrStatusListener, not
// m_arrStatusListener itself
Dispatch aNotifyLoop( m_arrStatusListener );
- Dispatch::iterator iterSearch = aNotifyLoop.begin();
- Dispatch::const_iterator iterEnd = aNotifyLoop.end();
- while (iterSearch != iterEnd)
+ for (auto const& elem : aNotifyLoop)
{
- DispatchTarget& rCurrent = *iterSearch;
- if ( aFeatureCommands.find( rCurrent.aURL.Complete ) != aFeatureCommands.end() )
+ if ( aFeatureCommands.find( elem.aURL.Complete ) != aFeatureCommands.end() )
{
- aEvent.FeatureURL = rCurrent.aURL;
- lcl_notifyMultipleStates( *rCurrent.xListener.get(), aEvent, aStates );
+ aEvent.FeatureURL = elem.aURL;
+ lcl_notifyMultipleStates( *elem.xListener.get(), aEvent, aStates );
}
- ++iterSearch;
}
}
@@ -571,12 +564,8 @@ void OGenericUnoController::InvalidateAll()
void OGenericUnoController::InvalidateAll_Impl()
{
// invalidate all supported features
-
- for ( SupportedFeatures::const_iterator aIter = m_aSupportedFeatures.begin();
- aIter != m_aSupportedFeatures.end();
- ++aIter
- )
- ImplBroadcastFeatureState( aIter->first, nullptr, true );
+ for (auto const& supportedFeature : m_aSupportedFeatures)
+ ImplBroadcastFeatureState( supportedFeature.first, nullptr, true );
{
::osl::MutexGuard aGuard( m_aFeatureMutex);
@@ -745,10 +734,9 @@ void OGenericUnoController::disposing()
EventObject aDisposeEvent;
aDisposeEvent.Source = static_cast<XWeak*>(this);
Dispatch aStatusListener = m_arrStatusListener;
- Dispatch::const_iterator aEnd = aStatusListener.end();
- for (Dispatch::const_iterator aIter = aStatusListener.begin(); aIter != aEnd; ++aIter)
+ for (auto const& statusListener : aStatusListener)
{
- aIter->xListener->disposing(aDisposeEvent);
+ statusListener.xListener->disposing(aDisposeEvent);
}
m_arrStatusListener.clear();
}
@@ -1211,12 +1199,9 @@ bool OGenericUnoController::isCommandEnabled( const OUString& _rCompleteCommandU
Sequence< ::sal_Int16 > SAL_CALL OGenericUnoController::getSupportedCommandGroups()
{
CommandHashMap aCmdHashMap;
- for ( SupportedFeatures::const_iterator aIter = m_aSupportedFeatures.begin();
- aIter != m_aSupportedFeatures.end();
- ++aIter
- )
- if ( aIter->second.GroupId != CommandGroup::INTERNAL )
- aCmdHashMap.emplace( aIter->second.GroupId, 0 );
+ for (auto const& supportedFeature : m_aSupportedFeatures)
+ if ( supportedFeature.second.GroupId != CommandGroup::INTERNAL )
+ aCmdHashMap.emplace( supportedFeature.second.GroupId, 0 );
return comphelper::mapKeysToSequence( aCmdHashMap );
}
@@ -1235,14 +1220,11 @@ Sequence< DispatchInformation > SAL_CALL OGenericUnoController::getConfigurableD
{
std::vector< DispatchInformation > aInformationVector;
DispatchInformation aDispatchInfo;
- for ( SupportedFeatures::const_iterator aIter = m_aSupportedFeatures.begin();
- aIter != m_aSupportedFeatures.end();
- ++aIter
- )
+ for (auto const& supportedFeature : m_aSupportedFeatures)
{
- if ( sal_Int16( aIter->second.GroupId ) == CommandGroup )
+ if ( sal_Int16( supportedFeature.second.GroupId ) == CommandGroup )
{
- aDispatchInfo = aIter->second;
+ aDispatchInfo = supportedFeature.second;
aInformationVector.push_back( aDispatchInfo );
}
}
diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx
index 5d4583ae4eb5..000d2da02a90 100644
--- a/dbaccess/source/ui/browser/sbagrid.cxx
+++ b/dbaccess/source/ui/browser/sbagrid.cxx
@@ -205,12 +205,10 @@ void SAL_CALL SbaXGridControl::createPeer(const Reference< css::awt::XToolkit >
// TODO: why the hell this whole class does not use any mutex?
Reference< css::frame::XDispatch > xDisp(getPeer(), UNO_QUERY);
- for ( StatusMultiplexerArray::const_iterator aIter = m_aStatusMultiplexer.begin();
- aIter != m_aStatusMultiplexer.end();
- ++aIter)
+ for (auto const& elem : m_aStatusMultiplexer)
{
- if ((*aIter).second.is() && (*aIter).second->getLength())
- xDisp->addStatusListener((*aIter).second.get(), (*aIter).first);
+ if (elem.second.is() && elem.second->getLength())
+ xDisp->addStatusListener(elem.second.get(), elem.first);
}
}
@@ -273,14 +271,12 @@ void SAL_CALL SbaXGridControl::dispose()
EventObject aEvt;
aEvt.Source = *this;
- for ( StatusMultiplexerArray::iterator aIter = m_aStatusMultiplexer.begin();
- aIter != m_aStatusMultiplexer.end();
- ++aIter)
+ for (auto & elem : m_aStatusMultiplexer)
{
- if ((*aIter).second.is())
+ if (elem.second.is())
{
- (*aIter).second->disposeAndClear(aEvt);
- (*aIter).second.clear();
+ elem.second->disposeAndClear(aEvt);
+ elem.second.clear();
}
}
StatusMultiplexerArray().swap(m_aStatusMultiplexer);
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index ca2dc64699fe..92fec3b8b9f8 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -783,18 +783,12 @@ void SbaTableQueryBrowser::InitializeGridModel(const Reference< css::form::XForm
aInitialValues.emplace_back( PROPERTY_MOUSE_WHEEL_BEHAVIOR, makeAny( MouseWheelBehavior::SCROLL_DISABLED ) );
// now set all those values
- for ( std::vector< NamedValue >::const_iterator property = aInitialValues.begin();
- property != aInitialValues.end();
- ++property
- )
+ for (auto const& property : aInitialValues)
{
- xGridCol->setPropertyValue( property->Name, property->Value );
+ xGridCol->setPropertyValue( property.Name, property.Value );
}
- for ( std::vector< OUString >::const_iterator copyPropertyName = aCopyProperties.begin();
- copyPropertyName != aCopyProperties.end();
- ++copyPropertyName
- )
- xGridCol->setPropertyValue( *copyPropertyName, xColumn->getPropertyValue( *copyPropertyName ) );
+ for (auto const& copyPropertyName : aCopyProperties)
+ xGridCol->setPropertyValue( copyPropertyName, xColumn->getPropertyValue(copyPropertyName) );
xColContainer->insertByName(rName, makeAny(xGridCol));
}
@@ -968,19 +962,17 @@ void SAL_CALL SbaTableQueryBrowser::statusChanged( const FeatureStateEvent& _rEv
{
// search the external dispatcher causing this call
Reference< XDispatch > xSource(_rEvent.Source, UNO_QUERY);
- ExternalFeaturesMap::iterator aLoop;
- for ( aLoop = m_aExternalFeatures.begin();
- aLoop != m_aExternalFeatures.end();
- ++aLoop
- )
+ bool bFound = false;
+ for (auto & externalFeature : m_aExternalFeatures)
{
- if ( _rEvent.FeatureURL.Complete == aLoop->second.aURL.Complete)
+ if ( _rEvent.FeatureURL.Complete == externalFeature.second.aURL.Complete)
{
- OSL_ENSURE( xSource.get() == aLoop->second.xDispatcher.get(), "SbaTableQueryBrowser::statusChanged: inconsistent!" );
+ bFound = true;
+ OSL_ENSURE( xSource.get() == externalFeature.second.xDispatcher.get(), "SbaTableQueryBrowser::statusChanged: inconsistent!" );
// update the enabled state
- aLoop->second.bEnabled = _rEvent.IsEnabled;
+ externalFeature.second.bEnabled = _rEvent.IsEnabled;
- switch ( aLoop->first )
+ switch ( externalFeature.first )
{
case ID_BROWSER_DOCUMENT_DATASOURCE:
{
@@ -1004,14 +996,14 @@ void SAL_CALL SbaTableQueryBrowser::statusChanged( const FeatureStateEvent& _rEv
default:
// update the toolbox
- implCheckExternalSlot( aLoop->first );
+ implCheckExternalSlot( externalFeature.first );
break;
}
break;
}
}
- OSL_ENSURE(aLoop != m_aExternalFeatures.end(), "SbaTableQueryBrowser::statusChanged: don't know who sent this!");
+ OSL_ENSURE(bFound, "SbaTableQueryBrowser::statusChanged: don't know who sent this!");
}
void SbaTableQueryBrowser::checkDocumentDataSource()
@@ -1276,28 +1268,25 @@ void SbaTableQueryBrowser::connectExternalDispatches()
}
}
- for ( ExternalFeaturesMap::iterator feature = m_aExternalFeatures.begin();
- feature != m_aExternalFeatures.end();
- ++feature
- )
+ for (auto & externalFeature : m_aExternalFeatures)
{
- feature->second.xDispatcher = xProvider->queryDispatch(
- feature->second.aURL, "_parent", FrameSearchFlag::PARENT
+ externalFeature.second.xDispatcher = xProvider->queryDispatch(
+ externalFeature.second.aURL, "_parent", FrameSearchFlag::PARENT
);
- if ( feature->second.xDispatcher.get() == static_cast< XDispatch* >( this ) )
+ if ( externalFeature.second.xDispatcher.get() == static_cast< XDispatch* >( this ) )
{
SAL_WARN("dbaccess.ui", "SbaTableQueryBrowser::connectExternalDispatches: this should not happen anymore!" );
// (nowadays, the URLs aren't in our SupportedFeatures list anymore, so we should
// not supply a dispatcher for this)
- feature->second.xDispatcher.clear();
+ externalFeature.second.xDispatcher.clear();
}
- if ( feature->second.xDispatcher.is() )
+ if ( externalFeature.second.xDispatcher.is() )
{
try
{
- feature->second.xDispatcher->addStatusListener( this, feature->second.aURL );
+ externalFeature.second.xDispatcher->addStatusListener( this, externalFeature.second.aURL );
}
catch( const Exception& )
{
@@ -1305,7 +1294,7 @@ void SbaTableQueryBrowser::connectExternalDispatches()
}
}
- implCheckExternalSlot( feature->first );
+ implCheckExternalSlot( externalFeature.first );
}
}
}
@@ -1347,19 +1336,19 @@ void SAL_CALL SbaTableQueryBrowser::disposing( const css::lang::EventObject& _rS
ExternalFeaturesMap::const_iterator aEnd = m_aExternalFeatures.end();
while (aLoop != aEnd)
{
- ExternalFeaturesMap::const_iterator aI = aLoop++;
- if ( aI->second.xDispatcher.get() == xSource.get() )
+ if ( aLoop->second.xDispatcher.get() == xSource.get() )
{
- sal_uInt16 nSlot = aI->first;
+ sal_uInt16 nSlot = aLoop->first;
// remove it
- m_aExternalFeatures.erase(aI);
+ aLoop = m_aExternalFeatures.erase(aLoop);
// maybe update the UI
implCheckExternalSlot(nSlot);
// continue, the same XDispatch may be responsible for more than one URL
}
+ ++aLoop;
}
}
else
@@ -1393,16 +1382,13 @@ void SAL_CALL SbaTableQueryBrowser::disposing( const css::lang::EventObject& _rS
void SbaTableQueryBrowser::implRemoveStatusListeners()
{
// clear all old dispatches
- for ( ExternalFeaturesMap::const_iterator aLoop = m_aExternalFeatures.begin();
- aLoop != m_aExternalFeatures.end();
- ++aLoop
- )
+ for (auto const& externalFeature : m_aExternalFeatures)
{
- if ( aLoop->second.xDispatcher.is() )
+ if ( externalFeature.second.xDispatcher.is() )
{
try
{
- aLoop->second.xDispatcher->removeStatusListener( this, aLoop->second.aURL );
+ externalFeature.second.xDispatcher->removeStatusListener( this, externalFeature.second.aURL );
}
catch (Exception&)
{
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 ) );
}
}
}
diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
index 3dd943d14990..67638a3601ab 100644
--- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx
+++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
@@ -562,24 +562,21 @@ void ODbDataSourceAdministrationHelper::translateProperties(const Reference< XPr
{
if (_rxSource.is())
{
- for ( MapInt2String::const_iterator aDirect = m_aDirectPropTranslator.begin();
- aDirect != m_aDirectPropTranslator.end();
- ++aDirect
- )
+ for (auto const& elem : m_aDirectPropTranslator)
{
// get the property value
Any aValue;
try
{
- aValue = _rxSource->getPropertyValue(aDirect->second);
+ aValue = _rxSource->getPropertyValue(elem.second);
}
catch(Exception&)
{
SAL_WARN("dbaccess", "ODbDataSourceAdministrationHelper::translateProperties: could not extract the property "
- << aDirect->second);
+ << elem.second);
}
// transfer it into an item
- implTranslateProperty(_rDest, aDirect->first, aValue);
+ implTranslateProperty(_rDest, elem.first, aValue);
}
// get the additional information
@@ -608,17 +605,14 @@ void ODbDataSourceAdministrationHelper::translateProperties(const Reference< XPr
if ( !aInfos.empty() )
{
PropertyValue aSearchFor;
- MapInt2String::const_iterator aEnd = m_aIndirectPropTranslator.end();
- for ( MapInt2String::const_iterator aIndirect = m_aIndirectPropTranslator.begin();
- aIndirect != aEnd;
- ++aIndirect)
+ for (auto const& elem : m_aIndirectPropTranslator)
{
- aSearchFor.Name = aIndirect->second;
+ aSearchFor.Name = elem.second;
PropertyValueSet::const_iterator aInfoPos = aInfos.find(aSearchFor);
if (aInfos.end() != aInfoPos)
// the property is contained in the info sequence
// -> transfer it into an item
- implTranslateProperty(_rDest, aIndirect->first, aInfoPos->Value);
+ implTranslateProperty(_rDest, elem.first, aInfoPos->Value);
}
}
@@ -650,30 +644,27 @@ void ODbDataSourceAdministrationHelper::translateProperties(const SfxItemSet& _r
const OUString sUrlProp("URL");
// transfer the direct properties
- for ( MapInt2String::const_iterator aDirect = m_aDirectPropTranslator.begin();
- aDirect != m_aDirectPropTranslator.end();
- ++aDirect
- )
+ for (auto const& elem : m_aDirectPropTranslator)
{
- const SfxPoolItem* pCurrentItem = _rSource.GetItem(static_cast<sal_uInt16>(aDirect->first));
+ const SfxPoolItem* pCurrentItem = _rSource.GetItem(static_cast<sal_uInt16>(elem.first));
if (pCurrentItem)
{
sal_Int16 nAttributes = PropertyAttribute::READONLY;
if (xInfo.is())
{
- try { nAttributes = xInfo->getPropertyByName(aDirect->second).Attributes; }
+ try { nAttributes = xInfo->getPropertyByName(elem.second).Attributes; }
catch(Exception&) { }
}
if ((nAttributes & PropertyAttribute::READONLY) == 0)
{
- if ( sUrlProp == aDirect->second )
+ if ( sUrlProp == elem.second )
{
Any aValue(makeAny(getConnectionURL()));
// aValue <<= OUString();
- lcl_putProperty(_rxDest, aDirect->second,aValue);
+ lcl_putProperty(_rxDest, elem.second,aValue);
}
else
- implTranslateProperty(_rxDest, aDirect->second, pCurrentItem);
+ implTranslateProperty(_rxDest, elem.second, pCurrentItem);
}
}
}
@@ -708,11 +699,10 @@ void ODbDataSourceAdministrationHelper::fillDatasourceInfo(const SfxItemSet& _rS
// collect the translated property values for the relevant items
PropertyValueSet aRelevantSettings;
MapInt2String::const_iterator aTranslation;
- std::vector< sal_Int32>::const_iterator aDetailsEnd = aDetailIds.end();
- for (std::vector< sal_Int32>::const_iterator aIter = aDetailIds.begin();aIter != aDetailsEnd ; ++aIter)
+ for (auto const& detailId : aDetailIds)
{
- const SfxPoolItem* pCurrent = _rSource.GetItem(static_cast<sal_uInt16>(*aIter));
- aTranslation = m_aIndirectPropTranslator.find(*aIter);
+ const SfxPoolItem* pCurrent = _rSource.GetItem(static_cast<sal_uInt16>(detailId));
+ aTranslation = m_aIndirectPropTranslator.find(detailId);
if ( pCurrent && (m_aIndirectPropTranslator.end() != aTranslation) )
{
if ( aTranslation->second == INFO_CHARSET )
@@ -772,25 +762,17 @@ void ODbDataSourceAdministrationHelper::fillDatasourceInfo(const SfxItemSet& _rS
// now check the to-be-preserved props
std::vector< sal_Int32 > aRemoveIndexes;
sal_Int32 nPositionCorrector = 0;
- MapInt2String::const_iterator aPreservedEnd = aPreservedSettings.end();
- for ( MapInt2String::const_iterator aPreserved = aPreservedSettings.begin();
- aPreserved != aPreservedEnd;
- ++aPreserved
- )
+ for (auto const& preservedSetting : aPreservedSettings)
{
- if (aIndirectProps.end() != aIndirectProps.find(aPreserved->second))
+ if (aIndirectProps.end() != aIndirectProps.find(preservedSetting.second))
{
- aRemoveIndexes.push_back(aPreserved->first - nPositionCorrector);
+ aRemoveIndexes.push_back(preservedSetting.first - nPositionCorrector);
++nPositionCorrector;
}
}
// now finally remove all such props
- std::vector< sal_Int32 >::const_iterator aRemoveEnd = aRemoveIndexes.end();
- for ( std::vector< sal_Int32 >::const_iterator aRemoveIndex = aRemoveIndexes.begin();
- aRemoveIndex != aRemoveEnd;
- ++aRemoveIndex
- )
- ::comphelper::removeElementAt(_rInfo, *aRemoveIndex);
+ for (auto const& removeIndex : aRemoveIndexes)
+ ::comphelper::removeElementAt(_rInfo, removeIndex);
}
::connectivity::DriversConfig aDriverConfig(getORB());
@@ -809,21 +791,18 @@ void ODbDataSourceAdministrationHelper::fillDatasourceInfo(const SfxItemSet& _rS
sal_Int32 nOldLength = _rInfo.getLength();
_rInfo.realloc(nOldLength + aRelevantSettings.size());
PropertyValue* pAppendValues = _rInfo.getArray() + nOldLength;
- PropertyValueSet::const_iterator aRelevantEnd = aRelevantSettings.end();
- for ( PropertyValueSet::const_iterator aLoop = aRelevantSettings.begin();
- aLoop != aRelevantEnd;
- ++aLoop, ++pAppendValues
- )
+ for (auto const& relevantSetting : aRelevantSettings)
{
- if ( aLoop->Name == INFO_CHARSET )
+ if ( relevantSetting.Name == INFO_CHARSET )
{
OUString sCharSet;
- aLoop->Value >>= sCharSet;
+ relevantSetting.Value >>= sCharSet;
if ( !sCharSet.isEmpty() )
- *pAppendValues = *aLoop;
+ *pAppendValues = relevantSetting;
}
else
- *pAppendValues = *aLoop;
+ *pAppendValues = relevantSetting;
+ ++pAppendValues;
}
}
}
diff --git a/dbaccess/source/ui/dlg/DriverSettings.cxx b/dbaccess/source/ui/dlg/DriverSettings.cxx
index c5352001ff71..ba388a60c734 100644
--- a/dbaccess/source/ui/dlg/DriverSettings.cxx
+++ b/dbaccess/source/ui/dlg/DriverSettings.cxx
@@ -36,12 +36,9 @@ void ODriversSettings::getSupportedIndirectSettings( const OUString& _sURLPrefix
// central DataSourceUI instance.
DataSourceMetaData aMeta( _sURLPrefix );
const FeatureSet& rFeatures( aMeta.getFeatureSet() );
- for ( FeatureSet::const_iterator feature = rFeatures.begin();
- feature != rFeatures.end();
- ++feature
- )
+ for (auto const& feature : rFeatures)
{
- _out_rDetailsIds.push_back( *feature );
+ _out_rDetailsIds.push_back(feature);
}
// the rest is configuration-based
diff --git a/dbaccess/source/ui/dlg/advancedsettings.cxx b/dbaccess/source/ui/dlg/advancedsettings.cxx
index 6fc2d8263ee4..745837bba65c 100644
--- a/dbaccess/source/ui/dlg/advancedsettings.cxx
+++ b/dbaccess/source/ui/dlg/advancedsettings.cxx
@@ -89,22 +89,19 @@ namespace dbaui
const FeatureSet& rFeatures( _rDSMeta.getFeatureSet() );
// create all the check boxes for the boolean settings
- for ( BooleanSettingDescs::const_iterator setting = m_aBooleanSettings.begin();
- setting != m_aBooleanSettings.end();
- ++setting
- )
+ for (auto const& booleanSetting : m_aBooleanSettings)
{
- sal_uInt16 nItemId = setting->nItemId;
+ sal_uInt16 nItemId = booleanSetting.nItemId;
if ( rFeatures.has( nItemId ) )
{
- get(*setting->ppControl, setting->sControlId);
- (*setting->ppControl)->SetClickHdl( LINK(this, OGenericAdministrationPage, OnControlModifiedClick) );
- (*setting->ppControl)->Show();
+ get(*booleanSetting.ppControl, booleanSetting.sControlId);
+ (*booleanSetting.ppControl)->SetClickHdl( LINK(this, OGenericAdministrationPage, OnControlModifiedClick) );
+ (*booleanSetting.ppControl)->Show();
// check whether this must be a tristate check box
const SfxPoolItem& rItem = _rCoreAttrs.Get( nItemId );
if ( nullptr != dynamic_cast< const OptionalBoolItem* >(&rItem) )
- (*setting->ppControl)->EnableTriState();
+ (*booleanSetting.ppControl)->EnableTriState();
}
}
@@ -214,14 +211,11 @@ namespace dbaui
void SpecialSettingsPage::fillControls(std::vector< ISaveValueWrapper* >& _rControlList)
{
- for ( BooleanSettingDescs::const_iterator setting = m_aBooleanSettings.begin();
- setting != m_aBooleanSettings.end();
- ++setting
- )
+ for (auto const& booleanSetting : m_aBooleanSettings)
{
- if ( *setting->ppControl )
+ if ( *booleanSetting.ppControl )
{
- _rControlList.push_back( new OSaveValueWrapper< CheckBox >( *setting->ppControl ) );
+ _rControlList.push_back( new OSaveValueWrapper< CheckBox >( *booleanSetting.ppControl ) );
}
}
@@ -244,18 +238,15 @@ namespace dbaui
}
// the boolean items
- for ( BooleanSettingDescs::const_iterator setting = m_aBooleanSettings.begin();
- setting != m_aBooleanSettings.end();
- ++setting
- )
+ for (auto const& booleanSetting : m_aBooleanSettings)
{
- if ( !(*setting->ppControl) )
+ if ( !(*booleanSetting.ppControl) )
continue;
::boost::optional< bool > aValue(false);
aValue.reset();
- const SfxPoolItem* pItem = _rSet.GetItem<SfxPoolItem>(setting->nItemId);
+ const SfxPoolItem* pItem = _rSet.GetItem<SfxPoolItem>(booleanSetting.nItemId);
if (const SfxBoolItem *pBoolItem = dynamic_cast<const SfxBoolItem*>( pItem) )
{
aValue.reset( pBoolItem->GetValue() );
@@ -269,14 +260,14 @@ namespace dbaui
if ( !aValue )
{
- (*setting->ppControl)->SetState( TRISTATE_INDET );
+ (*booleanSetting.ppControl)->SetState( TRISTATE_INDET );
}
else
{
bool bValue = *aValue;
- if ( setting->bInvertedDisplay )
+ if ( booleanSetting.bInvertedDisplay )
bValue = !bValue;
- (*setting->ppControl)->Check( bValue );
+ (*booleanSetting.ppControl)->Check( bValue );
}
}
@@ -301,14 +292,11 @@ namespace dbaui
bool bChangedSomething = false;
// the boolean items
- for ( BooleanSettingDescs::const_iterator setting = m_aBooleanSettings.begin();
- setting != m_aBooleanSettings.end();
- ++setting
- )
+ for (auto const& booleanSetting : m_aBooleanSettings)
{
- if ( !*setting->ppControl )
+ if ( !*booleanSetting.ppControl )
continue;
- fillBool( *_rSet, *setting->ppControl, setting->nItemId, bChangedSomething, setting->bInvertedDisplay );
+ fillBool( *_rSet, *booleanSetting.ppControl, booleanSetting.nItemId, bChangedSomething, booleanSetting.bInvertedDisplay );
}
// the non-boolean items
diff --git a/dbaccess/source/ui/dlg/dbadmin.cxx b/dbaccess/source/ui/dlg/dbadmin.cxx
index 5d55c2b1cf6a..d94427f8e54a 100644
--- a/dbaccess/source/ui/dlg/dbadmin.cxx
+++ b/dbaccess/source/ui/dlg/dbadmin.cxx
@@ -185,11 +185,8 @@ void ODbAdminDialog::impl_resetPages(const Reference< XPropertySet >& _rxDatasou
// are set. Select another data source of the same type, where the indirect props are not set (yet). Then,
// the indirect property values of the first ds are shown in the second ds ...)
const ODbDataSourceAdministrationHelper::MapInt2String& rMap = m_pImpl->getIndirectProperties();
- for ( ODbDataSourceAdministrationHelper::MapInt2String::const_iterator aIndirect = rMap.begin();
- aIndirect != rMap.end();
- ++aIndirect
- )
- GetInputSetImpl()->ClearItem( static_cast<sal_uInt16>(aIndirect->first) );
+ for (auto const& elem : rMap)
+ GetInputSetImpl()->ClearItem( static_cast<sal_uInt16>(elem.first) );
// extract all relevant data from the property set of the data source
m_pImpl->translateProperties(_rxDatasource, *GetInputSetImpl());
diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx
index b0df0e5fbbda..46f8160a29ef 100644
--- a/dbaccess/source/ui/dlg/dbwizsetup.cxx
+++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx
@@ -186,12 +186,10 @@ void ODbTypeWizDialogSetup::declareAuthDepPath( const OUString& _sURL, PathId _n
// collect the elements of the path
WizardPath aPath;
- svt::RoadmapWizardTypes::WizardPath::const_iterator aIter = _rPaths.begin();
- svt::RoadmapWizardTypes::WizardPath::const_iterator aEnd = _rPaths.end();
- for(;aIter != aEnd;++aIter)
+ for (auto const& path : _rPaths)
{
- if ( bHasAuthentication || ( *aIter != PAGE_DBSETUPWIZARD_AUTHENTIFICATION ) )
- aPath.push_back( *aIter );
+ if ( bHasAuthentication || ( path != PAGE_DBSETUPWIZARD_AUTHENTIFICATION ) )
+ aPath.push_back(path);
}
// call base method
@@ -383,11 +381,8 @@ void ODbTypeWizDialogSetup::resetPages(const Reference< XPropertySet >& _rxDatas
// are set. Select another data source of the same type, where the indirect props are not set (yet). Then,
// the indirect property values of the first ds are shown in the second ds ...)
const ODbDataSourceAdministrationHelper::MapInt2String& rMap = m_pImpl->getIndirectProperties();
- for ( ODbDataSourceAdministrationHelper::MapInt2String::const_iterator aIndirect = rMap.begin();
- aIndirect != rMap.end();
- ++aIndirect
- )
- getWriteOutputSet()->ClearItem( static_cast<sal_uInt16>(aIndirect->first) );
+ for (auto const& elem : rMap)
+ getWriteOutputSet()->ClearItem( static_cast<sal_uInt16>(elem.first) );
// extract all relevant data from the property set of the data source
m_pImpl->translateProperties(_rxDatasource, *getWriteOutputSet());
diff --git a/dbaccess/source/ui/dlg/dsselect.cxx b/dbaccess/source/ui/dlg/dsselect.cxx
index 4a9483eddd4b..6d62c3ee0a23 100644
--- a/dbaccess/source/ui/dlg/dsselect.cxx
+++ b/dbaccess/source/ui/dlg/dsselect.cxx
@@ -143,12 +143,9 @@ void ODatasourceSelectDialog::fillListBox(const StringBag& _rDatasources)
sSelected = m_pDatasource->GetSelectedEntry();
m_pDatasource->Clear();
// fill the list
- for ( StringBag::const_iterator aDS = _rDatasources.begin();
- aDS != _rDatasources.end();
- ++aDS
- )
+ for (auto const& datasource : _rDatasources)
{
- m_pDatasource->InsertEntry( *aDS );
+ m_pDatasource->InsertEntry(datasource);
}
if (m_pDatasource->GetEntryCount())
diff --git a/dbaccess/source/ui/dlg/generalpage.cxx b/dbaccess/source/ui/dlg/generalpage.cxx
index 12b1e62f4fe9..738b33af880b 100644
--- a/dbaccess/source/ui/dlg/generalpage.cxx
+++ b/dbaccess/source/ui/dlg/generalpage.cxx
@@ -172,12 +172,8 @@ namespace dbaui
}
}
std::sort( aDisplayedTypes.begin(), aDisplayedTypes.end(), DisplayedTypeLess() );
- DisplayedTypes::const_iterator aDisplayEnd = aDisplayedTypes.end();
- for ( DisplayedTypes::const_iterator loop = aDisplayedTypes.begin();
- loop != aDisplayEnd;
- ++loop
- )
- insertEmbeddedDBTypeEntryData( loop->eType, loop->sDisplayName );
+ for (auto const& displayedType : aDisplayedTypes)
+ insertEmbeddedDBTypeEntryData( displayedType.eType, displayedType.sDisplayName );
}
}
}
diff --git a/dbaccess/source/ui/dlg/indexdialog.cxx b/dbaccess/source/ui/dlg/indexdialog.cxx
index 41eb4cf381c8..e2e7adc0986f 100644
--- a/dbaccess/source/ui/dlg/indexdialog.cxx
+++ b/dbaccess/source/ui/dlg/indexdialog.cxx
@@ -66,13 +66,12 @@ namespace dbaui
if (_rLHS.size() != _rRHS.size())
return false;
- IndexFields::const_iterator aLeft = _rLHS.begin();
- IndexFields::const_iterator aLeftEnd = _rLHS.end();
IndexFields::const_iterator aRight = _rRHS.begin();
- for (; aLeft != aLeftEnd; ++aLeft, ++aRight)
+ for (auto const& left : _rLHS)
{
- if (*aLeft != *aRight)
+ if (left != *aRight)
return false;
+ ++aRight;
}
return true;
@@ -238,18 +237,16 @@ namespace dbaui
m_pClose->SetClickHdl(LINK(this, DbaIndexDialog, OnCloseDialog));
// if all of the indexes have an empty description, we're not interested in displaying it
- Indexes::const_iterator aCheck;
-
- for ( aCheck = m_pIndexes->begin();
- aCheck != m_pIndexes->end();
- ++aCheck
- )
+ bool bFound = false;
+ for (auto const& check : *m_pIndexes)
{
- if (!aCheck->sDescription.isEmpty())
+ if (!check.sDescription.isEmpty())
+ {
+ bFound = true;
break;
+ }
}
-
- if (aCheck == m_pIndexes->end())
+ if (!bFound)
{
// hide the controls which are necessary for the description
m_pDescription->Hide();
@@ -286,17 +283,17 @@ namespace dbaui
Image aPKeyIcon(BitmapEx(BMP_PKEYICON));
// fill the list with the index names
m_pIndexList->Clear();
- Indexes::const_iterator aIndexLoop = m_pIndexes->begin();
- Indexes::const_iterator aEnd = m_pIndexes->end();
- for (; aIndexLoop != aEnd; ++aIndexLoop)
+ sal_Int32 nPos = 0;
+ for (auto const& indexLoop : *m_pIndexes)
{
SvTreeListEntry* pNewEntry = nullptr;
- if (aIndexLoop->bPrimaryKey)
- pNewEntry = m_pIndexList->InsertEntry(aIndexLoop->sName, aPKeyIcon, aPKeyIcon);
+ if (indexLoop.bPrimaryKey)
+ pNewEntry = m_pIndexList->InsertEntry(indexLoop.sName, aPKeyIcon, aPKeyIcon);
else
- pNewEntry = m_pIndexList->InsertEntry(aIndexLoop->sName);
+ pNewEntry = m_pIndexList->InsertEntry(indexLoop.sName);
- pNewEntry->SetUserData(reinterpret_cast< void* >(sal_Int32(aIndexLoop - m_pIndexes->begin())));
+ pNewEntry->SetUserData(reinterpret_cast< void* >(nPos));
+ ++nPos;
}
OnIndexSelected(*m_pIndexList);
@@ -693,16 +690,13 @@ namespace dbaui
// no double fields
std::set< OUString > aExistentFields;
- for ( IndexFields::const_iterator aFieldCheck = _rPos->aFields.begin();
- aFieldCheck != _rPos->aFields.end();
- ++aFieldCheck
- )
+ for (auto const& fieldCheck : _rPos->aFields)
{
- if (aExistentFields.end() != aExistentFields.find(aFieldCheck->sFieldName))
+ if (aExistentFields.end() != aExistentFields.find(fieldCheck.sFieldName))
{
// a column is specified twice ... won't work anyway, so prevent this here and now
OUString sMessage(DBA_RES(STR_INDEXDESIGN_DOUBLE_COLUMN_NAME));
- sMessage = sMessage.replaceFirst("$name$", aFieldCheck->sFieldName);
+ sMessage = sMessage.replaceFirst("$name$", fieldCheck.sFieldName);
std::unique_ptr<weld::MessageDialog> xError(Application::CreateMessageDialog(GetFrameWeld(),
VclMessageType::Warning, VclButtonsType::Ok,
sMessage));
@@ -710,7 +704,7 @@ namespace dbaui
m_pFields->GrabFocus();
return false;
}
- aExistentFields.insert(aFieldCheck->sFieldName);
+ aExistentFields.insert(fieldCheck.sFieldName);
}
return true;
diff --git a/dbaccess/source/ui/dlg/indexfieldscontrol.cxx b/dbaccess/source/ui/dlg/indexfieldscontrol.cxx
index 1dfa36a4cea4..377913d832e7 100644
--- a/dbaccess/source/ui/dlg/indexfieldscontrol.cxx
+++ b/dbaccess/source/ui/dlg/indexfieldscontrol.cxx
@@ -165,13 +165,11 @@ namespace dbaui
{
// do not just copy the array, we may have empty field names (which should not be copied)
_rFields.resize(m_aFields.size());
- IndexFields::const_iterator aSource = m_aFields.begin();
- IndexFields::const_iterator aSourceEnd = m_aFields.end();
IndexFields::iterator aDest = _rFields.begin();
- for (; aSource != aSourceEnd; ++aSource)
- if (!aSource->sFieldName.isEmpty())
+ for (auto const& source : m_aFields)
+ if (!source.sFieldName.isEmpty())
{
- *aDest = *aSource;
+ *aDest = source;
++aDest;
}
@@ -400,7 +398,7 @@ namespace dbaui
else if (sSelectedEntry.isEmpty() && (nCurrentRow == rowCount - 2))
{ // in the (last-1)th row, an empty entry has been selected
// -> remove the last row
- m_aFields.erase(m_aFields.end() - 1);
+ m_aFields.pop_back();
RowRemoved(GetRowCount() - 1);
Invalidate(GetRowRectPixel(nCurrentRow));
}
diff --git a/dbaccess/source/ui/dlg/paramdialog.cxx b/dbaccess/source/ui/dlg/paramdialog.cxx
index 7fa6db46298b..ea2e7640459b 100644
--- a/dbaccess/source/ui/dlg/paramdialog.cxx
+++ b/dbaccess/source/ui/dlg/paramdialog.cxx
@@ -339,16 +339,16 @@ namespace dbaui
m_aVisitedParams[m_nCurrentlySelected] |= VisitFlags::Visited;
// was it the last "not visited yet" entry ?
- std::vector<VisitFlags>::const_iterator aIter;
- for ( aIter = m_aVisitedParams.begin();
- aIter < m_aVisitedParams.end();
- ++aIter
- )
+ bool bVisited = false;
+ for (auto const& visitedParam : m_aVisitedParams)
{
- if (!((*aIter) & VisitFlags::Visited))
+ if (!(visitedParam & VisitFlags::Visited))
+ {
+ bVisited = true;
break;
+ }
}
- if (aIter == m_aVisitedParams.end())
+ if (!bVisited)
{ // yes, there isn't another one -> change the "default button"
m_pTravelNext->SetStyle(m_pTravelNext->GetStyle() & ~WB_DEFBUTTON);
m_pOKBtn->SetStyle(m_pOKBtn->GetStyle() | WB_DEFBUTTON);
diff --git a/dbaccess/source/ui/dlg/sqlmessage.cxx b/dbaccess/source/ui/dlg/sqlmessage.cxx
index e7f8811da03e..490b2d014a70 100644
--- a/dbaccess/source/ui/dlg/sqlmessage.cxx
+++ b/dbaccess/source/ui/dlg/sqlmessage.cxx
@@ -326,13 +326,11 @@ OExceptionChainDialog::OExceptionChainDialog(vcl::Window* pParent, const Excepti
bool bHave22018 = false;
size_t elementPos = 0;
- for ( ExceptionDisplayChain::const_iterator loop = m_aExceptions.begin();
- loop != m_aExceptions.end();
- ++loop, ++elementPos
- )
+ for (auto const& elem : m_aExceptions)
{
- lcl_insertExceptionEntry( *m_pExceptionList, elementPos, *loop );
- bHave22018 = loop->sSQLState == "22018";
+ lcl_insertExceptionEntry(*m_pExceptionList, elementPos, elem);
+ bHave22018 = elem.sSQLState == "22018";
+ ++elementPos;
}
// if the error has the code 22018, then add an additional explanation
@@ -575,12 +573,9 @@ void OSQLMessageBox::impl_addDetailsButton()
{
// even if the text fits into what we can display, we might need to details button
// if there is more non-trivial information in the errors than the mere messages
- for ( ExceptionDisplayChain::const_iterator error = m_pImpl->aDisplayInfo.begin();
- error != m_pImpl->aDisplayInfo.end();
- ++error
- )
+ for (auto const& error : m_pImpl->aDisplayInfo)
{
- if ( lcl_hasDetails( *error ) )
+ if ( lcl_hasDetails(error) )
{
bMoreDetailsAvailable = true;
break;
diff --git a/dbaccess/source/ui/inc/TableFieldDescription.hxx b/dbaccess/source/ui/inc/TableFieldDescription.hxx
index 6c40ab18fd2e..bcef693d7ab0 100644
--- a/dbaccess/source/ui/inc/TableFieldDescription.hxx
+++ b/dbaccess/source/ui/inc/TableFieldDescription.hxx
@@ -118,12 +118,12 @@ namespace dbaui
bool HasCriteria() const
{
- std::vector< OUString>::const_iterator aIter = m_aCriteria.begin();
- std::vector< OUString>::const_iterator aEnd = m_aCriteria.end();
- for(;aIter != aEnd;++aIter)
- if(!aIter->isEmpty())
- break;
- return aIter != aEnd;
+ for (auto const& criteria : m_aCriteria)
+ {
+ if(!criteria.isEmpty())
+ return true;
+ }
+ return false;
}
const std::vector< OUString>& GetCriteria() const { return m_aCriteria; }
diff --git a/dbaccess/source/ui/misc/DExport.cxx b/dbaccess/source/ui/misc/DExport.cxx
index fae5ddf492a1..10a08db16bba 100644
--- a/dbaccess/source/ui/misc/DExport.cxx
+++ b/dbaccess/source/ui/misc/DExport.cxx
@@ -281,11 +281,8 @@ ODatabaseExport::ODatabaseExport(const SharedConnection& _rxConnection,
ODatabaseExport::~ODatabaseExport()
{
m_pFormatter = nullptr;
- ODatabaseExport::TColumns::const_iterator aIter = m_aDestColumns.begin();
- ODatabaseExport::TColumns::const_iterator aEnd = m_aDestColumns.end();
-
- for(;aIter != aEnd;++aIter)
- delete aIter->second;
+ for (auto const& destColumn : m_aDestColumns)
+ delete destColumn.second;
m_vDestVector.clear();
m_aDestColumns.clear();
}
@@ -555,10 +552,13 @@ void ODatabaseExport::SetColumnTypes(const TColumnVector* _pList,const OTypeInfo
OSL_ENSURE(m_vNumberFormat.size() == m_vColumnSize.size() && m_vColumnSize.size() == _pList->size(),"Illegal columns in list");
Reference< XNumberFormatsSupplier > xSupplier = m_xFormatter->getNumberFormatsSupplier();
Reference< XNumberFormats > xFormats = xSupplier->getNumberFormats();
- TColumnVector::const_iterator aIter = _pList->begin();
- TColumnVector::const_iterator aEnd = _pList->end();
- for(sal_Int32 i= 0;aIter != aEnd && i < static_cast<sal_Int32>(m_vNumberFormat.size()) && i < static_cast<sal_Int32>(m_vColumnSize.size()) ;++aIter,++i)
+ sal_Int32 minBothSize = std::min<sal_Int32>(m_vNumberFormat.size(), m_vColumnSize.size());
+ sal_Int32 i = 0;
+ for (auto const& elem : *_pList)
{
+ if (i >= minBothSize)
+ break;
+
sal_Int32 nDataType;
sal_Int32 nLength(0),nScale(0);
sal_Int16 nType = m_vNumberFormat[i] & ~NumberFormat::DEFINED;
@@ -603,18 +603,19 @@ void ODatabaseExport::SetColumnTypes(const TColumnVector* _pList,const OTypeInfo
OTypeInfoMap::const_iterator aFind = _pInfoMap->find(nDataType);
if(aFind != _pInfoMap->end())
{
- (*aIter)->second->SetType(aFind->second);
- (*aIter)->second->SetPrecision(std::min<sal_Int32>(aFind->second->nPrecision,nLength));
- (*aIter)->second->SetScale(std::min<sal_Int32>(aFind->second->nMaximumScale,nScale));
+ elem->second->SetType(aFind->second);
+ elem->second->SetPrecision(std::min<sal_Int32>(aFind->second->nPrecision,nLength));
+ elem->second->SetScale(std::min<sal_Int32>(aFind->second->nMaximumScale,nScale));
sal_Int32 nFormatKey = ::dbtools::getDefaultNumberFormat( nDataType,
- (*aIter)->second->GetScale(),
- (*aIter)->second->IsCurrency(),
+ elem->second->GetScale(),
+ elem->second->IsCurrency(),
Reference< XNumberFormatTypes>(xFormats,UNO_QUERY),
m_aLocale);
- (*aIter)->second->SetFormatKey(nFormatKey);
+ elem->second->SetFormatKey(nFormatKey);
}
+ ++i;
}
}
}
@@ -840,12 +841,11 @@ Reference< XPreparedStatement > ODatabaseExport::createPreparedStatment( const R
}
// create the sql string
- std::vector< OUString>::const_iterator aInsertEnd = aInsertList.end();
- for (std::vector< OUString>::const_iterator aInsertIter = aInsertList.begin(); aInsertIter != aInsertEnd; ++aInsertIter)
+ for (auto const& elem : aInsertList)
{
- if ( !aInsertIter->isEmpty() )
+ if ( !elem.isEmpty() )
{
- aSql += *aInsertIter;
+ aSql += elem;
aSql += ",";
aValues += "?,";
}
diff --git a/dbaccess/source/ui/misc/RowSetDrop.cxx b/dbaccess/source/ui/misc/RowSetDrop.cxx
index c1cba83d2490..9bd1dc8a88ca 100644
--- a/dbaccess/source/ui/misc/RowSetDrop.cxx
+++ b/dbaccess/source/ui/misc/RowSetDrop.cxx
@@ -154,71 +154,70 @@ bool ORowSetImportExport::insertNewRow()
{
m_xTargetResultSetUpdate->moveToInsertRow();
sal_Int32 i = 1;
- std::vector<sal_Int32>::const_iterator aEnd = m_aColumnMapping.end();
- for (std::vector<sal_Int32>::const_iterator aIter = m_aColumnMapping.begin(); aIter != aEnd ;++aIter,++i )
+ for (auto const& column : m_aColumnMapping)
{
- if(*aIter > 0)
+ if(column > 0)
{
Any aValue;
switch(m_aColumnTypes[i-1])
{
case DataType::CHAR:
case DataType::VARCHAR:
- aValue <<= m_xRow->getString(*aIter);
+ aValue <<= m_xRow->getString(column);
break;
case DataType::DECIMAL:
case DataType::NUMERIC:
- aValue <<= m_xRow->getDouble(*aIter);
+ aValue <<= m_xRow->getDouble(column);
break;
case DataType::BIGINT:
- aValue <<= m_xRow->getLong(*aIter);
+ aValue <<= m_xRow->getLong(column);
break;
case DataType::FLOAT:
- aValue <<= m_xRow->getFloat(*aIter);
+ aValue <<= m_xRow->getFloat(column);
break;
case DataType::DOUBLE:
- aValue <<= m_xRow->getDouble(*aIter);
+ aValue <<= m_xRow->getDouble(column);
break;
case DataType::LONGVARCHAR:
- aValue <<= m_xRow->getString(*aIter);
+ aValue <<= m_xRow->getString(column);
break;
case DataType::LONGVARBINARY:
- aValue <<= m_xRow->getBytes(*aIter);
+ aValue <<= m_xRow->getBytes(column);
break;
case DataType::DATE:
- aValue <<= m_xRow->getDate(*aIter);
+ aValue <<= m_xRow->getDate(column);
break;
case DataType::TIME:
- aValue <<= m_xRow->getTime(*aIter);
+ aValue <<= m_xRow->getTime(column);
break;
case DataType::TIMESTAMP:
- aValue <<= m_xRow->getTimestamp(*aIter);
+ aValue <<= m_xRow->getTimestamp(column);
break;
case DataType::BIT:
case DataType::BOOLEAN:
- aValue <<= m_xRow->getBoolean(*aIter);
+ aValue <<= m_xRow->getBoolean(column);
break;
case DataType::TINYINT:
- aValue <<= m_xRow->getByte(*aIter);
+ aValue <<= m_xRow->getByte(column);
break;
case DataType::SMALLINT:
- aValue <<= m_xRow->getShort(*aIter);
+ aValue <<= m_xRow->getShort(column);
break;
case DataType::INTEGER:
- aValue <<= m_xRow->getInt(*aIter);
+ aValue <<= m_xRow->getInt(column);
break;
case DataType::REAL:
- aValue <<= m_xRow->getDouble(*aIter);
+ aValue <<= m_xRow->getDouble(column);
break;
case DataType::BINARY:
case DataType::VARBINARY:
- aValue <<= m_xRow->getBytes(*aIter);
+ aValue <<= m_xRow->getBytes(column);
break;
case DataType::BLOB:
- aValue <<= m_xRow->getBlob(*aIter);
+ aValue <<= m_xRow->getBlob(column);
break;
case DataType::CLOB:
- aValue <<= m_xRow->getClob(*aIter);
+ aValue <<= m_xRow->getClob(column);
break;
default:
SAL_WARN("dbaccess.ui", "Unknown type");
@@ -228,8 +227,9 @@ bool ORowSetImportExport::insertNewRow()
else
m_xTargetRowUpdate->updateObject(i,aValue);
}
- else if(*aIter == 0)//now we have know that we to set this column to null
+ else if(column == 0)//now we have know that we to set this column to null
m_xTargetRowUpdate->updateNull(i);
+ ++i;
}
m_xTargetResultSetUpdate->insertRow();
}