Kaydet (Commit) c37ce6c3 authored tarafından Xisco Fauli's avatar Xisco Fauli Kaydeden (comit) Noel Grandin

tdf#89329: use unique_ptr for pImpl in propertysethelper

Change-Id: I5891fe7c298b4b3409ac6579ed167a4e0183c89a
Reviewed-on: https://gerrit.libreoffice.org/25748Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst e0f60043
...@@ -56,34 +56,33 @@ PropertyMapEntry const * PropertySetHelperImpl::find( const OUString& aName ) co ...@@ -56,34 +56,33 @@ PropertyMapEntry const * PropertySetHelperImpl::find( const OUString& aName ) co
PropertySetHelper::PropertySetHelper( comphelper::PropertySetInfo* pInfo ) throw() PropertySetHelper::PropertySetHelper( comphelper::PropertySetInfo* pInfo ) throw()
: mpImpl(new PropertySetHelperImpl)
{ {
mp = new PropertySetHelperImpl; mpImpl->mpInfo = pInfo;
mp->mpInfo = pInfo;
pInfo->acquire(); pInfo->acquire();
} }
PropertySetHelper::PropertySetHelper( comphelper::PropertySetInfo* pInfo, __sal_NoAcquire ) throw() PropertySetHelper::PropertySetHelper( comphelper::PropertySetInfo* pInfo, __sal_NoAcquire ) throw()
: mpImpl(new PropertySetHelperImpl)
{ {
mp = new PropertySetHelperImpl; mpImpl->mpInfo = pInfo;
mp->mpInfo = pInfo;
} }
PropertySetHelper::~PropertySetHelper() throw() PropertySetHelper::~PropertySetHelper() throw()
{ {
mp->mpInfo->release(); mpImpl->mpInfo->release();
delete mp;
} }
// XPropertySet // XPropertySet
Reference< XPropertySetInfo > SAL_CALL PropertySetHelper::getPropertySetInfo( ) throw(RuntimeException, std::exception) 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) void SAL_CALL PropertySetHelper::setPropertyValue( const OUString& aPropertyName, const Any& aValue ) throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException, std::exception)
{ {
PropertyMapEntry const * aEntries[2]; PropertyMapEntry const * aEntries[2];
aEntries[0] = mp->find( aPropertyName ); aEntries[0] = mpImpl->find( aPropertyName );
if( nullptr == aEntries[0] ) if( nullptr == aEntries[0] )
throw UnknownPropertyException( aPropertyName, static_cast< XPropertySet* >( this ) ); throw UnknownPropertyException( aPropertyName, static_cast< XPropertySet* >( this ) );
...@@ -96,7 +95,7 @@ void SAL_CALL PropertySetHelper::setPropertyValue( const OUString& aPropertyName ...@@ -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) Any SAL_CALL PropertySetHelper::getPropertyValue( const OUString& PropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception)
{ {
PropertyMapEntry const * aEntries[2]; PropertyMapEntry const * aEntries[2];
aEntries[0] = mp->find( PropertyName ); aEntries[0] = mpImpl->find( PropertyName );
if( nullptr == aEntries[0] ) if( nullptr == aEntries[0] )
throw UnknownPropertyException( PropertyName, static_cast< XPropertySet* >( this ) ); throw UnknownPropertyException( PropertyName, static_cast< XPropertySet* >( this ) );
...@@ -148,7 +147,7 @@ void SAL_CALL PropertySetHelper::setPropertyValues( const Sequence< OUString >& ...@@ -148,7 +147,7 @@ void SAL_CALL PropertySetHelper::setPropertyValues( const Sequence< OUString >&
sal_Int32 n; sal_Int32 n;
for( n = 0; !bUnknown && ( n < nCount ); n++, pNames++ ) for( n = 0; !bUnknown && ( n < nCount ); n++, pNames++ )
{ {
pEntries[n] = mp->find( *pNames ); pEntries[n] = mpImpl->find( *pNames );
bUnknown = nullptr == pEntries[n]; bUnknown = nullptr == pEntries[n];
} }
...@@ -176,7 +175,7 @@ Sequence< Any > SAL_CALL PropertySetHelper::getPropertyValues(const Sequence< OU ...@@ -176,7 +175,7 @@ Sequence< Any > SAL_CALL PropertySetHelper::getPropertyValues(const Sequence< OU
sal_Int32 n; sal_Int32 n;
for( n = 0; !bUnknown && ( n < nCount ); n++, pNames++ ) for( n = 0; !bUnknown && ( n < nCount ); n++, pNames++ )
{ {
pEntries[n] = mp->find( *pNames ); pEntries[n] = mpImpl->find( *pNames );
bUnknown = nullptr == pEntries[n]; bUnknown = nullptr == pEntries[n];
} }
...@@ -213,7 +212,7 @@ PropertyState SAL_CALL PropertySetHelper::getPropertyState( const OUString& Prop ...@@ -213,7 +212,7 @@ PropertyState SAL_CALL PropertySetHelper::getPropertyState( const OUString& Prop
{ {
PropertyMapEntry const * aEntries[2]; PropertyMapEntry const * aEntries[2];
aEntries[0] = mp->find( PropertyName ); aEntries[0] = mpImpl->find( PropertyName );
if( aEntries[0] == nullptr ) if( aEntries[0] == nullptr )
throw UnknownPropertyException( PropertyName, static_cast< XPropertySet* >( this ) ); throw UnknownPropertyException( PropertyName, static_cast< XPropertySet* >( this ) );
...@@ -242,7 +241,7 @@ Sequence< PropertyState > SAL_CALL PropertySetHelper::getPropertyStates( const S ...@@ -242,7 +241,7 @@ Sequence< PropertyState > SAL_CALL PropertySetHelper::getPropertyStates( const S
sal_Int32 n; sal_Int32 n;
for( n = 0; !bUnknown && (n < nCount); n++, pNames++ ) for( n = 0; !bUnknown && (n < nCount); n++, pNames++ )
{ {
pEntries[n] = mp->find( *pNames ); pEntries[n] = mpImpl->find( *pNames );
bUnknown = nullptr == pEntries[n]; bUnknown = nullptr == pEntries[n];
} }
...@@ -260,7 +259,7 @@ Sequence< PropertyState > SAL_CALL PropertySetHelper::getPropertyStates( const S ...@@ -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) 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 ) if( nullptr == pEntry )
throw UnknownPropertyException( PropertyName, static_cast< XPropertySet* >( this ) ); throw UnknownPropertyException( PropertyName, static_cast< XPropertySet* >( this ) );
...@@ -269,7 +268,7 @@ void SAL_CALL PropertySetHelper::setPropertyToDefault( const OUString& PropertyN ...@@ -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) 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 ) if( nullptr == pEntry )
throw UnknownPropertyException( aPropertyName, static_cast< XPropertySet* >( this ) ); throw UnknownPropertyException( aPropertyName, static_cast< XPropertySet* >( this ) );
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <com/sun/star/beans/XPropertyState.hpp> #include <com/sun/star/beans/XPropertyState.hpp>
#include <com/sun/star/beans/XMultiPropertySet.hpp> #include <com/sun/star/beans/XMultiPropertySet.hpp>
#include <comphelper/comphelperdllapi.h> #include <comphelper/comphelperdllapi.h>
#include <memory>
namespace comphelper namespace comphelper
{ {
...@@ -36,7 +37,7 @@ class COMPHELPER_DLLPUBLIC PropertySetHelper : public css::beans::XPropertySet, ...@@ -36,7 +37,7 @@ class COMPHELPER_DLLPUBLIC PropertySetHelper : public css::beans::XPropertySet,
public css::beans::XMultiPropertySet public css::beans::XMultiPropertySet
{ {
private: private:
PropertySetHelperImpl* mp; std::unique_ptr<PropertySetHelperImpl> mpImpl;
protected: 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; 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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment