diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-07-05 13:27:30 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-07-06 08:35:23 +0200 |
commit | ab9b38a4064141705aa3a3de9a5d73b465ad3af3 (patch) | |
tree | 888fcc6b517c44d77e2d297c13ee84fb487dd7a7 /comphelper | |
parent | 13341ffa49d58f313a05edae4f4f04c215658e9f (diff) |
use more begin()/end() for Sequence
Change-Id: I399be6b6ef7a6ce01e883569a177c0969bc29c69
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/source/misc/namedvaluecollection.cxx | 24 | ||||
-rw-r--r-- | comphelper/source/property/opropertybag.cxx | 24 |
2 files changed, 21 insertions, 27 deletions
diff --git a/comphelper/source/misc/namedvaluecollection.cxx b/comphelper/source/misc/namedvaluecollection.cxx index a6f732937b4e..9c03be3fd861 100644 --- a/comphelper/source/misc/namedvaluecollection.cxx +++ b/comphelper/source/misc/namedvaluecollection.cxx @@ -192,21 +192,19 @@ namespace comphelper PropertyValue aPropertyValue; NamedValue aNamedValue; - const Any* pArgument = _rArguments.getConstArray(); - const Any* pArgumentEnd = _rArguments.getConstArray() + _rArguments.getLength(); - for ( ; pArgument != pArgumentEnd; ++pArgument ) + for ( auto const & argument : _rArguments ) { - if ( *pArgument >>= aPropertyValue ) + if ( argument >>= aPropertyValue ) m_pImpl->aValues[ aPropertyValue.Name ] = aPropertyValue.Value; - else if ( *pArgument >>= aNamedValue ) + else if ( argument >>= aNamedValue ) m_pImpl->aValues[ aNamedValue.Name ] = aNamedValue.Value; else { SAL_WARN_IF( - pArgument->hasValue(), "comphelper", + argument.hasValue(), "comphelper", ("NamedValueCollection::impl_assign: encountered a value" " type which I cannot handle: " - + pArgument->getValueTypeName())); + + argument.getValueTypeName())); } } } @@ -219,10 +217,8 @@ namespace comphelper m_pImpl->aValues.swap( aEmpty ); } - const PropertyValue* pArgument = _rArguments.getConstArray(); - const PropertyValue* pArgumentEnd = _rArguments.getConstArray() + _rArguments.getLength(); - for ( ; pArgument != pArgumentEnd; ++pArgument ) - m_pImpl->aValues[ pArgument->Name ] = pArgument->Value; + for ( auto const & argument : _rArguments ) + m_pImpl->aValues[ argument.Name ] = argument.Value; } @@ -233,10 +229,8 @@ namespace comphelper m_pImpl->aValues.swap( aEmpty ); } - const NamedValue* pArgument = _rArguments.getConstArray(); - const NamedValue* pArgumentEnd = _rArguments.getConstArray() + _rArguments.getLength(); - for ( ; pArgument != pArgumentEnd; ++pArgument ) - m_pImpl->aValues[ pArgument->Name ] = pArgument->Value; + for ( auto const & argument : _rArguments ) + m_pImpl->aValues[ argument.Name ] = argument.Value; } diff --git a/comphelper/source/property/opropertybag.cxx b/comphelper/source/property/opropertybag.cxx index 740de1ca2df4..84e1e7527ff7 100644 --- a/comphelper/source/property/opropertybag.cxx +++ b/comphelper/source/property/opropertybag.cxx @@ -87,8 +87,8 @@ namespace comphelper && (_rArguments[2] >>= AutomaticAddition)) { std::copy( - aTypes.getConstArray(), - aTypes.getConstArray() + aTypes.getLength(), + aTypes.begin(), + aTypes.end(), std::insert_iterator< TypeBag >( m_aAllowedTypes, m_aAllowedTypes.begin() ) ); m_bAutoAddProperties = AutomaticAddition; @@ -98,8 +98,8 @@ namespace comphelper if ( aArguments.get_ensureType( "AllowedTypes", aTypes ) ) std::copy( - aTypes.getConstArray(), - aTypes.getConstArray() + aTypes.getLength(), + aTypes.begin(), + aTypes.end(), std::insert_iterator< TypeBag >( m_aAllowedTypes, m_aAllowedTypes.begin() ) ); @@ -388,8 +388,8 @@ namespace comphelper // their names Sequence< OUString > aNames( aProperties.getLength() ); std::transform( - aProperties.getConstArray(), - aProperties.getConstArray() + aProperties.getLength(), + aProperties.begin(), + aProperties.end(), aNames.getArray(), TransformPropertyToName< Property >() ); @@ -437,16 +437,16 @@ namespace comphelper // sort (the XMultiPropertySet interface requires this) Sequence< PropertyValue > aProperties( _rProps ); std::sort( - aProperties.getArray(), - aProperties.getArray() + aProperties.getLength(), + aProperties.begin(), + aProperties.end(), ComparePropertyValueByName() ); // a sequence of names Sequence< OUString > aNames( aProperties.getLength() ); std::transform( - aProperties.getConstArray(), - aProperties.getConstArray() + aProperties.getLength(), + aProperties.begin(), + aProperties.end(), aNames.getArray(), TransformPropertyToName< PropertyValue >() ); @@ -490,8 +490,8 @@ namespace comphelper // a sequence of values Sequence< Any > aValues( aProperties.getLength() ); std::transform( - aProperties.getConstArray(), - aProperties.getConstArray() + aProperties.getLength(), + aProperties.begin(), + aProperties.end(), aValues.getArray(), ExtractPropertyValue() ); |