summaryrefslogtreecommitdiff
path: root/scripting/source/provider/URIHelper.cxx
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/provider/URIHelper.cxx
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/provider/URIHelper.cxx')
-rw-r--r--scripting/source/provider/URIHelper.cxx26
1 files changed, 12 insertions, 14 deletions
diff --git a/scripting/source/provider/URIHelper.cxx b/scripting/source/provider/URIHelper.cxx
index 172f0ac0ae66..650d019d1779 100644
--- a/scripting/source/provider/URIHelper.cxx
+++ b/scripting/source/provider/URIHelper.cxx
@@ -144,23 +144,21 @@ ScriptingFrameworkURIHelper::initBaseURI()
uno::Sequence< OUString > children =
m_xSimpleFileAccess->getFolderContents( uri, true );
- for ( sal_Int32 i = 0; i < children.getLength(); i++ )
- {
- OUString child = children[i];
+ auto pChild = std::find_if(children.begin(), children.end(), [&test](const OUString& child) {
sal_Int32 idx = child.lastIndexOf(test);
-
- if ( idx != -1 && (idx + test.getLength()) == child.getLength() )
+ return idx != -1 && (idx + test.getLength()) == child.getLength();
+ });
+ if (pChild != children.end())
+ {
+ if ( bAppendScriptsPart )
{
- if ( bAppendScriptsPart )
- {
- m_sBaseURI = child.concat( SCRIPTS_PART );
- }
- else
- {
- m_sBaseURI = child;
- }
- return true;
+ m_sBaseURI = pChild->concat( SCRIPTS_PART );
}
+ else
+ {
+ m_sBaseURI = *pChild;
+ }
+ return true;
}
return false;
}