summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2016-03-29 21:36:59 +0200
committerJulien Nabet <serval2412@yahoo.fr>2016-03-30 05:06:21 +0000
commita0527676b17838c310701f169ce23d0386b82eb6 (patch)
tree55f06881249f196372d399dc49c0e47d0552ed3d /svl
parent1d060568ce8e7b8aa04c418e282962131801bea4 (diff)
Use const_iterator when possible (svl except svdde)
Change-Id: Ie19467a020d1839146d5a6324e54ccf223d99dd6 Reviewed-on: https://gerrit.libreoffice.org/23603 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'svl')
-rw-r--r--svl/source/items/IndexedStyleSheets.cxx2
-rw-r--r--svl/source/items/itempool.cxx10
-rw-r--r--svl/source/items/poolio.cxx8
-rw-r--r--svl/source/items/slstitm.cxx2
-rw-r--r--svl/source/items/stylepool.cxx6
-rw-r--r--svl/source/misc/inettype.cxx10
-rw-r--r--svl/source/misc/sharedstringpool.cxx2
-rw-r--r--svl/source/notify/broadcast.cxx6
-rw-r--r--svl/source/notify/listener.cxx6
-rw-r--r--svl/source/numbers/numfmuno.cxx2
-rw-r--r--svl/source/numbers/zforlist.cxx18
-rw-r--r--svl/source/passwordcontainer/passwordcontainer.cxx4
12 files changed, 39 insertions, 37 deletions
diff --git a/svl/source/items/IndexedStyleSheets.cxx b/svl/source/items/IndexedStyleSheets.cxx
index c433864bc333..f543d18b15d6 100644
--- a/svl/source/items/IndexedStyleSheets.cxx
+++ b/svl/source/items/IndexedStyleSheets.cxx
@@ -170,7 +170,7 @@ IndexedStyleSheets::GetNthStyleSheetThatMatchesPredicate(
{
rtl::Reference<SfxStyleSheetBase> retval;
unsigned matching = 0;
- for (VectorType::iterator it = mStyleSheets.begin()+startAt; it != mStyleSheets.end(); ++it) {
+ for (VectorType::const_iterator it = mStyleSheets.begin()+startAt; it != mStyleSheets.end(); ++it) {
SfxStyleSheetBase *ssheet = it->get();
if (predicate.Check(*ssheet)) {
if (matching == n) {
diff --git a/svl/source/items/itempool.cxx b/svl/source/items/itempool.cxx
index 34153c729311..dda54dd4cee5 100644
--- a/svl/source/items/itempool.cxx
+++ b/svl/source/items/itempool.cxx
@@ -370,7 +370,7 @@ void SfxItemPool::Free(SfxItemPool* pPool)
{
// tell all the registered SfxItemPoolUsers that the pool is in destruction
std::vector<SfxItemPoolUser*> aListCopy(pPool->pImp->maSfxItemPoolUsers.begin(), pPool->pImp->maSfxItemPoolUsers.end());
- for(std::vector<SfxItemPoolUser*>::iterator aIterator = aListCopy.begin(); aIterator != aListCopy.end(); ++aIterator)
+ for(std::vector<SfxItemPoolUser*>::const_iterator aIterator = aListCopy.begin(); aIterator != aListCopy.end(); ++aIterator)
{
SfxItemPoolUser* pSfxItemPoolUser = *aIterator;
DBG_ASSERT(pSfxItemPoolUser, "corrupt SfxItemPoolUser list (!)");
@@ -411,7 +411,7 @@ void SfxItemPool::SetSecondaryPool( SfxItemPool *pPool )
SfxPoolItemArray_Impl* pItemArr = pImp->mpSecondary->pImp->maPoolItems[n];
if ( pItemArr )
{
- SfxPoolItemArrayBase_Impl::iterator ppHtArr = pItemArr->begin();
+ SfxPoolItemArrayBase_Impl::const_iterator ppHtArr = pItemArr->begin();
for( size_t i = pItemArr->size(); i; ++ppHtArr, --i )
if ( !(*ppHtArr) )
{
@@ -514,7 +514,7 @@ void SfxItemPool::Delete()
{
if ( *itrItemArr )
{
- SfxPoolItemArrayBase_Impl::iterator ppHtArr = (*itrItemArr)->begin();
+ SfxPoolItemArrayBase_Impl::const_iterator ppHtArr = (*itrItemArr)->begin();
for ( size_t n = (*itrItemArr)->size(); n; --n, ++ppHtArr )
if (*ppHtArr)
{
@@ -546,7 +546,7 @@ void SfxItemPool::Delete()
{
if ( *itrItemArr )
{
- SfxPoolItemArrayBase_Impl::iterator ppHtArr = (*itrItemArr)->begin();
+ SfxPoolItemArrayBase_Impl::const_iterator ppHtArr = (*itrItemArr)->begin();
for ( size_t n = (*itrItemArr)->size(); n; --n, ++ppHtArr )
if (*ppHtArr)
{
@@ -806,7 +806,7 @@ void SfxItemPool::Remove( const SfxPoolItem& rItem )
SfxPoolItemArray_Impl* pItemArr = pImp->maPoolItems[nIndex];
assert(pItemArr && "removing Item not in Pool");
- SfxPoolItemArray_Impl::PoolItemPtrToIndexMap::iterator it;
+ SfxPoolItemArray_Impl::PoolItemPtrToIndexMap::const_iterator it;
it = pItemArr->maPtrToIndex.find(const_cast<SfxPoolItem *>(&rItem));
if (it != pItemArr->maPtrToIndex.end())
{
diff --git a/svl/source/items/poolio.cxx b/svl/source/items/poolio.cxx
index 4cd3fabc893f..46c1c6abd1f5 100644
--- a/svl/source/items/poolio.cxx
+++ b/svl/source/items/poolio.cxx
@@ -183,7 +183,7 @@ SvStream &SfxItemPool::Store(SvStream &rStream) const
{
pImp->bInSetItem = ft != 0;
- std::vector<SfxPoolItemArray_Impl*>::iterator itrArr = pImp->maPoolItems.begin();
+ std::vector<SfxPoolItemArray_Impl*>::const_iterator itrArr = pImp->maPoolItems.begin();
SfxPoolItem **ppDefItem = pImp->ppStaticDefaults;
const sal_uInt16 nSize = GetSize_Impl();
for ( size_t i = 0; i < nSize && !rStream.GetError(); ++i, ++itrArr, ++ppDefItem )
@@ -312,7 +312,7 @@ void SfxItemPool::LoadCompleted()
if ( pImp->nInitRefCount > 1 )
{
// Iterate over all Which values
- std::vector<SfxPoolItemArray_Impl*>::iterator itrItemArr = pImp->maPoolItems.begin();
+ std::vector<SfxPoolItemArray_Impl*>::const_iterator itrItemArr = pImp->maPoolItems.begin();
for( sal_uInt16 nArrCnt = GetSize_Impl(); nArrCnt; --nArrCnt, ++itrItemArr )
{
// Is there an item with the Which value present at all?
@@ -470,13 +470,13 @@ SvStream &SfxItemPool::Load(SvStream &rStream)
{
// Iterate over all Which values
- std::vector<SfxPoolItemArray_Impl*>::iterator itrItemArr = pImp->maPoolItems.begin();
+ std::vector<SfxPoolItemArray_Impl*>::const_iterator itrItemArr = pImp->maPoolItems.begin();
for( size_t nArrCnt = GetSize_Impl(); nArrCnt; --nArrCnt, ++itrItemArr )
{
// Is there an Item with that Which value present at all?
if ( *itrItemArr )
{
- SfxPoolItemArrayBase_Impl::iterator ppHtArr = (*itrItemArr)->begin();
+ SfxPoolItemArrayBase_Impl::const_iterator ppHtArr = (*itrItemArr)->begin();
for( size_t n = (*itrItemArr)->size(); n; --n, ++ppHtArr )
if (*ppHtArr)
{
diff --git a/svl/source/items/slstitm.cxx b/svl/source/items/slstitm.cxx
index 11dac598010b..ec40ab2b4882 100644
--- a/svl/source/items/slstitm.cxx
+++ b/svl/source/items/slstitm.cxx
@@ -226,7 +226,7 @@ OUString SfxStringListItem::GetString()
{
DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid");
- std::vector<OUString>::iterator iter = pImp->aList.begin();
+ std::vector<OUString>::const_iterator iter = pImp->aList.begin();
for (;;)
{
aStr += *iter;
diff --git a/svl/source/items/stylepool.cxx b/svl/source/items/stylepool.cxx
index 9734bd152928..f75435a6c59b 100644
--- a/svl/source/items/stylepool.cxx
+++ b/svl/source/items/stylepool.cxx
@@ -129,7 +129,7 @@ namespace {
const bool bIsItemIgnorable )
{
Node* pNextNode = this;
- std::vector<Node*>::iterator aIter = mChildren.begin();
+ std::vector<Node*>::const_iterator aIter = mChildren.begin();
while( aIter != mChildren.end() )
{
if( rItem.Which() == (*aIter)->getPoolItem().Which() &&
@@ -165,7 +165,7 @@ namespace {
const bool bSkipIgnorable )
{
// Searching downstairs
- std::vector<Node*>::iterator aIter = mChildren.begin();
+ std::vector<Node*>::const_iterator aIter = mChildren.begin();
// For pLast == 0 and pLast == this all children are of interest
// for another pLast the search starts behind pLast...
if( pLast && pLast != this )
@@ -264,7 +264,7 @@ namespace {
Node::~Node()
{
- std::vector<Node*>::iterator aIter = mChildren.begin();
+ std::vector<Node*>::const_iterator aIter = mChildren.begin();
while( aIter != mChildren.end() )
{
delete *aIter;
diff --git a/svl/source/misc/inettype.cxx b/svl/source/misc/inettype.cxx
index fc99529d5902..dddf64352b21 100644
--- a/svl/source/misc/inettype.cxx
+++ b/svl/source/misc/inettype.cxx
@@ -112,7 +112,7 @@ inline TypeIDMapEntry * Registration::getEntry(INetContentType eTypeID)
{
Registration &rRegistration = theRegistration::get();
- TypeIDMap::iterator it = rRegistration.m_aTypeIDMap.find( eTypeID );
+ TypeIDMap::const_iterator it = rRegistration.m_aTypeIDMap.find( eTypeID );
if( it != rRegistration.m_aTypeIDMap.end() )
return it->second;
else
@@ -456,7 +456,7 @@ INetContentType Registration::GetContentType(OUString const & rTypeName)
Registration &rRegistration = theRegistration::get();
OUString aTheTypeName = rTypeName.toAsciiLowerCase();
- TypeNameMap::iterator it = rRegistration.m_aTypeNameMap.find(aTheTypeName);
+ TypeNameMap::const_iterator it = rRegistration.m_aTypeNameMap.find(aTheTypeName);
return it != rRegistration.m_aTypeNameMap.end()
? it->second.m_eTypeID
: CONTENT_TYPE_UNKNOWN;
@@ -467,7 +467,7 @@ OUString Registration::GetContentType(INetContentType eTypeID)
{
Registration &rRegistration = theRegistration::get();
- TypeIDMap::iterator pEntry = rRegistration.m_aTypeIDMap.find( eTypeID );
+ TypeIDMap::const_iterator pEntry = rRegistration.m_aTypeIDMap.find( eTypeID );
if( pEntry != rRegistration.m_aTypeIDMap.end() )
return pEntry->second->m_aTypeName;
return OUString();
@@ -478,7 +478,7 @@ OUString Registration::GetPresentation(INetContentType eTypeID)
{
Registration &rRegistration = theRegistration::get();
- TypeIDMap::iterator pEntry = rRegistration.m_aTypeIDMap.find( eTypeID );
+ TypeIDMap::const_iterator pEntry = rRegistration.m_aTypeIDMap.find( eTypeID );
if( pEntry != rRegistration.m_aTypeIDMap.end() )
return pEntry->second->m_aPresentation;
else
@@ -490,7 +490,7 @@ INetContentType Registration::GetContentType4Extension(OUString const & rExtensi
{
Registration &rRegistration = theRegistration::get();
- ExtensionMap::iterator it = rRegistration.m_aExtensionMap.find(rExtension);
+ ExtensionMap::const_iterator it = rRegistration.m_aExtensionMap.find(rExtension);
return it != rRegistration.m_aExtensionMap.end()
? it->second.m_eTypeID
: CONTENT_TYPE_UNKNOWN;
diff --git a/svl/source/misc/sharedstringpool.cxx b/svl/source/misc/sharedstringpool.cxx
index 70d76955ed50..d1b5aa695a1d 100644
--- a/svl/source/misc/sharedstringpool.cxx
+++ b/svl/source/misc/sharedstringpool.cxx
@@ -85,7 +85,7 @@ SharedString SharedStringPool::intern( const OUString& rStr )
if (!aRes.second)
{
// No new string has been inserted. Return the existing string in the pool.
- StrStoreType::iterator it = mpImpl->maStrStore.find(pOrig);
+ StrStoreType::const_iterator it = mpImpl->maStrStore.find(pOrig);
if (it == mpImpl->maStrStore.end())
return SharedString();
diff --git a/svl/source/notify/broadcast.cxx b/svl/source/notify/broadcast.cxx
index b7415ad39006..2a9338ca787e 100644
--- a/svl/source/notify/broadcast.cxx
+++ b/svl/source/notify/broadcast.cxx
@@ -79,7 +79,7 @@ SvtBroadcaster::SvtBroadcaster( const SvtBroadcaster &rBC ) :
if (mbAboutToDie)
Normalize();
- ListenersType::iterator dest(maDestructedListeners.begin());
+ ListenersType::const_iterator dest(maDestructedListeners.begin());
for (ListenersType::iterator it(maListeners.begin()); it != maListeners.end(); ++it)
{
bool bStart = true;
@@ -108,7 +108,7 @@ SvtBroadcaster::~SvtBroadcaster()
// now when both lists are sorted, we can linearly unregister all
// listeners, with the exception of those that already asked to be removed
// during their own destruction
- ListenersType::iterator dest(maDestructedListeners.begin());
+ ListenersType::const_iterator dest(maDestructedListeners.begin());
for (ListenersType::iterator it(maListeners.begin()); it != maListeners.end(); ++it)
{
// skip the destructed ones
@@ -124,7 +124,7 @@ void SvtBroadcaster::Broadcast( const SfxHint &rHint )
{
Normalize();
- ListenersType::iterator dest(maDestructedListeners.begin());
+ ListenersType::const_iterator dest(maDestructedListeners.begin());
ListenersType aListeners(maListeners); // this copy is important to avoid erasing entries while iterating
for (ListenersType::iterator it(aListeners.begin()); it != aListeners.end(); ++it)
{
diff --git a/svl/source/notify/listener.cxx b/svl/source/notify/listener.cxx
index 52adeb948de9..e1f193cb3753 100644
--- a/svl/source/notify/listener.cxx
+++ b/svl/source/notify/listener.cxx
@@ -67,7 +67,8 @@ bool SvtListener::EndListening( SvtBroadcaster& rBroadcaster )
void SvtListener::EndListeningAll()
{
- BroadcastersType::iterator it = maBroadcasters.begin(), itEnd = maBroadcasters.end();
+ BroadcastersType::iterator it = maBroadcasters.begin();
+ BroadcastersType::const_iterator itEnd = maBroadcasters.end();
for (; it != itEnd; ++it)
{
SvtBroadcaster& rBC = **it;
@@ -81,7 +82,8 @@ void SvtListener::CopyAllBroadcasters( const SvtListener& r )
{
BroadcastersType aCopy(r.maBroadcasters);
maBroadcasters.swap(aCopy);
- BroadcastersType::iterator it = maBroadcasters.begin(), itEnd = maBroadcasters.end();
+ BroadcastersType::iterator it = maBroadcasters.begin();
+ BroadcastersType::const_iterator itEnd = maBroadcasters.end();
for (; it != itEnd; ++it)
{
SvtBroadcaster* p = *it;
diff --git a/svl/source/numbers/numfmuno.cxx b/svl/source/numbers/numfmuno.cxx
index 42d55a544346..368dde3e3174 100644
--- a/svl/source/numbers/numfmuno.cxx
+++ b/svl/source/numbers/numfmuno.cxx
@@ -428,7 +428,7 @@ uno::Sequence<sal_Int32> SAL_CALL SvNumberFormatsObj::queryKeys( sal_Int16 nType
uno::Sequence<sal_Int32> aSeq(nCount);
sal_Int32* pAry = aSeq.getArray();
sal_uInt32 i=0;
- for (SvNumberFormatTable::iterator it = rTable.begin(); it != rTable.end(); ++it, ++i)
+ for (SvNumberFormatTable::const_iterator it = rTable.begin(); it != rTable.end(); ++it, ++i)
pAry[i] = it->first;
return aSeq;
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index dd48e2cad78e..70a013aea6d7 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -884,7 +884,7 @@ sal_uInt32 SvNumberFormatter::ImpIsEntry(const OUString& rString,
LanguageType eLnge)
{
sal_uInt32 res = NUMBERFORMAT_ENTRY_NOT_FOUND;
- SvNumberFormatTable::iterator it = aFTable.find( nCLOffset);
+ SvNumberFormatTable::const_iterator it = aFTable.find( nCLOffset);
while ( res == NUMBERFORMAT_ENTRY_NOT_FOUND &&
it != aFTable.end() && it->second->GetLanguage() == eLnge )
{
@@ -1233,7 +1233,7 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultFormat( short nType )
nSearch = CLOffset + ZF_STANDARD;
}
- DefaultFormatKeysMap::iterator it = aDefaultFormatKeys.find( nSearch);
+ DefaultFormatKeysMap::const_iterator it = aDefaultFormatKeys.find( nSearch);
sal_uInt32 nDefaultFormat = (it != aDefaultFormatKeys.end() ?
it->second : NUMBERFORMAT_ENTRY_NOT_FOUND);
if ( nDefaultFormat == NUMBERFORMAT_ENTRY_NOT_FOUND )
@@ -1241,7 +1241,7 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultFormat( short nType )
// look for a defined standard
sal_uInt32 nStopKey = CLOffset + SV_COUNTRY_LANGUAGE_OFFSET;
sal_uInt32 nKey(0);
- SvNumberFormatTable::iterator it2 = aFTable.find( CLOffset );
+ SvNumberFormatTable::const_iterator it2 = aFTable.find( CLOffset );
while ( it2 != aFTable.end() && (nKey = it2->first ) >= CLOffset && nKey < nStopKey )
{
const SvNumberformat* pEntry = it2->second;
@@ -2196,7 +2196,7 @@ void SvNumberFormatter::ImpAdjustFormatCodeDefault(
SvNumberformat* SvNumberFormatter::GetFormatEntry( sal_uInt32 nKey )
{
- SvNumberFormatTable::iterator it = aFTable.find( nKey);
+ SvNumberFormatTable::const_iterator it = aFTable.find( nKey);
if (it != aFTable.end())
return it->second;
return nullptr;
@@ -3010,7 +3010,7 @@ SvNumberFormatterIndexTable* SvNumberFormatter::MergeFormatter(SvNumberFormatter
sal_uInt32 nOldKey, nOffset, nNewKey;
SvNumberformat* pNewEntry;
- SvNumberFormatTable::iterator it = rTable.aFTable.begin();
+ SvNumberFormatTable::const_iterator it = rTable.aFTable.begin();
while (it != rTable.aFTable.end())
{
SvNumberformat* pFormat = it->second;
@@ -3087,7 +3087,7 @@ SvNumberFormatterMergeMap SvNumberFormatter::ConvertMergeTableToMap()
return SvNumberFormatterMergeMap();
}
SvNumberFormatterMergeMap aMap;
- for (SvNumberFormatterIndexTable::iterator it = pMergeTable->begin(); it != pMergeTable->end(); ++it)
+ for (SvNumberFormatterIndexTable::const_iterator it = pMergeTable->begin(); it != pMergeTable->end(); ++it)
{
sal_uInt32 nOldKey = it->first;
aMap[ nOldKey ] = it->second;
@@ -3358,7 +3358,7 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultSystemCurrencyFormat()
sal_uInt32 SvNumberFormatter::ImpGetDefaultCurrencyFormat()
{
sal_uInt32 CLOffset = ImpGetCLOffset( ActLnge );
- DefaultFormatKeysMap::iterator it = aDefaultFormatKeys.find( CLOffset + ZF_STANDARD_CURRENCY );
+ DefaultFormatKeysMap::const_iterator it = aDefaultFormatKeys.find( CLOffset + ZF_STANDARD_CURRENCY );
sal_uInt32 nDefaultCurrencyFormat = (it != aDefaultFormatKeys.end() ?
it->second : NUMBERFORMAT_ENTRY_NOT_FOUND);
if ( nDefaultCurrencyFormat == NUMBERFORMAT_ENTRY_NOT_FOUND )
@@ -3366,7 +3366,7 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultCurrencyFormat()
// look for a defined standard
sal_uInt32 nStopKey = CLOffset + SV_COUNTRY_LANGUAGE_OFFSET;
sal_uInt32 nKey(0);
- SvNumberFormatTable::iterator it2 = aFTable.lower_bound( CLOffset );
+ SvNumberFormatTable::const_iterator it2 = aFTable.lower_bound( CLOffset );
while ( it2 != aFTable.end() && (nKey = it2->first) >= CLOffset && nKey < nStopKey )
{
const SvNumberformat* pEntry = it2->second;
@@ -3950,7 +3950,7 @@ sal_uInt32 SvNumberFormatter::GetMergeFormatIndex( sal_uInt32 nOldFmt ) const
{
if (pMergeTable)
{
- SvNumberFormatterIndexTable::iterator it = pMergeTable->find(nOldFmt);
+ SvNumberFormatterIndexTable::const_iterator it = pMergeTable->find(nOldFmt);
if (it != pMergeTable->end())
{
return it->second;
diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx b/svl/source/passwordcontainer/passwordcontainer.cxx
index 456efd42f8d8..93d627c16177 100644
--- a/svl/source/passwordcontainer/passwordcontainer.cxx
+++ b/svl/source/passwordcontainer/passwordcontainer.cxx
@@ -1008,10 +1008,10 @@ Sequence< UrlRecord > SAL_CALL PasswordContainer::getAllPersistent( const Refere
Sequence< UrlRecord > aResult;
::osl::MutexGuard aGuard( mMutex );
- for( PassMap::iterator aIter = m_aContainer.begin(); aIter != m_aContainer.end(); ++aIter )
+ for( PassMap::const_iterator aIter = m_aContainer.begin(); aIter != m_aContainer.end(); ++aIter )
{
Sequence< UserRecord > aUsers;
- for( list< NamePassRecord >::iterator aNPIter = aIter->second.begin(); aNPIter != aIter->second.end(); ++aNPIter )
+ for( list< NamePassRecord >::const_iterator aNPIter = aIter->second.begin(); aNPIter != aIter->second.end(); ++aNPIter )
if( aNPIter->HasPasswords( PERSISTENT_RECORD ) )
{
sal_Int32 oldLen = aUsers.getLength();