diff options
author | Noel Grandin <noel@peralex.com> | 2016-05-10 14:39:07 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-05-11 06:54:34 +0000 |
commit | 265068d65b39688b8a4756dfbcd46453dd1f9b70 (patch) | |
tree | 6936185b2f2f46b99646d00e542cdde845ef073d /svl | |
parent | 9e0335d1db22bd3ad3f4bb249b30a00fd55558f4 (diff) |
clang-tidy modernize-loop-convert in scripting to svtools
Change-Id: I98229d14109cf243839d632feabde1391ea9bad5
Reviewed-on: https://gerrit.libreoffice.org/24847
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'svl')
-rw-r--r-- | svl/source/items/aeitem.cxx | 4 | ||||
-rw-r--r-- | svl/source/items/itempool.cxx | 3 | ||||
-rw-r--r-- | svl/source/items/poolcach.cxx | 9 | ||||
-rw-r--r-- | svl/source/items/poolio.cxx | 6 | ||||
-rw-r--r-- | svl/source/misc/sharecontrolfile.cxx | 32 | ||||
-rw-r--r-- | svl/source/numbers/zforlist.cxx | 12 | ||||
-rw-r--r-- | svl/source/numbers/zformat.cxx | 14 |
7 files changed, 38 insertions, 42 deletions
diff --git a/svl/source/items/aeitem.cxx b/svl/source/items/aeitem.cxx index 730aa1718ad6..c4f9f117cf93 100644 --- a/svl/source/items/aeitem.cxx +++ b/svl/source/items/aeitem.cxx @@ -180,8 +180,8 @@ bool SfxAllEnumItem::IsEnabled( sal_uInt16 nValue ) const { if ( pDisabledValues ) { - for ( size_t i=0; i<pDisabledValues->size(); i++ ) - if ( (*pDisabledValues)[i] == nValue ) + for (sal_uInt16 nDisabledValue : *pDisabledValues) + if ( nDisabledValue == nValue ) return false; } diff --git a/svl/source/items/itempool.cxx b/svl/source/items/itempool.cxx index dda54dd4cee5..d0d1ceea753c 100644 --- a/svl/source/items/itempool.cxx +++ b/svl/source/items/itempool.cxx @@ -245,9 +245,8 @@ SfxItemPool::SfxItemPool } // Copy Version map - for ( size_t nVer = 0; nVer < rPool.pImp->aVersions.size(); ++nVer ) + for (std::shared_ptr<SfxPoolVersion_Impl>& pOld : rPool.pImp->aVersions) { - const SfxPoolVersion_ImplPtr pOld = rPool.pImp->aVersions[nVer]; SfxPoolVersion_ImplPtr pNew = SfxPoolVersion_ImplPtr( new SfxPoolVersion_Impl( *pOld ) ); pImp->aVersions.push_back( pNew ); } diff --git a/svl/source/items/poolcach.cxx b/svl/source/items/poolcach.cxx index 994884baedf5..947aee32795d 100644 --- a/svl/source/items/poolcach.cxx +++ b/svl/source/items/poolcach.cxx @@ -48,9 +48,9 @@ SfxItemPoolCache::SfxItemPoolCache( SfxItemPool *pItemPool, SfxItemPoolCache::~SfxItemPoolCache() { - for ( size_t nPos = 0; nPos < pCache->size(); ++nPos ) { - pPool->Remove( *(*pCache)[nPos].pPoolItem ); - pPool->Remove( *(*pCache)[nPos].pOrigItem ); + for (SfxItemModifyImpl & rImpl : *pCache) { + pPool->Remove( *rImpl.pPoolItem ); + pPool->Remove( *rImpl.pOrigItem ); } delete pCache; pCache = nullptr; @@ -66,9 +66,8 @@ const SfxSetItem& SfxItemPoolCache::ApplyTo( const SfxSetItem &rOrigItem ) "original not in pool" ); // Find whether this Transformations ever occurred - for ( size_t nPos = 0; nPos < pCache->size(); ++nPos ) + for (SfxItemModifyImpl & rMapEntry : *pCache) { - SfxItemModifyImpl &rMapEntry = (*pCache)[nPos]; if ( rMapEntry.pOrigItem == &rOrigItem ) { // Did anything change at all? diff --git a/svl/source/items/poolio.cxx b/svl/source/items/poolio.cxx index 46c1c6abd1f5..d3837e957070 100644 --- a/svl/source/items/poolio.cxx +++ b/svl/source/items/poolio.cxx @@ -155,10 +155,9 @@ SvStream &SfxItemPool::Store(SvStream &rStream) const // VersionMaps { SfxMultiVarRecordWriter aVerRec( &rStream, SFX_ITEMPOOL_REC_VERSIONMAP ); - for ( size_t nVerNo = 0; nVerNo < pImp->aVersions.size(); ++nVerNo ) + for (std::shared_ptr<SfxPoolVersion_Impl>& pVer : pImp->aVersions) { aVerRec.NewContent(); - SfxPoolVersion_ImplPtr pVer = pImp->aVersions[nVerNo]; rStream.WriteUInt16( pVer->_nVer ).WriteUInt16( pVer->_nStart ).WriteUInt16( pVer->_nEnd ); sal_uInt16 nCount = pVer->_nEnd - pVer->_nStart + 1; sal_uInt16 nNewWhich = 0; @@ -1078,9 +1077,8 @@ sal_uInt16 SfxItemPool::GetNewWhich else if ( nDiff < 0 ) { // Map step by step from the top version down to the file version - for ( size_t nMap = 0; nMap < pImp->aVersions.size(); ++nMap ) + for (std::shared_ptr<SfxPoolVersion_Impl>& pVerInfo : pImp->aVersions) { - SfxPoolVersion_ImplPtr pVerInfo = pImp->aVersions[nMap]; if ( pVerInfo->_nVer > pImp->nLoadingVersion ) { if (nFileWhich >= pVerInfo->_nStart && diff --git a/svl/source/misc/sharecontrolfile.cxx b/svl/source/misc/sharecontrolfile.cxx index 1630dd24643b..ca95115e3ca6 100644 --- a/svl/source/misc/sharecontrolfile.cxx +++ b/svl/source/misc/sharecontrolfile.cxx @@ -205,11 +205,11 @@ void ShareControlFile::SetUsersDataAndStore( const std::vector< LockFileEntry >& m_xSeekable->seek( 0 ); OUStringBuffer aBuffer; - for ( size_t nInd = 0; nInd < aUsersData.size(); nInd++ ) + for (const auto & rData : aUsersData) { for ( LockFileComponent nEntryInd : o3tl::enumrange<LockFileComponent>() ) { - aBuffer.append( EscapeCharacters( aUsersData[nInd][nEntryInd] ) ); + aBuffer.append( EscapeCharacters( rData[nEntryInd] ) ); if ( nEntryInd < LockFileComponent::LAST ) aBuffer.append( ',' ); else @@ -237,11 +237,11 @@ LockFileEntry ShareControlFile::InsertOwnEntry() bool bExists = false; sal_Int32 nNewInd = 0; - for ( size_t nInd = 0; nInd < m_aUsersData.size(); nInd++ ) + for (LockFileEntry & rEntry : m_aUsersData) { - if ( m_aUsersData[nInd][LockFileComponent::LOCALHOST] == aNewEntry[LockFileComponent::LOCALHOST] - && m_aUsersData[nInd][LockFileComponent::SYSUSERNAME] == aNewEntry[LockFileComponent::SYSUSERNAME] - && m_aUsersData[nInd][LockFileComponent::USERURL] == aNewEntry[LockFileComponent::USERURL] ) + if ( rEntry[LockFileComponent::LOCALHOST] == aNewEntry[LockFileComponent::LOCALHOST] + && rEntry[LockFileComponent::SYSUSERNAME] == aNewEntry[LockFileComponent::SYSUSERNAME] + && rEntry[LockFileComponent::USERURL] == aNewEntry[LockFileComponent::USERURL] ) { if ( !bExists ) { @@ -251,7 +251,7 @@ LockFileEntry ShareControlFile::InsertOwnEntry() } else { - aNewData[nNewInd] = m_aUsersData[nInd]; + aNewData[nNewInd] = rEntry; } nNewInd++; @@ -278,11 +278,11 @@ bool ShareControlFile::HasOwnEntry() GetUsersData(); LockFileEntry aEntry = GenerateOwnEntry(); - for ( size_t nInd = 0; nInd < m_aUsersData.size(); ++nInd ) + for (LockFileEntry & rEntry : m_aUsersData) { - if ( m_aUsersData[nInd][LockFileComponent::LOCALHOST] == aEntry[LockFileComponent::LOCALHOST] && - m_aUsersData[nInd][LockFileComponent::SYSUSERNAME] == aEntry[LockFileComponent::SYSUSERNAME] && - m_aUsersData[nInd][LockFileComponent::USERURL] == aEntry[LockFileComponent::USERURL] ) + if ( rEntry[LockFileComponent::LOCALHOST] == aEntry[LockFileComponent::LOCALHOST] && + rEntry[LockFileComponent::SYSUSERNAME] == aEntry[LockFileComponent::SYSUSERNAME] && + rEntry[LockFileComponent::USERURL] == aEntry[LockFileComponent::USERURL] ) { return true; } @@ -308,13 +308,13 @@ void ShareControlFile::RemoveEntry( const LockFileEntry& aEntry ) std::vector< LockFileEntry > aNewData; - for ( size_t nInd = 0; nInd < m_aUsersData.size(); nInd++ ) + for (LockFileEntry & rEntry : m_aUsersData) { - if ( m_aUsersData[nInd][LockFileComponent::LOCALHOST] != aEntry[LockFileComponent::LOCALHOST] - || m_aUsersData[nInd][LockFileComponent::SYSUSERNAME] != aEntry[LockFileComponent::SYSUSERNAME] - || m_aUsersData[nInd][LockFileComponent::USERURL] != aEntry[LockFileComponent::USERURL] ) + if ( rEntry[LockFileComponent::LOCALHOST] != aEntry[LockFileComponent::LOCALHOST] + || rEntry[LockFileComponent::SYSUSERNAME] != aEntry[LockFileComponent::SYSUSERNAME] + || rEntry[LockFileComponent::USERURL] != aEntry[LockFileComponent::USERURL] ) { - aNewData.push_back( m_aUsersData[nInd] ); + aNewData.push_back( rEntry ); } } diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index 3d00f07520af..91037ff09f86 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -207,19 +207,19 @@ void SvNumberFormatterRegistry_Impl::ConfigurationChanged( utl::ConfigurationBro if ( nHint & SYSLOCALEOPTIONS_HINT_LOCALE ) { - for( size_t i = 0, n = aFormatters.size(); i < n; ++i ) - aFormatters[ i ]->ReplaceSystemCL( eSysLanguage ); + for(SvNumberFormatter* pFormatter : aFormatters) + pFormatter->ReplaceSystemCL( eSysLanguage ); eSysLanguage = MsLangId::getRealLanguage( LANGUAGE_SYSTEM ); } if ( nHint & SYSLOCALEOPTIONS_HINT_CURRENCY ) { - for( size_t i = 0, n = aFormatters.size(); i < n; ++i ) - aFormatters[ i ]->ResetDefaultSystemCurrency(); + for(SvNumberFormatter* pFormatter : aFormatters) + pFormatter->ResetDefaultSystemCurrency(); } if ( nHint & SYSLOCALEOPTIONS_HINT_DATEPATTERNS ) { - for( size_t i = 0, n = aFormatters.size(); i < n; ++i ) - aFormatters[ i ]->InvalidateDateAcceptancePatterns(); + for(SvNumberFormatter* pFormatter : aFormatters) + pFormatter->InvalidateDateAcceptancePatterns(); } } diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index bd1e21e9e33f..0529f271979c 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -1635,20 +1635,20 @@ void SvNumberformat::ConvertLanguage( SvNumberFormatter& rConverter, ImpCopyNumberformat( *pFormat ); // Reset values taken over from Formatter/Scanner // pColor still points to table in temporary Formatter/Scanner - for ( sal_uInt16 i = 0; i < 4; i++ ) + for (ImpSvNumFor & rFormatter : NumFor) { - OUString aColorName = NumFor[i].GetColorName(); + OUString aColorName = rFormatter.GetColorName(); Color* pColor = rScan.GetColor( aColorName ); - NumFor[i].SetColor( pColor, aColorName ); + rFormatter.SetColor( pColor, aColorName ); } } } bool SvNumberformat::HasNewCurrency() const { - for ( sal_uInt16 j=0; j<4; j++ ) + for (const auto & j : NumFor) { - if ( NumFor[j].HasNewCurrency() ) + if ( j.HasNewCurrency() ) { return true; } @@ -1659,9 +1659,9 @@ bool SvNumberformat::HasNewCurrency() const bool SvNumberformat::GetNewCurrencySymbol( OUString& rSymbol, OUString& rExtension ) const { - for ( sal_uInt16 j=0; j<4; j++ ) + for (const auto & j : NumFor) { - if ( NumFor[j].GetNewCurrencySymbol( rSymbol, rExtension ) ) + if ( j.GetNewCurrencySymbol( rSymbol, rExtension ) ) { return true; } |