diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-06-28 01:35:35 +0300 |
---|---|---|
committer | Arkadiy Illarionov <qarkai@gmail.com> | 2019-06-28 17:37:54 +0200 |
commit | e1c62463433824c3bdfb3245a19366881544afb9 (patch) | |
tree | ddc2bd93ad60a93bc3fe4a1b06e3243b14ee7008 /ucbhelper/source/provider/propertyvalueset.cxx | |
parent | 1e084caf573255a93ce86053d584976f317074df (diff) |
Simplify Sequence iterations in ucbhelper
Use range-based loops or replace with STL functions
Change-Id: I4e9f5ae006ecbc7513db7574e0f8e08c6940cdb7
Reviewed-on: https://gerrit.libreoffice.org/74828
Tested-by: Jenkins
Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com>
Diffstat (limited to 'ucbhelper/source/provider/propertyvalueset.cxx')
-rw-r--r-- | ucbhelper/source/provider/propertyvalueset.cxx | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/ucbhelper/source/provider/propertyvalueset.cxx b/ucbhelper/source/provider/propertyvalueset.cxx index b420de754008..d1adaad4e6f2 100644 --- a/ucbhelper/source/provider/propertyvalueset.cxx +++ b/ucbhelper/source/provider/propertyvalueset.cxx @@ -644,8 +644,6 @@ void PropertyValueSet::appendPropertySet( if ( xInfo.is() ) { Sequence< Property > aProps = xInfo->getProperties(); - const Property* pProps = aProps.getConstArray(); - sal_Int32 nPropsCount = aProps.getLength(); Reference< XPropertyAccess > xPropertyAccess( rxSet, UNO_QUERY ); if ( xPropertyAccess.is() ) @@ -655,25 +653,15 @@ void PropertyValueSet::appendPropertySet( Sequence< css::beans::PropertyValue > aPropValues = xPropertyAccess->getPropertyValues(); - const css::beans::PropertyValue* pPropValues - = aPropValues.getConstArray(); - - sal_Int32 nValuesCount = aPropValues.getLength(); - for ( sal_Int32 n = 0; n < nValuesCount; ++n ) + for ( const css::beans::PropertyValue& rPropValue : aPropValues ) { - const css::beans::PropertyValue& rPropValue - = pPropValues[ n ]; - // Find info for current property value. - for ( sal_Int32 m = 0; m < nPropsCount; ++m ) + auto pProp = std::find_if(aProps.begin(), aProps.end(), + [&rPropValue](const Property& rProp) { return rProp.Name == rPropValue.Name; }); + if (pProp != aProps.end()) { - const Property& rProp = pProps[ m ]; - if ( rProp.Name == rPropValue.Name ) - { - // Found! - appendObject( rProp, rPropValue.Value ); - break; - } + // Found! + appendObject( *pProp, rPropValue.Value ); } } } @@ -681,10 +669,8 @@ void PropertyValueSet::appendPropertySet( { // Get every single prop value with one ( remote) call. - for ( sal_Int32 n = 0; n < nPropsCount; ++n ) + for ( const Property& rProp : aProps ) { - const Property& rProp = pProps[ n ]; - try { Any aValue = rxSet->getPropertyValue( rProp.Name ); |