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

Xisco Fauli anistenis at gmail.com
Thu Jun 2 06:41:04 UTC 2016


 comphelper/source/property/propertysetinfo.cxx |   23 +++++++++++------------
 include/comphelper/propertysetinfo.hxx         |    3 ++-
 2 files changed, 13 insertions(+), 13 deletions(-)

New commits:
commit 7693c228297331fb6abee75f56796fbcd8813d02
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Wed Jun 1 01:30:11 2016 +0200

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

diff --git a/comphelper/source/property/propertysetinfo.cxx b/comphelper/source/property/propertysetinfo.cxx
index 98bcfd4..ca73b51 100644
--- a/comphelper/source/property/propertysetinfo.cxx
+++ b/comphelper/source/property/propertysetinfo.cxx
@@ -129,18 +129,18 @@ bool PropertyMapImpl::hasPropertyByName( const OUString& aName ) throw()
 
 
 PropertySetInfo::PropertySetInfo() throw()
+    : mpImpl(new PropertyMapImpl)
 {
-    mpMap = new PropertyMapImpl();
 }
 
 PropertySetInfo::PropertySetInfo( PropertyMapEntry const * pMap ) throw()
+    : mpImpl(new PropertyMapImpl)
 {
-    mpMap = new PropertyMapImpl();
-    mpMap->add( pMap );
+    mpImpl->add( pMap );
 }
 
 PropertySetInfo::PropertySetInfo(uno::Sequence<beans::Property> const& rProps) throw()
-    : mpMap(new PropertyMapImpl)
+    : mpImpl(new PropertyMapImpl)
 {
     PropertyMapEntry * pEntries(new PropertyMapEntry[rProps.getLength() + 1]);
     PropertyMapEntry * pEntry(&pEntries[0]);
@@ -154,42 +154,41 @@ PropertySetInfo::PropertySetInfo(uno::Sequence<beans::Property> const& rProps) t
         ++pEntry;
     }
     pEntry->maName = OUString();
-    mpMap->add(pEntries);
+    mpImpl->add(pEntries);
 }
 
 PropertySetInfo::~PropertySetInfo() throw()
 {
-    delete mpMap;
 }
 
 void PropertySetInfo::add( PropertyMapEntry const * pMap ) throw()
 {
-    mpMap->add( pMap );
+    mpImpl->add( pMap );
 }
 
 void PropertySetInfo::remove( const OUString& aName ) throw()
 {
-    mpMap->remove( aName );
+    mpImpl->remove( aName );
 }
 
 Sequence< css::beans::Property > SAL_CALL PropertySetInfo::getProperties() throw(css::uno::RuntimeException, std::exception)
 {
-    return comphelper::containerToSequence(mpMap->getProperties());
+    return comphelper::containerToSequence(mpImpl->getProperties());
 }
 
 Property SAL_CALL PropertySetInfo::getPropertyByName( const OUString& aName ) throw(css::beans::UnknownPropertyException, css::uno::RuntimeException, std::exception)
 {
-    return mpMap->getPropertyByName( aName );
+    return mpImpl->getPropertyByName( aName );
 }
 
 sal_Bool SAL_CALL PropertySetInfo::hasPropertyByName( const OUString& Name ) throw(css::uno::RuntimeException, std::exception)
 {
-    return mpMap->hasPropertyByName( Name );
+    return mpImpl->hasPropertyByName( Name );
 }
 
 const PropertyMap& PropertySetInfo::getPropertyMap() const throw()
 {
-    return mpMap->getPropertyMap();
+    return mpImpl->getPropertyMap();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/propertysetinfo.hxx b/include/comphelper/propertysetinfo.hxx
index 0c7a4e8..e30018f 100644
--- a/include/comphelper/propertysetinfo.hxx
+++ b/include/comphelper/propertysetinfo.hxx
@@ -27,6 +27,7 @@
 #include <com/sun/star/beans/XPropertySetInfo.hpp>
 #include <cppuhelper/implbase.hxx>
 #include <comphelper/comphelperdllapi.h>
+#include <memory>
 
 namespace comphelper
 {
@@ -56,7 +57,7 @@ class COMPHELPER_DLLPUBLIC PropertySetInfo
     : public PropertySetInfo_BASE
 {
 private:
-    PropertyMapImpl* mpMap;
+    std::unique_ptr<PropertyMapImpl> mpImpl;
 public:
     PropertySetInfo() throw();
     PropertySetInfo( PropertyMapEntry const * pMap ) throw();


More information about the Libreoffice-commits mailing list