diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2018-03-03 12:54:07 +0100 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2018-03-03 19:20:53 +0100 |
commit | ba7191ed0d4da2f5a2ebd2ef40387b26145860f1 (patch) | |
tree | e019dbd2dcc947c155e63841c2ec3a53eca427fb /chart2/source/controller/main/ObjectHierarchy.cxx | |
parent | 301514183d471cfeb085673eb4563f8c310162b7 (diff) |
Use for-range loops in chart2 (part1)
Change-Id: I9310a6dc79d47f9058df8a3b463667389af1b2cb
Reviewed-on: https://gerrit.libreoffice.org/50672
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'chart2/source/controller/main/ObjectHierarchy.cxx')
-rw-r--r-- | chart2/source/controller/main/ObjectHierarchy.cxx | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/chart2/source/controller/main/ObjectHierarchy.cxx b/chart2/source/controller/main/ObjectHierarchy.cxx index d11210666caf..062792b81aba 100644 --- a/chart2/source/controller/main/ObjectHierarchy.cxx +++ b/chart2/source/controller/main/ObjectHierarchy.cxx @@ -558,13 +558,12 @@ ObjectHierarchy::tChildContainer ImplObjectHierarchy::getSiblings( const ObjectI { if ( rNode.isValid() && !ObjectHierarchy::isRootNode( rNode ) ) { - for( tChildMap::const_iterator aIt( m_aChildMap.begin()); - aIt != m_aChildMap.end(); ++aIt ) + for (auto const& child : m_aChildMap) { ObjectHierarchy::tChildContainer::const_iterator aElemIt( - std::find( aIt->second.begin(), aIt->second.end(), rNode )); - if( aElemIt != aIt->second.end()) - return aIt->second; + std::find( child.second.begin(), child.second.end(), rNode )); + if( aElemIt != child.second.end()) + return child.second; } } return ObjectHierarchy::tChildContainer(); @@ -582,10 +581,10 @@ ObjectIdentifier ImplObjectHierarchy::getParentImpl( if( aIt != aChildren.end()) return rParentOID; - for( aIt = aChildren.begin(); aIt != aChildren.end(); ++aIt ) + for (auto const& child : aChildren) { // recursion - ObjectIdentifier aTempParent( getParentImpl( *aIt, rOID )); + ObjectIdentifier aTempParent( getParentImpl( child, rOID )); if ( aTempParent.isValid() ) { // exit on success @@ -665,11 +664,12 @@ sal_Int32 ObjectHierarchy::getIndexInParent( { ObjectIdentifier aParentOID( m_apImpl->getParent( rNode )); tChildContainer aChildren( m_apImpl->getChildren( aParentOID ) ); - tChildContainer::const_iterator aIt( aChildren.begin() ); - for( sal_Int32 nIndex = 0; aIt != aChildren.end(); ++nIndex, ++aIt ) + sal_Int32 nIndex = 0; + for (auto const& child : aChildren) { - if ( *aIt == rNode ) + if ( child == rNode ) return nIndex; + ++nIndex; } return -1; } |