diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-09-15 12:02:44 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-09-15 20:54:09 +0100 |
commit | 6dee1b1a8c12770d1e8139819aa532056deb3ed5 (patch) | |
tree | fce12f081ebbb4b960981ef342182497823407ae /filter | |
parent | a84a94ff53ee37c191da6e697d3fce0684418b2d (diff) |
use std::unique_ptr
Change-Id: Ibdbb7c32435684c7166ff3437a9fe812b3760356
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/svg/svgexport.cxx | 22 | ||||
-rw-r--r-- | filter/source/svg/svgfilter.hxx | 18 |
2 files changed, 13 insertions, 27 deletions
diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx index 9c9ac5fadc13..77964a862640 100644 --- a/filter/source/svg/svgexport.cxx +++ b/filter/source/svg/svgexport.cxx @@ -373,48 +373,36 @@ SVGExport::SVGExport( XML_NAMESPACE_ANIMATION); } - SVGExport::~SVGExport() { GetDocHandler()->endDocument(); } - -ObjectRepresentation::ObjectRepresentation() : - mpMtf( nullptr ) +ObjectRepresentation::ObjectRepresentation() { } - ObjectRepresentation::ObjectRepresentation( const Reference< XInterface >& rxObject, const GDIMetaFile& rMtf ) : mxObject( rxObject ), - mpMtf( new GDIMetaFile( rMtf ) ) + mxMtf( new GDIMetaFile( rMtf ) ) { } - ObjectRepresentation::ObjectRepresentation( const ObjectRepresentation& rPresentation ) : mxObject( rPresentation.mxObject ), - mpMtf( rPresentation.mpMtf ? new GDIMetaFile( *rPresentation.mpMtf ) : nullptr ) -{ -} - - -ObjectRepresentation::~ObjectRepresentation() + mxMtf( rPresentation.mxMtf ? new GDIMetaFile( *rPresentation.mxMtf ) : nullptr ) { - delete mpMtf; } - ObjectRepresentation& ObjectRepresentation::operator=( const ObjectRepresentation& rPresentation ) { // Check for self-assignment if (this == &rPresentation) return *this; + mxObject = rPresentation.mxObject; - delete mpMtf; - mpMtf = rPresentation.mpMtf ? new GDIMetaFile( *rPresentation.mpMtf ) : nullptr; + mxMtf.reset(rPresentation.mxMtf ? new GDIMetaFile(*rPresentation.mxMtf) : nullptr); return *this; } diff --git a/filter/source/svg/svgfilter.hxx b/filter/source/svg/svgfilter.hxx index 447bf77921bc..2d4763857dde 100644 --- a/filter/source/svg/svgfilter.hxx +++ b/filter/source/svg/svgfilter.hxx @@ -123,21 +123,19 @@ class ObjectRepresentation private: Reference< XInterface > mxObject; - GDIMetaFile* mpMtf; + std::unique_ptr<GDIMetaFile> mxMtf; public: + ObjectRepresentation(); + ObjectRepresentation(const Reference< XInterface >& rxIf, + const GDIMetaFile& rMtf); + ObjectRepresentation(const ObjectRepresentation& rPresentation); - ObjectRepresentation(); - ObjectRepresentation( const Reference< XInterface >& rxIf, - const GDIMetaFile& rMtf ); - ObjectRepresentation( const ObjectRepresentation& rPresentation ); - ~ObjectRepresentation(); - - ObjectRepresentation& operator=( const ObjectRepresentation& rPresentation ); + ObjectRepresentation& operator=(const ObjectRepresentation& rPresentation); const Reference< XInterface >& GetObject() const { return mxObject; } - bool HasRepresentation() const { return mpMtf != nullptr; } - const GDIMetaFile& GetRepresentation() const { return *mpMtf; } + bool HasRepresentation() const { return static_cast<bool>(mxMtf); } + const GDIMetaFile& GetRepresentation() const { return *mxMtf; } }; struct PagePropertySet |