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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Nov 4 08:08:09 UTC 2020


 comphelper/source/property/propertybag.cxx |   28 ++++++++++------------------
 include/comphelper/propertybag.hxx         |   10 ++++------
 2 files changed, 14 insertions(+), 24 deletions(-)

New commits:
commit a373a7c1705b9abc5551388998131dacc4698642
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Wed Nov 4 07:25:40 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Nov 4 09:07:32 2020 +0100

    remove pimpl in PropertyBag
    
    Change-Id: Ibf34c0d9a3090c190a63f63ba9bd661263aebae6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105276
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/comphelper/source/property/propertybag.cxx b/comphelper/source/property/propertybag.cxx
index ac8fc17ff1b7..de230f470150 100644
--- a/comphelper/source/property/propertybag.cxx
+++ b/comphelper/source/property/propertybag.cxx
@@ -48,16 +48,8 @@ namespace comphelper
 
     namespace PropertyAttribute = ::com::sun::star::beans::PropertyAttribute;
 
-    typedef std::map< sal_Int32, Any >    MapInt2Any;
-    struct PropertyBag_Impl
-    {
-        PropertyBag_Impl() : m_bAllowEmptyPropertyName(false) { }
-        MapInt2Any  aDefaults;
-        bool m_bAllowEmptyPropertyName;
-    };
-
     PropertyBag::PropertyBag()
-        :m_pImpl( new PropertyBag_Impl )
+        : m_bAllowEmptyPropertyName(false)
     {
     }
 
@@ -68,7 +60,7 @@ namespace comphelper
 
     void PropertyBag::setAllowEmptyPropertyName( bool i_isAllowed )
     {
-        m_pImpl->m_bAllowEmptyPropertyName = i_isAllowed;
+        m_bAllowEmptyPropertyName = i_isAllowed;
     }
 
 
@@ -117,7 +109,7 @@ namespace comphelper
                   );
 
         // check name/handle sanity
-        lcl_checkForEmptyName( m_pImpl->m_bAllowEmptyPropertyName, _rName );
+        lcl_checkForEmptyName( m_bAllowEmptyPropertyName, _rName );
         lcl_checkNameAndHandle_ElementExistException( _rName, _nHandle, *this );
 
         // register the property
@@ -125,7 +117,7 @@ namespace comphelper
         registerPropertyNoMember( _rName, _nHandle, _nAttributes | PropertyAttribute::MAYBEVOID, _rType, css::uno::Any() );
 
         // remember the default
-        m_pImpl->aDefaults.emplace( _nHandle, Any() );
+        aDefaults.emplace( _nHandle, Any() );
     }
 
 
@@ -140,7 +132,7 @@ namespace comphelper
                 nullptr );
 
         // check name/handle sanity
-        lcl_checkForEmptyName( m_pImpl->m_bAllowEmptyPropertyName, _rName );
+        lcl_checkForEmptyName( m_bAllowEmptyPropertyName, _rName );
         lcl_checkNameAndHandle_PropertyExistException( _rName, _nHandle, *this );
 
         // register the property
@@ -148,7 +140,7 @@ namespace comphelper
             _rInitialValue );
 
         // remember the default
-        m_pImpl->aDefaults.emplace( _nHandle, _rInitialValue );
+        aDefaults.emplace( _nHandle, _rInitialValue );
     }
 
 
@@ -162,7 +154,7 @@ namespace comphelper
 
         revokeProperty( nHandle );
 
-        m_pImpl->aDefaults.erase( nHandle );
+        aDefaults.erase( nHandle );
     }
 
 
@@ -199,9 +191,9 @@ namespace comphelper
         if ( !hasPropertyByHandle( _nHandle ) )
             throw UnknownPropertyException(OUString::number(_nHandle));
 
-        MapInt2Any::const_iterator pos = m_pImpl->aDefaults.find( _nHandle );
-        OSL_ENSURE( pos != m_pImpl->aDefaults.end(), "PropertyBag::getPropertyDefaultByHandle: inconsistency!" );
-        if ( pos != m_pImpl->aDefaults.end() )
+        auto pos = aDefaults.find( _nHandle );
+        OSL_ENSURE( pos != aDefaults.end(), "PropertyBag::getPropertyDefaultByHandle: inconsistency!" );
+        if ( pos != aDefaults.end() )
             _out_rValue = pos->second;
         else
             _out_rValue.clear();
diff --git a/include/comphelper/propertybag.hxx b/include/comphelper/propertybag.hxx
index 0bd7eb020e01..3cf9de9ff360 100644
--- a/include/comphelper/propertybag.hxx
+++ b/include/comphelper/propertybag.hxx
@@ -21,18 +21,17 @@
 #define INCLUDED_COMPHELPER_PROPERTYBAG_HXX
 
 #include <config_options.h>
+#include <com/sun/star/uno/Any.h>
 #include <comphelper/comphelperdllapi.h>
 #include <comphelper/propertycontainerhelper.hxx>
 
-#include <memory>
+#include <map>
 
 
 namespace comphelper
 {
 
 
-    struct PropertyBag_Impl;
-
     //= PropertyBag
 
     /** provides a bag of properties associated with their values
@@ -42,9 +41,8 @@ namespace comphelper
     */
     class UNLESS_MERGELIBS(COMPHELPER_DLLPUBLIC) PropertyBag final : protected OPropertyContainerHelper
     {
-    private:
-        ::std::unique_ptr< PropertyBag_Impl > m_pImpl;
-
+        std::map< sal_Int32, css::uno::Any > aDefaults;
+        bool m_bAllowEmptyPropertyName;
     public:
         PropertyBag();
         virtual ~PropertyBag();


More information about the Libreoffice-commits mailing list