diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-06-15 17:13:48 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-06-18 09:43:08 +0200 |
commit | 452a8e4abe0c416d664078baddff67c1561025ec (patch) | |
tree | 037f973aebd5e740d97525ff7aa852515762ae0b /vcl/source/uitest | |
parent | e1eb7cb04a4c30cec238ab0f54d41a6cdc3299c1 (diff) |
Simplify Sequence iterations in vcl
Use range-based loops or replace with comphelper or STL functions
Change-Id: If046738084c2d13cc1eaea6a03aaf60b63f62767
Reviewed-on: https://gerrit.libreoffice.org/74104
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/source/uitest')
-rw-r--r-- | vcl/source/uitest/logger.cxx | 7 | ||||
-rw-r--r-- | vcl/source/uitest/uitest.cxx | 6 | ||||
-rw-r--r-- | vcl/source/uitest/uno/uiobject_uno.cxx | 6 |
3 files changed, 7 insertions, 12 deletions
diff --git a/vcl/source/uitest/logger.cxx b/vcl/source/uitest/logger.cxx index f60cb2322367..d100d1bbf125 100644 --- a/vcl/source/uitest/logger.cxx +++ b/vcl/source/uitest/logger.cxx @@ -43,15 +43,12 @@ void UITestLogger::logCommand(const OUString& rAction, const css::uno::Sequence< return; OUStringBuffer aBuffer(rAction); - sal_Int32 nCount = rArgs.getLength(); - if (nCount > 0) + if (rArgs.hasElements()) { aBuffer.append(" {"); - for (sal_Int32 n = 0; n < nCount; n++) + for (const css::beans::PropertyValue& rProp : rArgs) { - const css::beans::PropertyValue& rProp = rArgs[n]; - OUString aTypeName = rProp.Value.getValueTypeName(); if (aTypeName == "long" || aTypeName == "short") diff --git a/vcl/source/uitest/uitest.cxx b/vcl/source/uitest/uitest.cxx index b4c89d1e4516..58c58ab3c468 100644 --- a/vcl/source/uitest/uitest.cxx +++ b/vcl/source/uitest/uitest.cxx @@ -33,14 +33,12 @@ bool UITest::executeCommandWithParameters(const OUString& rCommand, {{"SynchronMode", -1, css::uno::Any(true), css::beans::PropertyState_DIRECT_VALUE}}; - sal_uInt32 nArgs = rArgs.getLength(); - if ( nArgs > 0 ) + if ( rArgs.hasElements() ) { sal_uInt32 nIndex( lNewArgs.getLength() ); lNewArgs.realloc( lNewArgs.getLength()+rArgs.getLength() ); - for ( sal_uInt32 i = 0; i < nArgs; i++ ) - lNewArgs[nIndex++] = rArgs[i]; + std::copy(rArgs.begin(), rArgs.end(), std::next(lNewArgs.begin(), nIndex)); } return comphelper::dispatchCommand(rCommand,lNewArgs); } diff --git a/vcl/source/uitest/uno/uiobject_uno.cxx b/vcl/source/uitest/uno/uiobject_uno.cxx index 7406ca6da9af..0b68a5d1cbce 100644 --- a/vcl/source/uitest/uno/uiobject_uno.cxx +++ b/vcl/source/uitest/uno/uiobject_uno.cxx @@ -115,13 +115,13 @@ void SAL_CALL UIObjectUnoObj::executeAction(const OUString& rAction, const css:: SolarMutexGuard aGuard; StringMap aMap; - for (sal_Int32 i = 0, n = mPropValues.getLength(); i < n; ++i) + for (const auto& rPropVal : mPropValues) { OUString aVal; - if (!(mPropValues[i].Value >>= aVal)) + if (!(rPropVal.Value >>= aVal)) continue; - aMap[mPropValues[i].Name] = aVal; + aMap[rPropVal.Name] = aVal; } mpObj->execute(mAction, aMap); }; |