summaryrefslogtreecommitdiff
path: root/scripting/source/provider
diff options
context:
space:
mode:
authorArkadiy Illarionov <qarkai@gmail.com>2018-12-19 21:53:06 +0300
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-12-20 08:15:54 +0100
commitb38e690296e48657ec8c66427a6511f42f4b0115 (patch)
tree3ddf7f7df1bdba73552efa4a97cef92dff0bb4da /scripting/source/provider
parent45f0c58c615e1caf2bc8630924e2e4c89ac7bc4d (diff)
Simplify containers iterations in scaddins, sccomp, scripting
Use range-based loop or replace with STL functions Change-Id: I21ec2eea8f322e2792097d352fc352dc6099c7b7 Reviewed-on: https://gerrit.libreoffice.org/65461 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'scripting/source/provider')
-rw-r--r--scripting/source/provider/BrowseNodeFactoryImpl.cxx24
1 files changed, 13 insertions, 11 deletions
diff --git a/scripting/source/provider/BrowseNodeFactoryImpl.cxx b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
index a0ff04cf2e1f..6621d5453737 100644
--- a/scripting/source/provider/BrowseNodeFactoryImpl.cxx
+++ b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
@@ -105,17 +105,17 @@ public:
}
}
- std::vector< Sequence< Reference < browse::XBrowseNode > > >::const_iterator it = seqs.begin();
- std::vector< Sequence< Reference < browse::XBrowseNode > > >::const_iterator it_end = seqs.end();
-
Sequence< Reference < browse::XBrowseNode > > result( numChildren );
- for ( sal_Int32 index = 0; it != it_end && index < numChildren ; ++it )
+ sal_Int32 index = 0;
+ for ( Sequence< Reference < browse::XBrowseNode > >& children : seqs )
{
- Sequence< Reference < browse::XBrowseNode > > children = *it;
for ( sal_Int32 j = 0; j < children.getLength(); j++ )
{
result[ index++ ] = children[ j ];
}
+
+ if (index >= numChildren)
+ break;
}
return result;
}
@@ -411,10 +411,11 @@ public:
::std::sort( aVNodes.begin(), aVNodes.end(), alphaSortForBNodes() );
Sequence < Reference< browse::XBrowseNode > > children( aVNodes.size() );
- vXBrowseNodes::const_iterator it = aVNodes.begin();
- for ( sal_Int32 i=0; it != aVNodes.end() && i<children.getLength(); i++, ++it )
+ sal_Int32 i = 0;
+ for ( const auto& rxNode : aVNodes )
{
- children[ i ].set( *it );
+ children[ i ].set( rxNode );
+ i++;
}
return children;
}
@@ -501,10 +502,11 @@ public:
// no need to sort user, share, doc1...docN
//::std::sort( m_vNodes.begin(), m_vNodes.end(), alphaSortForBNodes() );
Sequence < Reference< browse::XBrowseNode > > children( m_vNodes.size() );
- vXBrowseNodes::const_iterator it = m_vNodes.begin();
- for ( sal_Int32 i=0; it != m_vNodes.end() && i<children.getLength(); i++, ++it )
+ sal_Int32 i = 0;
+ for ( const auto& rxNode : m_vNodes )
{
- children[ i ].set( *it );
+ children[ i ].set( rxNode );
+ i++;
}
return children;
}