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

Xisco Fauli anistenis at gmail.com
Thu Jun 2 06:37:08 UTC 2016


 comphelper/source/property/propertysethelper.cxx |   29 +++++++++++------------
 include/comphelper/propertysethelper.hxx         |    3 +-
 2 files changed, 16 insertions(+), 16 deletions(-)

New commits:
commit c37ce6c3c5c336290186f8d78ae00064064d7b8c
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Wed Jun 1 01:27:51 2016 +0200

    tdf#89329: use unique_ptr for pImpl in propertysethelper
    
    Change-Id: I5891fe7c298b4b3409ac6579ed167a4e0183c89a
    Reviewed-on: https://gerrit.libreoffice.org/25748
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/comphelper/source/property/propertysethelper.cxx b/comphelper/source/property/propertysethelper.cxx
index 859aebe..614a035 100644
--- a/comphelper/source/property/propertysethelper.cxx
+++ b/comphelper/source/property/propertysethelper.cxx
@@ -56,34 +56,33 @@ PropertyMapEntry const * PropertySetHelperImpl::find( const OUString& aName ) co
 
 
 PropertySetHelper::PropertySetHelper( comphelper::PropertySetInfo* pInfo ) throw()
+    : mpImpl(new PropertySetHelperImpl)
 {
-    mp = new PropertySetHelperImpl;
-    mp->mpInfo = pInfo;
+    mpImpl->mpInfo = pInfo;
     pInfo->acquire();
 }
 
 PropertySetHelper::PropertySetHelper( comphelper::PropertySetInfo* pInfo, __sal_NoAcquire ) throw()
+    : mpImpl(new PropertySetHelperImpl)
 {
-    mp = new PropertySetHelperImpl;
-    mp->mpInfo = pInfo;
+    mpImpl->mpInfo = pInfo;
 }
 
 PropertySetHelper::~PropertySetHelper() throw()
 {
-    mp->mpInfo->release();
-    delete mp;
+    mpImpl->mpInfo->release();
 }
 
 // XPropertySet
 Reference< XPropertySetInfo > SAL_CALL PropertySetHelper::getPropertySetInfo(  ) throw(RuntimeException, std::exception)
 {
-    return mp->mpInfo;
+    return mpImpl->mpInfo;
 }
 
 void SAL_CALL PropertySetHelper::setPropertyValue( const OUString& aPropertyName, const Any& aValue ) throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException, std::exception)
 {
     PropertyMapEntry const * aEntries[2];
-    aEntries[0] = mp->find( aPropertyName );
+    aEntries[0] = mpImpl->find( aPropertyName );
 
     if( nullptr == aEntries[0] )
         throw UnknownPropertyException( aPropertyName, static_cast< XPropertySet* >( this ) );
@@ -96,7 +95,7 @@ void SAL_CALL PropertySetHelper::setPropertyValue( const OUString& aPropertyName
 Any SAL_CALL PropertySetHelper::getPropertyValue( const OUString& PropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception)
 {
     PropertyMapEntry const * aEntries[2];
-    aEntries[0] = mp->find( PropertyName );
+    aEntries[0] = mpImpl->find( PropertyName );
 
     if( nullptr == aEntries[0] )
         throw UnknownPropertyException( PropertyName, static_cast< XPropertySet* >( this ) );
@@ -148,7 +147,7 @@ void SAL_CALL PropertySetHelper::setPropertyValues( const Sequence< OUString >&
         sal_Int32 n;
         for( n = 0; !bUnknown && ( n < nCount ); n++, pNames++ )
         {
-            pEntries[n] = mp->find( *pNames );
+            pEntries[n] = mpImpl->find( *pNames );
             bUnknown = nullptr == pEntries[n];
         }
 
@@ -176,7 +175,7 @@ Sequence< Any > SAL_CALL PropertySetHelper::getPropertyValues(const Sequence< OU
         sal_Int32 n;
         for( n = 0; !bUnknown && ( n < nCount ); n++, pNames++ )
         {
-            pEntries[n] = mp->find( *pNames );
+            pEntries[n] = mpImpl->find( *pNames );
             bUnknown = nullptr == pEntries[n];
         }
 
@@ -213,7 +212,7 @@ PropertyState SAL_CALL PropertySetHelper::getPropertyState( const OUString& Prop
 {
     PropertyMapEntry const * aEntries[2];
 
-    aEntries[0] = mp->find( PropertyName );
+    aEntries[0] = mpImpl->find( PropertyName );
     if( aEntries[0] == nullptr )
         throw UnknownPropertyException( PropertyName, static_cast< XPropertySet* >( this ) );
 
@@ -242,7 +241,7 @@ Sequence< PropertyState > SAL_CALL PropertySetHelper::getPropertyStates( const S
         sal_Int32 n;
         for( n = 0; !bUnknown && (n < nCount); n++, pNames++ )
         {
-            pEntries[n] = mp->find( *pNames );
+            pEntries[n] = mpImpl->find( *pNames );
             bUnknown = nullptr == pEntries[n];
         }
 
@@ -260,7 +259,7 @@ Sequence< PropertyState > SAL_CALL PropertySetHelper::getPropertyStates( const S
 
 void SAL_CALL PropertySetHelper::setPropertyToDefault( const OUString& PropertyName ) throw(UnknownPropertyException, RuntimeException, std::exception)
 {
-    PropertyMapEntry const *pEntry  = mp->find( PropertyName );
+    PropertyMapEntry const *pEntry  = mpImpl->find( PropertyName );
     if( nullptr == pEntry )
         throw UnknownPropertyException( PropertyName, static_cast< XPropertySet* >( this ) );
 
@@ -269,7 +268,7 @@ void SAL_CALL PropertySetHelper::setPropertyToDefault( const OUString& PropertyN
 
 Any SAL_CALL PropertySetHelper::getPropertyDefault( const OUString& aPropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception)
 {
-    PropertyMapEntry const * pEntry = mp->find( aPropertyName );
+    PropertyMapEntry const * pEntry = mpImpl->find( aPropertyName );
     if( nullptr == pEntry )
         throw UnknownPropertyException( aPropertyName, static_cast< XPropertySet* >( this ) );
 
diff --git a/include/comphelper/propertysethelper.hxx b/include/comphelper/propertysethelper.hxx
index c58d88b..87a2c24 100644
--- a/include/comphelper/propertysethelper.hxx
+++ b/include/comphelper/propertysethelper.hxx
@@ -24,6 +24,7 @@
 #include <com/sun/star/beans/XPropertyState.hpp>
 #include <com/sun/star/beans/XMultiPropertySet.hpp>
 #include <comphelper/comphelperdllapi.h>
+#include <memory>
 
 namespace comphelper
 {
@@ -36,7 +37,7 @@ class COMPHELPER_DLLPUBLIC PropertySetHelper : public css::beans::XPropertySet,
                           public css::beans::XMultiPropertySet
 {
 private:
-    PropertySetHelperImpl* mp;
+    std::unique_ptr<PropertySetHelperImpl> mpImpl;
 
 protected:
     virtual void _setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const css::uno::Any* pValues ) throw(css::beans::UnknownPropertyException, css::beans::PropertyVetoException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception ) = 0;


More information about the Libreoffice-commits mailing list