summaryrefslogtreecommitdiff
path: root/scripting/source/protocolhandler
diff options
context:
space:
mode:
authorArkadiy Illarionov <qarkai@gmail.com>2019-07-27 23:20:29 +0300
committerArkadiy Illarionov <qarkai@gmail.com>2019-07-30 11:16:00 +0200
commit5ba84c3c7080d55d86b8b39db077b6da36cb700a (patch)
treea71491f3d336a314ab63e834bd013f0503be967b /scripting/source/protocolhandler
parent850693273970be2662cce8f4d2710b3657a02f65 (diff)
Simplify Sequence iterations in scaddins, sccomp, scripting
Use range-based loops, STL and comphelper functions Change-Id: I836422a1c81a3dc9585687ed2e506eb59bb4ec91 Reviewed-on: https://gerrit.libreoffice.org/76484 Tested-by: Jenkins Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com>
Diffstat (limited to 'scripting/source/protocolhandler')
-rw-r--r--scripting/source/protocolhandler/scripthandler.cxx19
1 files changed, 8 insertions, 11 deletions
diff --git a/scripting/source/protocolhandler/scripthandler.cxx b/scripting/source/protocolhandler/scripthandler.cxx
index c4b7a519beb6..d1a7fb9e8bb1 100644
--- a/scripting/source/protocolhandler/scripthandler.cxx
+++ b/scripting/source/protocolhandler/scripthandler.cxx
@@ -111,12 +111,9 @@ const Sequence < DispatchDescriptor >& seqDescriptor )
{
sal_Int32 nCount = seqDescriptor.getLength();
Sequence< Reference< XDispatch > > lDispatcher( nCount );
- for ( sal_Int32 i = 0; i < nCount; ++i )
- {
- lDispatcher[ i ] = queryDispatch( seqDescriptor[ i ].FeatureURL,
- seqDescriptor[ i ].FrameName,
- seqDescriptor[ i ].SearchFlags );
- }
+ std::transform(seqDescriptor.begin(), seqDescriptor.end(), lDispatcher.begin(),
+ [this](const DispatchDescriptor& rDescr) -> Reference<XDispatch> {
+ return queryDispatch(rDescr.FeatureURL, rDescr.FrameName, rDescr.SearchFlags); });
return lDispatcher;
}
@@ -184,18 +181,18 @@ void SAL_CALL ScriptProtocolHandler::dispatchWithNotification(
if ( lArgs.hasElements() )
{
int argCount = 0;
- for ( int index = 0; index < lArgs.getLength(); index++ )
+ for ( const auto& rArg : lArgs )
{
// Sometimes we get a propertyval with name = "Referer" or "SynchronMode". These
// are not actual arguments to be passed to script, but flags describing the
// call, so ignore. Who thought that passing such "meta-arguments" mixed in with
// real arguments was a good idea?
- if ( (lArgs[ index ].Name != "Referer" &&
- lArgs[ index ].Name != "SynchronMode") ||
- lArgs[ index ].Name.isEmpty() ) //TODO:???
+ if ( (rArg.Name != "Referer" &&
+ rArg.Name != "SynchronMode") ||
+ rArg.Name.isEmpty() ) //TODO:???
{
inArgs.realloc( ++argCount );
- inArgs[ argCount - 1 ] = lArgs[ index ].Value;
+ inArgs[ argCount - 1 ] = rArg.Value;
}
}
}