[Libreoffice-commits] core.git: comphelper/source

Chris Sherlock chris.sherlock79 at gmail.com
Sat Apr 7 17:15:06 UTC 2018


 comphelper/source/misc/namedvaluecollection.cxx |   29 ++++--------------------
 1 file changed, 6 insertions(+), 23 deletions(-)

New commits:
commit 22e69d28bc293d49784701300795a64074ae99a6
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date:   Sat Apr 7 23:56:45 2018 +1000

    comphelper: use a lambda expression in NamedValueCollection::operator >>=()
    
    Change-Id: Idf47f500be097c4af907c37f6ca8632cd91f3ba2
    Reviewed-on: https://gerrit.libreoffice.org/52548
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

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();
     }
 


More information about the Libreoffice-commits mailing list