diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2018-04-07 23:56:45 +1000 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-07 19:14:45 +0200 |
commit | 22e69d28bc293d49784701300795a64074ae99a6 (patch) | |
tree | 3d8f2e56a34c71b63d1ef8c21794fc89ecdca425 /comphelper/source | |
parent | b29f801e4106b0c729e90ff7c1b1718b671fd32d (diff) |
comphelper: use a lambda expression in NamedValueCollection::operator >>=()
Change-Id: Idf47f500be097c4af907c37f6ca8632cd91f3ba2
Reviewed-on: https://gerrit.libreoffice.org/52548
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'comphelper/source')
-rw-r--r-- | comphelper/source/misc/namedvaluecollection.cxx | 29 |
1 files changed, 6 insertions, 23 deletions
diff --git a/comphelper/source/misc/namedvaluecollection.cxx b/comphelper/source/misc/namedvaluecollection.cxx index d8a954f9c8a1..8882ccc2bdad 100644 --- a/comphelper/source/misc/namedvaluecollection.cxx +++ b/comphelper/source/misc/namedvaluecollection.cxx @@ -299,31 +299,12 @@ namespace comphelper } - namespace - { - struct Value2PropertyValue - { - PropertyValue operator()( const NamedValueRepository::value_type& _rValue ) - { - return PropertyValue( - _rValue.first, 0, _rValue.second, PropertyState_DIRECT_VALUE ); - } - }; - - struct Value2NamedValue - { - NamedValue operator()( const NamedValueRepository::value_type& _rValue ) - { - return NamedValue( _rValue.first, _rValue.second ); - } - }; - } - - sal_Int32 NamedValueCollection::operator >>= ( Sequence< PropertyValue >& _out_rValues ) const { _out_rValues.realloc( m_pImpl->aValues.size() ); - std::transform( m_pImpl->aValues.begin(), m_pImpl->aValues.end(), _out_rValues.getArray(), Value2PropertyValue() ); + std::transform( m_pImpl->aValues.begin(), m_pImpl->aValues.end(), _out_rValues.getArray(), + [](const NamedValueRepository::value_type& _rValue) + { return PropertyValue( _rValue.first, 0, _rValue.second, PropertyState_DIRECT_VALUE ); } ); return _out_rValues.getLength(); } @@ -331,7 +312,9 @@ namespace comphelper sal_Int32 NamedValueCollection::operator >>= ( Sequence< NamedValue >& _out_rValues ) const { _out_rValues.realloc( m_pImpl->aValues.size() ); - std::transform( m_pImpl->aValues.begin(), m_pImpl->aValues.end(), _out_rValues.getArray(), Value2NamedValue() ); + std::transform( m_pImpl->aValues.begin(), m_pImpl->aValues.end(), _out_rValues.getArray(), + [](const NamedValueRepository::value_type& _rValue) + { return NamedValue( _rValue.first, _rValue.second ); } ); return _out_rValues.getLength(); } |