summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXisco Fauli <anistenis@gmail.com>2016-06-01 01:27:51 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-06-02 06:36:30 +0000
commitc37ce6c3c5c336290186f8d78ae00064064d7b8c (patch)
tree50b30033c70d86a4fd477bfa47ef536f75686c1d
parente0f60043cc6013eabd22dc73f7371a4f19f54625 (diff)
tdf#89329: use unique_ptr for pImpl in propertysethelper
Change-Id: I5891fe7c298b4b3409ac6579ed167a4e0183c89a Reviewed-on: https://gerrit.libreoffice.org/25748 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r--comphelper/source/property/propertysethelper.cxx29
-rw-r--r--include/comphelper/propertysethelper.hxx3
2 files changed, 16 insertions, 16 deletions
diff --git a/comphelper/source/property/propertysethelper.cxx b/comphelper/source/property/propertysethelper.cxx
index 859aebec6002..614a035f9166 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 c58d88ba3b98..87a2c24eecef 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;