new loplugin: useuniqueptr: svgio

Change-Id: I645ac954ac519fe713f4347cdf69780b0f8070e4
Reviewed-on: https://gerrit.libreoffice.org/33252
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2017-01-18 09:48:47 +02:00
parent 9767537e22
commit 2da34e265d
30 changed files with 67 additions and 64 deletions

View File

@@ -22,6 +22,7 @@
#include <svgnode.hxx> #include <svgnode.hxx>
#include <svgstyleattributes.hxx> #include <svgstyleattributes.hxx>
#include <memory>
namespace svgio namespace svgio
{ {
@@ -34,7 +35,7 @@ namespace svgio
SvgStyleAttributes maSvgStyleAttributes; SvgStyleAttributes maSvgStyleAttributes;
/// variable scan values, dependent of given XAttributeList /// variable scan values, dependent of given XAttributeList
basegfx::B2DHomMatrix* mpaTransform; std::unique_ptr<basegfx::B2DHomMatrix> mpaTransform;
public: public:
SvgANode( SvgANode(
@@ -47,8 +48,8 @@ namespace svgio
virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override; virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override;
/// transform content /// transform content
const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; } const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform.get(); }
void setTransform(const basegfx::B2DHomMatrix* pMatrix) { if(mpaTransform) delete mpaTransform; mpaTransform = nullptr; if(pMatrix) mpaTransform = new basegfx::B2DHomMatrix(*pMatrix); } void setTransform(const basegfx::B2DHomMatrix* pMatrix) { mpaTransform.reset(); if(pMatrix) mpaTransform.reset( new basegfx::B2DHomMatrix(*pMatrix) ); }
}; };
} // end of namespace svgreader } // end of namespace svgreader
} // end of namespace svgio } // end of namespace svgio

View File

@@ -22,6 +22,7 @@
#include <svgnode.hxx> #include <svgnode.hxx>
#include <svgstyleattributes.hxx> #include <svgstyleattributes.hxx>
#include <memory>
namespace svgio namespace svgio
{ {
@@ -37,7 +38,7 @@ namespace svgio
SvgNumber maCx; SvgNumber maCx;
SvgNumber maCy; SvgNumber maCy;
SvgNumber maR; SvgNumber maR;
basegfx::B2DHomMatrix* mpaTransform; std::unique_ptr<basegfx::B2DHomMatrix> mpaTransform;
public: public:
SvgCircleNode( SvgCircleNode(
@@ -59,8 +60,8 @@ namespace svgio
const SvgNumber& getR() const { return maR; } const SvgNumber& getR() const { return maR; }
/// transform content, set if found in current context /// transform content, set if found in current context
const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; } const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform.get(); }
void setTransform(const basegfx::B2DHomMatrix* pMatrix) { if(mpaTransform) delete mpaTransform; mpaTransform = nullptr; if(pMatrix) mpaTransform = new basegfx::B2DHomMatrix(*pMatrix); } void setTransform(const basegfx::B2DHomMatrix* pMatrix) { mpaTransform.reset(); if(pMatrix) mpaTransform.reset( new basegfx::B2DHomMatrix(*pMatrix) ); }
}; };
} // end of namespace svgreader } // end of namespace svgreader
} // end of namespace svgio } // end of namespace svgio

View File

@@ -22,6 +22,7 @@
#include <svgnode.hxx> #include <svgnode.hxx>
#include <svgstyleattributes.hxx> #include <svgstyleattributes.hxx>
#include <memory>
namespace svgio namespace svgio
{ {
@@ -34,7 +35,7 @@ namespace svgio
SvgStyleAttributes maSvgStyleAttributes; SvgStyleAttributes maSvgStyleAttributes;
/// variable scan values, dependent of given XAttributeList /// variable scan values, dependent of given XAttributeList
basegfx::B2DHomMatrix* mpaTransform; std::unique_ptr<basegfx::B2DHomMatrix> mpaTransform;
SvgUnits maClipPathUnits; SvgUnits maClipPathUnits;
public: public:
@@ -57,8 +58,8 @@ namespace svgio
void setClipPathUnits(const SvgUnits aClipPathUnits) { maClipPathUnits = aClipPathUnits; } void setClipPathUnits(const SvgUnits aClipPathUnits) { maClipPathUnits = aClipPathUnits; }
/// transform content /// transform content
const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; } const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform.get(); }
void setTransform(const basegfx::B2DHomMatrix* pMatrix) { if(mpaTransform) delete mpaTransform; mpaTransform = nullptr; if(pMatrix) mpaTransform = new basegfx::B2DHomMatrix(*pMatrix); } void setTransform(const basegfx::B2DHomMatrix* pMatrix) { mpaTransform.reset(); if(pMatrix) mpaTransform.reset( new basegfx::B2DHomMatrix(*pMatrix) ); }
}; };
} // end of namespace svgreader } // end of namespace svgreader
} // end of namespace svgio } // end of namespace svgio

View File

@@ -22,6 +22,7 @@
#include <svgnode.hxx> #include <svgnode.hxx>
#include <svgstyleattributes.hxx> #include <svgstyleattributes.hxx>
#include <memory>
namespace svgio namespace svgio
{ {
@@ -38,7 +39,7 @@ namespace svgio
SvgNumber maCy; SvgNumber maCy;
SvgNumber maRx; SvgNumber maRx;
SvgNumber maRy; SvgNumber maRy;
basegfx::B2DHomMatrix* mpaTransform; std::unique_ptr<basegfx::B2DHomMatrix> mpaTransform;
public: public:
SvgEllipseNode( SvgEllipseNode(
@@ -63,8 +64,8 @@ namespace svgio
const SvgNumber& getRy() const { return maRy; } const SvgNumber& getRy() const { return maRy; }
/// transform content, set if found in current context /// transform content, set if found in current context
const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; } const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform.get(); }
void setTransform(const basegfx::B2DHomMatrix* pMatrix) { if(mpaTransform) delete mpaTransform; mpaTransform = nullptr; if(pMatrix) mpaTransform = new basegfx::B2DHomMatrix(*pMatrix); } void setTransform(const basegfx::B2DHomMatrix* pMatrix) { mpaTransform.reset(); if(pMatrix) mpaTransform.reset( new basegfx::B2DHomMatrix(*pMatrix) ); }
}; };
} // end of namespace svgreader } // end of namespace svgreader
} // end of namespace svgio } // end of namespace svgio

View File

@@ -22,6 +22,7 @@
#include <svgnode.hxx> #include <svgnode.hxx>
#include <svgstyleattributes.hxx> #include <svgstyleattributes.hxx>
#include <memory>
namespace svgio namespace svgio
{ {
@@ -34,7 +35,7 @@ namespace svgio
SvgStyleAttributes maSvgStyleAttributes; SvgStyleAttributes maSvgStyleAttributes;
/// variable scan values, dependent of given XAttributeList /// variable scan values, dependent of given XAttributeList
basegfx::B2DHomMatrix* mpaTransform; std::unique_ptr<basegfx::B2DHomMatrix> mpaTransform;
public: public:
SvgGNode( SvgGNode(
@@ -48,8 +49,8 @@ namespace svgio
virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override; virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override;
/// transform content /// transform content
const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; } const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform.get(); }
void setTransform(const basegfx::B2DHomMatrix* pMatrix) { if(mpaTransform) delete mpaTransform; mpaTransform = nullptr; if(pMatrix) mpaTransform = new basegfx::B2DHomMatrix(*pMatrix); } void setTransform(const basegfx::B2DHomMatrix* pMatrix) { mpaTransform.reset(); if(pMatrix) mpaTransform.reset( new basegfx::B2DHomMatrix(*pMatrix) ); }
}; };
} // end of namespace svgreader } // end of namespace svgreader
} // end of namespace svgio } // end of namespace svgio

View File

@@ -23,6 +23,7 @@
#include <svgnode.hxx> #include <svgnode.hxx>
#include <svgstyleattributes.hxx> #include <svgstyleattributes.hxx>
#include <drawinglayer/primitive2d/svggradientprimitive2d.hxx> #include <drawinglayer/primitive2d/svggradientprimitive2d.hxx>
#include <memory>
namespace svgio namespace svgio
{ {
@@ -50,7 +51,7 @@ namespace svgio
/// variable scan values, dependent of given XAttributeList /// variable scan values, dependent of given XAttributeList
SvgUnits maGradientUnits; SvgUnits maGradientUnits;
drawinglayer::primitive2d::SpreadMethod maSpreadMethod; drawinglayer::primitive2d::SpreadMethod maSpreadMethod;
basegfx::B2DHomMatrix* mpaGradientTransform; std::unique_ptr<basegfx::B2DHomMatrix> mpaGradientTransform;
/// link to another gradient used as style. If maXLink /// link to another gradient used as style. If maXLink
/// is set, the node can be fetched on demand by using /// is set, the node can be fetched on demand by using

View File

@@ -22,6 +22,7 @@
#include <svgnode.hxx> #include <svgnode.hxx>
#include <svgstyleattributes.hxx> #include <svgstyleattributes.hxx>
#include <memory>
namespace svgio namespace svgio
{ {
@@ -35,7 +36,8 @@ namespace svgio
/// variable scan values, dependent of given XAttributeList /// variable scan values, dependent of given XAttributeList
SvgAspectRatio maSvgAspectRatio; SvgAspectRatio maSvgAspectRatio;
basegfx::B2DHomMatrix* mpaTransform; std::unique_ptr<basegfx::B2DHomMatrix>
mpaTransform;
SvgNumber maX; SvgNumber maX;
SvgNumber maY; SvgNumber maY;
SvgNumber maWidth; SvgNumber maWidth;
@@ -58,8 +60,8 @@ namespace svgio
virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override; virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override;
/// transform content, set if found in current context /// transform content, set if found in current context
const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; } const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform.get(); }
void setTransform(const basegfx::B2DHomMatrix* pMatrix) { if(mpaTransform) delete mpaTransform; mpaTransform = nullptr; if(pMatrix) mpaTransform = new basegfx::B2DHomMatrix(*pMatrix); } void setTransform(const basegfx::B2DHomMatrix* pMatrix) { mpaTransform.reset(); if(pMatrix) mpaTransform.reset( new basegfx::B2DHomMatrix(*pMatrix) ); }
/// x content, set if found in current context /// x content, set if found in current context
const SvgNumber& getX() const { return maX; } const SvgNumber& getX() const { return maX; }

View File

@@ -22,6 +22,7 @@
#include <svgnode.hxx> #include <svgnode.hxx>
#include <svgstyleattributes.hxx> #include <svgstyleattributes.hxx>
#include <memory>
namespace svgio namespace svgio
{ {
@@ -38,7 +39,7 @@ namespace svgio
SvgNumber maY1; SvgNumber maY1;
SvgNumber maX2; SvgNumber maX2;
SvgNumber maY2; SvgNumber maY2;
basegfx::B2DHomMatrix* mpaTransform; std::unique_ptr<basegfx::B2DHomMatrix> mpaTransform;
public: public:
SvgLineNode( SvgLineNode(
@@ -63,8 +64,8 @@ namespace svgio
const SvgNumber& getY2() const { return maY2; } const SvgNumber& getY2() const { return maY2; }
/// transform content, set if found in current context /// transform content, set if found in current context
const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; } const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform.get(); }
void setTransform(const basegfx::B2DHomMatrix* pMatrix) { if(mpaTransform) delete mpaTransform; mpaTransform = nullptr; if(pMatrix) mpaTransform = new basegfx::B2DHomMatrix(*pMatrix); } void setTransform(const basegfx::B2DHomMatrix* pMatrix) { mpaTransform.reset(); if(pMatrix) mpaTransform.reset( new basegfx::B2DHomMatrix(*pMatrix) ); }
}; };
} // end of namespace svgreader } // end of namespace svgreader
} // end of namespace svgio } // end of namespace svgio

View File

@@ -22,6 +22,7 @@
#include <svgnode.hxx> #include <svgnode.hxx>
#include <svgstyleattributes.hxx> #include <svgstyleattributes.hxx>
#include <memory>
namespace svgio namespace svgio
{ {
@@ -44,7 +45,8 @@ namespace svgio
SvgStyleAttributes maSvgStyleAttributes; SvgStyleAttributes maSvgStyleAttributes;
/// variable scan values, dependent of given XAttributeList /// variable scan values, dependent of given XAttributeList
basegfx::B2DRange* mpViewBox; std::unique_ptr<basegfx::B2DRange>
mpViewBox;
SvgAspectRatio maSvgAspectRatio; SvgAspectRatio maSvgAspectRatio;
SvgNumber maRefX; SvgNumber maRefX;
SvgNumber maRefY; SvgNumber maRefY;
@@ -71,8 +73,8 @@ namespace svgio
virtual const basegfx::B2DRange getCurrentViewPort() const override; virtual const basegfx::B2DRange getCurrentViewPort() const override;
/// viewBox content /// viewBox content
const basegfx::B2DRange* getViewBox() const { return mpViewBox; } const basegfx::B2DRange* getViewBox() const { return mpViewBox.get(); }
void setViewBox(const basegfx::B2DRange* pViewBox) { if(mpViewBox) delete mpViewBox; mpViewBox = nullptr; if(pViewBox) mpViewBox = new basegfx::B2DRange(*pViewBox); } void setViewBox(const basegfx::B2DRange* pViewBox) { mpViewBox.reset(); if(pViewBox) mpViewBox.reset( new basegfx::B2DRange(*pViewBox) ); }
/// SvgAspectRatio content /// SvgAspectRatio content
const SvgAspectRatio& getSvgAspectRatio() const { return maSvgAspectRatio; } const SvgAspectRatio& getSvgAspectRatio() const { return maSvgAspectRatio; }

View File

@@ -22,6 +22,7 @@
#include <svgnode.hxx> #include <svgnode.hxx>
#include <svgstyleattributes.hxx> #include <svgstyleattributes.hxx>
#include <memory>
namespace svgio namespace svgio
{ {
@@ -38,7 +39,8 @@ namespace svgio
SvgNumber maY; SvgNumber maY;
SvgNumber maWidth; SvgNumber maWidth;
SvgNumber maHeight; SvgNumber maHeight;
basegfx::B2DHomMatrix* mpaTransform; std::unique_ptr<basegfx::B2DHomMatrix>
mpaTransform;
SvgUnits maMaskUnits; SvgUnits maMaskUnits;
SvgUnits maMaskContentUnits; SvgUnits maMaskContentUnits;
@@ -70,8 +72,8 @@ namespace svgio
const SvgNumber& getHeight() const { return maHeight; } const SvgNumber& getHeight() const { return maHeight; }
/// transform content /// transform content
const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; } const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform.get(); }
void setTransform(const basegfx::B2DHomMatrix* pMatrix) { if(mpaTransform) delete mpaTransform; mpaTransform = nullptr; if(pMatrix) mpaTransform = new basegfx::B2DHomMatrix(*pMatrix); } void setTransform(const basegfx::B2DHomMatrix* pMatrix) { mpaTransform.reset(); if(pMatrix) mpaTransform.reset( new basegfx::B2DHomMatrix(*pMatrix) ); }
/// MaskUnits content /// MaskUnits content
void setMaskUnits(const SvgUnits aMaskUnits) { maMaskUnits = aMaskUnits; } void setMaskUnits(const SvgUnits aMaskUnits) { maMaskUnits = aMaskUnits; }

View File

@@ -22,6 +22,7 @@
#include <svgnode.hxx> #include <svgnode.hxx>
#include <svgstyleattributes.hxx> #include <svgstyleattributes.hxx>
#include <memory>
namespace svgio namespace svgio
{ {
@@ -40,7 +41,7 @@ namespace svgio
SvgNumber maHeight; SvgNumber maHeight;
SvgNumber maRx; SvgNumber maRx;
SvgNumber maRy; SvgNumber maRy;
basegfx::B2DHomMatrix* mpaTransform; std::unique_ptr<basegfx::B2DHomMatrix> mpaTransform;
public: public:
SvgRectNode( SvgRectNode(
@@ -71,8 +72,8 @@ namespace svgio
const SvgNumber& getRy() const { return maRy; } const SvgNumber& getRy() const { return maRy; }
/// transform content, set if found in current context /// transform content, set if found in current context
const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; } const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform.get(); }
void setTransform(const basegfx::B2DHomMatrix* pMatrix) { if(mpaTransform) delete mpaTransform; mpaTransform = nullptr; if(pMatrix) mpaTransform = new basegfx::B2DHomMatrix(*pMatrix); } void setTransform(const basegfx::B2DHomMatrix* pMatrix) { mpaTransform.reset(); if(pMatrix) mpaTransform.reset( new basegfx::B2DHomMatrix(*pMatrix) ); }
}; };
} // end of namespace svgreader } // end of namespace svgreader
} // end of namespace svgio } // end of namespace svgio

View File

@@ -21,6 +21,7 @@
#define INCLUDED_SVGIO_INC_SVGSVGNODE_HXX #define INCLUDED_SVGIO_INC_SVGSVGNODE_HXX
#include <svgstyleattributes.hxx> #include <svgstyleattributes.hxx>
#include <memory>
namespace svgio namespace svgio
{ {
@@ -33,7 +34,8 @@ namespace svgio
SvgStyleAttributes maSvgStyleAttributes; SvgStyleAttributes maSvgStyleAttributes;
/// variable scan values, dependent of given XAttributeList /// variable scan values, dependent of given XAttributeList
basegfx::B2DRange* mpViewBox; std::unique_ptr<basegfx::B2DRange>
mpViewBox;
SvgAspectRatio maSvgAspectRatio; SvgAspectRatio maSvgAspectRatio;
SvgNumber maX; SvgNumber maX;
SvgNumber maY; SvgNumber maY;
@@ -70,8 +72,8 @@ namespace svgio
virtual const basegfx::B2DRange getCurrentViewPort() const override; virtual const basegfx::B2DRange getCurrentViewPort() const override;
/// viewBox content /// viewBox content
const basegfx::B2DRange* getViewBox() const { return mpViewBox; } const basegfx::B2DRange* getViewBox() const { return mpViewBox.get(); }
void setViewBox(const basegfx::B2DRange* pViewBox) { if(mpViewBox) delete mpViewBox; mpViewBox = nullptr; if(pViewBox) mpViewBox = new basegfx::B2DRange(*pViewBox); } void setViewBox(const basegfx::B2DRange* pViewBox) { mpViewBox.reset(); if(pViewBox) mpViewBox.reset( new basegfx::B2DRange(*pViewBox) ); }
/// SvgAspectRatio content /// SvgAspectRatio content
const SvgAspectRatio& getSvgAspectRatio() const { return maSvgAspectRatio; } const SvgAspectRatio& getSvgAspectRatio() const { return maSvgAspectRatio; }

View File

@@ -21,6 +21,7 @@
#define INCLUDED_SVGIO_INC_SVGSYMBOLNODE_HXX #define INCLUDED_SVGIO_INC_SVGSYMBOLNODE_HXX
#include <svgstyleattributes.hxx> #include <svgstyleattributes.hxx>
#include <memory>
namespace svgio namespace svgio
{ {
@@ -33,7 +34,8 @@ namespace svgio
SvgStyleAttributes maSvgStyleAttributes; SvgStyleAttributes maSvgStyleAttributes;
/// variable scan values, dependent of given XAttributeList /// variable scan values, dependent of given XAttributeList
basegfx::B2DRange* mpViewBox; std::unique_ptr<basegfx::B2DRange>
mpViewBox;
SvgAspectRatio maSvgAspectRatio; SvgAspectRatio maSvgAspectRatio;
public: public:
@@ -46,7 +48,7 @@ namespace svgio
virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override; virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override;
/// viewBox content /// viewBox content
void setViewBox(const basegfx::B2DRange* pViewBox) { if(mpViewBox) delete mpViewBox; mpViewBox = nullptr; if(pViewBox) mpViewBox = new basegfx::B2DRange(*pViewBox); } void setViewBox(const basegfx::B2DRange* pViewBox) { mpViewBox.reset(); if(pViewBox) mpViewBox.reset( new basegfx::B2DRange(*pViewBox) ); }
}; };
} // end of namespace svgreader } // end of namespace svgreader
} // end of namespace svgio } // end of namespace svgio

View File

@@ -23,6 +23,7 @@
#include <svgnode.hxx> #include <svgnode.hxx>
#include <svgstyleattributes.hxx> #include <svgstyleattributes.hxx>
#include <svgcharacternode.hxx> #include <svgcharacternode.hxx>
#include <memory>
namespace svgio namespace svgio
{ {
@@ -35,7 +36,8 @@ namespace svgio
SvgStyleAttributes maSvgStyleAttributes; SvgStyleAttributes maSvgStyleAttributes;
/// variable scan values, dependent of given XAttributeList /// variable scan values, dependent of given XAttributeList
basegfx::B2DHomMatrix* mpaTransform; std::unique_ptr<basegfx::B2DHomMatrix>
mpaTransform;
SvgTextPositions maSvgTextPositions; SvgTextPositions maSvgTextPositions;
/// local helpers /// local helpers
@@ -61,8 +63,8 @@ namespace svgio
virtual double getCurrentFontSize() const override; virtual double getCurrentFontSize() const override;
/// transform content, set if found in current context /// transform content, set if found in current context
const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; } const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform.get(); }
void setTransform(const basegfx::B2DHomMatrix* pMatrix) { if(mpaTransform) delete mpaTransform; mpaTransform = nullptr; if(pMatrix) mpaTransform = new basegfx::B2DHomMatrix(*pMatrix); } void setTransform(const basegfx::B2DHomMatrix* pMatrix) { mpaTransform.reset(); if(pMatrix) mpaTransform.reset( new basegfx::B2DHomMatrix(*pMatrix) ); }
}; };
} // end of namespace svgreader } // end of namespace svgreader
} // end of namespace svgio } // end of namespace svgio

