diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-03-09 15:54:13 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-03-09 18:31:12 +0100 |
commit | 31f96c3e0d13180447c45212158ee69e791c645a (patch) | |
tree | 3ec7744b25a3929cafd4bbdffd018a5036055ad7 /connectivity/source/drivers/macab | |
parent | 4e25914b165d7ed64b3026af758fb857676aacd5 (diff) |
Simplify containers iterations in connectivity
Use range-based loop or replace with STL functions
Change-Id: I1f7c1ea19cdc8d450b7ed88a663ba9ccb3249304
Reviewed-on: https://gerrit.libreoffice.org/68974
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'connectivity/source/drivers/macab')
4 files changed, 8 insertions, 15 deletions
diff --git a/connectivity/source/drivers/macab/MacabAddressBook.cxx b/connectivity/source/drivers/macab/MacabAddressBook.cxx index 93795cbc7d89..46570ef5ff57 100644 --- a/connectivity/source/drivers/macab/MacabAddressBook.cxx +++ b/connectivity/source/drivers/macab/MacabAddressBook.cxx @@ -93,14 +93,8 @@ MacabAddressBook::~MacabAddressBook() m_xMacabRecords = nullptr; } - if(!m_xMacabGroups.empty()) - { - std::vector<MacabGroup *>::iterator iter, end; - iter = m_xMacabGroups.begin(); - end = m_xMacabGroups.end(); - for( ; iter != end; ++iter) - delete *iter; - } + for(MacabGroup* pMacabGroup : m_xMacabGroups) + delete pMacabGroup; m_bRetrievedGroups = false; } diff --git a/connectivity/source/drivers/macab/MacabConnection.cxx b/connectivity/source/drivers/macab/MacabConnection.cxx index e55d342584d8..e52edf085412 100644 --- a/connectivity/source/drivers/macab/MacabConnection.cxx +++ b/connectivity/source/drivers/macab/MacabConnection.cxx @@ -259,9 +259,9 @@ void MacabConnection::disposing() // we noticed that we should be destroyed in near future so we have to dispose our statements ::osl::MutexGuard aGuard(m_aMutex); - for (OWeakRefArray::iterator i = m_aStatements.begin(); m_aStatements.end() != i; ++i) + for (auto& rxStatement : m_aStatements) { - Reference< XComponent > xComp(i->get(), UNO_QUERY); + Reference< XComponent > xComp(rxStatement.get(), UNO_QUERY); if (xComp.is()) xComp->dispose(); } diff --git a/connectivity/source/drivers/macab/MacabDriver.cxx b/connectivity/source/drivers/macab/MacabDriver.cxx index c1252c8bc1e5..73629973434e 100644 --- a/connectivity/source/drivers/macab/MacabDriver.cxx +++ b/connectivity/source/drivers/macab/MacabDriver.cxx @@ -204,9 +204,9 @@ void MacabDriver::disposing() ::osl::MutexGuard aGuard(m_aMutex); // when driver will be destroyed so all our connections have to be destroyed as well - for (OWeakRefArray::iterator i = m_xConnections.begin(); m_xConnections.end() != i; ++i) + for (auto& rxConnection : m_xConnections) { - Reference< XComponent > xComp(i->get(), UNO_QUERY); + Reference< XComponent > xComp(rxConnection.get(), UNO_QUERY); if (xComp.is()) xComp->dispose(); } diff --git a/connectivity/source/drivers/macab/MacabResultSetMetaData.cxx b/connectivity/source/drivers/macab/MacabResultSetMetaData.cxx index f3f2d5483f4f..e5a851d69dd2 100644 --- a/connectivity/source/drivers/macab/MacabResultSetMetaData.cxx +++ b/connectivity/source/drivers/macab/MacabResultSetMetaData.cxx @@ -43,7 +43,6 @@ MacabResultSetMetaData::~MacabResultSetMetaData() void MacabResultSetMetaData::setMacabFields(const ::rtl::Reference<connectivity::OSQLColumns> &xColumns) { - OSQLColumns::Vector::const_iterator aIter; static const char aName[] = "Name"; MacabRecords *aRecords; MacabHeader *aHeader; @@ -58,12 +57,12 @@ void MacabResultSetMetaData::setMacabFields(const ::rtl::Reference<connectivity: aHeader = aRecords->getHeader(); - for (aIter = xColumns->get().begin(); aIter != xColumns->get().end(); ++aIter) + for (const auto& rxColumn : xColumns->get()) { OUString aFieldName; sal_uInt32 nFieldNumber; - (*aIter)->getPropertyValue(aName) >>= aFieldName; + rxColumn->getPropertyValue(aName) >>= aFieldName; nFieldNumber = aHeader->getColumnNumber(aFieldName); m_aMacabFields.push_back(nFieldNumber); } |