From e06afb0c9546ddcde1cedd75f59001396ac6fdf2 Mon Sep 17 00:00:00 2001 From: Arkadiy Illarionov Date: Sat, 20 Oct 2018 22:15:25 +0300 Subject: Simplify containers iterations in ucb, ucbhelper Use range-based loop or replace with STL functions. Change-Id: I3cdb0f89523008199af1550de164a52b75c52ba5 Reviewed-on: https://gerrit.libreoffice.org/62088 Tested-by: Jenkins Reviewed-by: Noel Grandin --- ucb/source/ucp/package/pkgcontent.cxx | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) (limited to 'ucb/source/ucp/package') diff --git a/ucb/source/ucp/package/pkgcontent.cxx b/ucb/source/ucp/package/pkgcontent.cxx index 8158c13783ff..e428044625e8 100644 --- a/ucb/source/ucp/package/pkgcontent.cxx +++ b/ucb/source/ucp/package/pkgcontent.cxx @@ -1677,13 +1677,9 @@ void Content::destroy( ContentRefList aChildren; queryChildren( aChildren ); - ContentRefList::const_iterator it = aChildren.begin(); - ContentRefList::const_iterator end = aChildren.end(); - - while ( it != end ) + for ( auto& rChild : aChildren ) { - (*it)->destroy( bDeletePhysical, xEnv ); - ++it; + rChild->destroy( bDeletePhysical, xEnv ); } } } @@ -2003,12 +1999,9 @@ bool Content::exchangeIdentity( ContentRefList aChildren; queryChildren( aChildren ); - ContentRefList::const_iterator it = aChildren.begin(); - ContentRefList::const_iterator end = aChildren.end(); - - while ( it != end ) + for ( const auto& rChild : aChildren ) { - ContentRef xChild = (*it); + ContentRef xChild = rChild; // Create new content identifier for the child... uno::Reference< ucb::XContentIdentifier > xOldChildId @@ -2025,8 +2018,6 @@ bool Content::exchangeIdentity( if ( !xChild->exchangeIdentity( xNewChildId ) ) return false; - - ++it; } } return true; @@ -2056,12 +2047,9 @@ void Content::queryChildren( ContentRefList& rChildren ) sal_Int32 nLen = aURL.getLength(); - ::ucbhelper::ContentRefList::const_iterator it = aAllContents.begin(); - ::ucbhelper::ContentRefList::const_iterator end = aAllContents.end(); - - while ( it != end ) + for ( const auto& rContent : aAllContents ) { - ::ucbhelper::ContentImplHelperRef xChild = (*it); + ::ucbhelper::ContentImplHelperRef xChild = rContent; OUString aChildURL = xChild->getIdentifier()->getContentIdentifier(); @@ -2076,7 +2064,6 @@ void Content::queryChildren( ContentRefList& rChildren ) static_cast< Content * >( xChild.get() ) ); } } - ++it; } } -- cgit