View File

@@ -22,6 +22,7 @@
#include <svgnode.hxx> #include <svgnode.hxx>
#include <svgstyleattributes.hxx> #include <svgstyleattributes.hxx>
#include <memory>
namespace svgio namespace svgio
{ {
@@ -34,7 +35,8 @@ namespace svgio
SvgStyleAttributes maSvgStyleAttributes; SvgStyleAttributes maSvgStyleAttributes;
/// variable scan values, dependent of given XAttributeList /// variable scan values, dependent of given XAttributeList
basegfx::B2DHomMatrix* mpaTransform; std::unique_ptr<basegfx::B2DHomMatrix>
mpaTransform;
SvgNumber maX; SvgNumber maX;
SvgNumber maY; SvgNumber maY;
SvgNumber maWidth; SvgNumber maWidth;
@@ -55,8 +57,8 @@ namespace svgio
virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override; virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override;
/// transform content /// transform content
const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; } const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform.get(); }
void setTransform(const basegfx::B2DHomMatrix* pMatrix) { if(mpaTransform) delete mpaTransform; mpaTransform = nullptr; if(pMatrix) mpaTransform = new basegfx::B2DHomMatrix(*pMatrix); } void setTransform(const basegfx::B2DHomMatrix* pMatrix) { mpaTransform.reset(); if(pMatrix) mpaTransform.reset( new basegfx::B2DHomMatrix(*pMatrix) ); }
/// x content /// x content
const SvgNumber& getX() const { return maX; } const SvgNumber& getX() const { return maX; }

View File

@@ -36,7 +36,6 @@ namespace svgio
SvgANode::~SvgANode() SvgANode::~SvgANode()
{ {
delete mpaTransform;
} }
const SvgStyleAttributes* SvgANode::getSvgStyleAttributes() const const SvgStyleAttributes* SvgANode::getSvgStyleAttributes() const

View File

@@ -39,7 +39,6 @@ namespace svgio
SvgCircleNode::~SvgCircleNode() SvgCircleNode::~SvgCircleNode()
{ {
delete mpaTransform;
} }
const SvgStyleAttributes* SvgCircleNode::getSvgStyleAttributes() const const SvgStyleAttributes* SvgCircleNode::getSvgStyleAttributes() const

View File

@@ -42,7 +42,6 @@ namespace svgio
SvgClipPathNode::~SvgClipPathNode() SvgClipPathNode::~SvgClipPathNode()
{ {
delete mpaTransform;
} }
const SvgStyleAttributes* SvgClipPathNode::getSvgStyleAttributes() const const SvgStyleAttributes* SvgClipPathNode::getSvgStyleAttributes() const

View File

@@ -40,7 +40,6 @@ namespace svgio
SvgEllipseNode::~SvgEllipseNode() SvgEllipseNode::~SvgEllipseNode()
{ {
delete mpaTransform;
} }
const SvgStyleAttributes* SvgEllipseNode::getSvgStyleAttributes() const const SvgStyleAttributes* SvgEllipseNode::getSvgStyleAttributes() const

View File

@@ -38,7 +38,6 @@ namespace svgio
SvgGNode::~SvgGNode() SvgGNode::~SvgGNode()
{ {
delete mpaTransform;
} }
const SvgStyleAttributes* SvgGNode::getSvgStyleAttributes() const const SvgStyleAttributes* SvgGNode::getSvgStyleAttributes() const

View File

