diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-03-15 04:49:36 +0100 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-03-16 23:35:28 +0100 |
commit | a21948bddfefa8554fb2d468616ec1bfda128e9d (patch) | |
tree | 6f68f60219f9e843d13a6a0609b9f5712f629b4d | |
parent | 3b4e5fd012be12478fed5c55f53cfd9cc4747a0e (diff) |
refactor iteration
Change-Id: Ifc2e190fa54e2e1e8992ae7e4e3ff15465b6db3d
-rw-r--r-- | sw/source/core/attr/calbck.cxx | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx index 636ee94b7433..0ea5389f929c 100644 --- a/sw/source/core/attr/calbck.cxx +++ b/sw/source/core/attr/calbck.cxx @@ -75,12 +75,8 @@ SwModify::~SwModify() // forget me so that they don't try to get removed from my list // later when they also get destroyed SwClientIter aIter( *this ); - SwClient* p = aIter.GoStart(); - while ( p ) - { - p->pRegisteredIn = nullptr; - p = ++aIter; - } + for(aIter.GoStart(); aIter; ++aIter) + aIter->pRegisteredIn = nullptr; } else { @@ -136,22 +132,13 @@ void SwModify::NotifyClients( const SfxPoolItem* pOldValue, const SfxPoolItem* p bool SwModify::GetInfo( SfxPoolItem& rInfo ) const { - bool bRet = true; // means: continue with next - - if( pRoot ) - { - SwClientIter aIter( *(SwModify*)this ); - - SwClient* pLast = aIter.GoStart(); - if( pLast ) - { - while( ( bRet = pLast->GetInfo( rInfo ) ) && - nullptr != ( pLast = ++aIter ) ) - ; - } - } - - return bRet; + if(!pRoot) + return true; + SwClientIter aIter( *const_cast<SwModify*>(this) ); + for(aIter.GoStart(); aIter; ++aIter) + if(!aIter->GetInfo( rInfo )) + return false; + return true; } void SwModify::Add( SwClient* pDepend ) |