@@ -59,7 +59,6 @@ namespace svgio
SvgGradientNode::~SvgGradientNode() SvgGradientNode::~SvgGradientNode()
{ {
delete mpaGradientTransform;
// do NOT delete mpXLink, it's only referenced, not owned // do NOT delete mpXLink, it's only referenced, not owned
} }
@@ -472,7 +471,7 @@ namespace svgio
{ {
if(mpaGradientTransform) if(mpaGradientTransform)
{ {
return mpaGradientTransform; return mpaGradientTransform.get();
} }
const_cast< SvgGradientNode* >(this)->tryToFindLink(); const_cast< SvgGradientNode* >(this)->tryToFindLink();
@@ -487,15 +486,11 @@ namespace svgio
void SvgGradientNode::setGradientTransform(const basegfx::B2DHomMatrix* pMatrix) void SvgGradientNode::setGradientTransform(const basegfx::B2DHomMatrix* pMatrix)
{ {
if(mpaGradientTransform) mpaGradientTransform.reset();
{
delete mpaGradientTransform;
mpaGradientTransform = nullptr;
}
if(pMatrix) if(pMatrix)
{ {
mpaGradientTransform = new basegfx::B2DHomMatrix(*pMatrix); mpaGradientTransform.reset(new basegfx::B2DHomMatrix(*pMatrix) );
} }
} }

View File

@@ -57,7 +57,6 @@ namespace svgio
SvgImageNode::~SvgImageNode() SvgImageNode::~SvgImageNode()
{ {
delete mpaTransform;
} }
const SvgStyleAttributes* SvgImageNode::getSvgStyleAttributes() const const SvgStyleAttributes* SvgImageNode::getSvgStyleAttributes() const

View File

@@ -40,7 +40,6 @@ namespace svgio
SvgLineNode::~SvgLineNode() SvgLineNode::~SvgLineNode()
{ {
delete mpaTransform;
} }
const SvgStyleAttributes* SvgLineNode::getSvgStyleAttributes() const const SvgStyleAttributes* SvgLineNode::getSvgStyleAttributes() const

View File

@@ -43,7 +43,6 @@ namespace svgio
SvgMarkerNode::~SvgMarkerNode() SvgMarkerNode::~SvgMarkerNode()
{ {
delete mpViewBox;
} }
const SvgStyleAttributes* SvgMarkerNode::getSvgStyleAttributes() const const SvgStyleAttributes* SvgMarkerNode::getSvgStyleAttributes() const

View File

@@ -48,7 +48,6 @@ namespace svgio
SvgMaskNode::~SvgMaskNode() SvgMaskNode::~SvgMaskNode()
{ {
delete mpaTransform;
} }
const SvgStyleAttributes* SvgMaskNode::getSvgStyleAttributes() const const SvgStyleAttributes* SvgMaskNode::getSvgStyleAttributes() const

View File

@@ -42,7 +42,6 @@ namespace svgio
SvgRectNode::~SvgRectNode() SvgRectNode::~SvgRectNode()
{ {
delete mpaTransform;
} }
const SvgStyleAttributes* SvgRectNode::getSvgStyleAttributes() const const SvgStyleAttributes* SvgRectNode::getSvgStyleAttributes() const

View File

@@ -106,7 +106,6 @@ namespace svgio
SvgSvgNode::~SvgSvgNode() SvgSvgNode::~SvgSvgNode()
{ {
delete mpViewBox;
} }
const SvgStyleAttributes* SvgSvgNode::getSvgStyleAttributes() const const SvgStyleAttributes* SvgSvgNode::getSvgStyleAttributes() const

View File

@@ -37,7 +37,6 @@ namespace svgio
SvgSymbolNode::~SvgSymbolNode() SvgSymbolNode::~SvgSymbolNode()
{ {
delete mpViewBox;
} }
const SvgStyleAttributes* SvgSymbolNode::getSvgStyleAttributes() const const SvgStyleAttributes* SvgSymbolNode::getSvgStyleAttributes() const

View File

@@ -42,7 +42,6 @@ namespace svgio
SvgTextNode::~SvgTextNode() SvgTextNode::~SvgTextNode()
{ {
delete mpaTransform;
} }
const SvgStyleAttributes* SvgTextNode::getSvgStyleAttributes() const const SvgStyleAttributes* SvgTextNode::getSvgStyleAttributes() const

View File

@@ -41,7 +41,6 @@ namespace svgio
SvgUseNode::~SvgUseNode() SvgUseNode::~SvgUseNode()
{ {
delete mpaTransform;
} }
const SvgStyleAttributes* SvgUseNode::getSvgStyleAttributes() const const SvgStyleAttributes* SvgUseNode::getSvgStyleAttributes() const