diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-03-27 14:04:29 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-03-28 08:39:35 +0200 |
commit | e32c56855b04ef825b720b20220245365eec51fd (patch) | |
tree | d497c6fad6e3e7ac39a8bc80fa8e81fc7192f199 /svgio/source/svgreader | |
parent | b2e8bbeafa35c15d168961de711e4970eb0985cb (diff) |
use boost::optional in sc and svgio
instead of using std:unique_ptr to allocate small objects on the heap
Change-Id: Ifd309a9bf331910354406b827b89a0363f3b7eda
Reviewed-on: https://gerrit.libreoffice.org/51945
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svgio/source/svgreader')
-rw-r--r-- | svgio/source/svgreader/svgnode.cxx | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/svgio/source/svgreader/svgnode.cxx b/svgio/source/svgreader/svgnode.cxx index 9f3687e67a25..f6395a24527d 100644 --- a/svgio/source/svgreader/svgnode.cxx +++ b/svgio/source/svgreader/svgnode.cxx @@ -263,8 +263,6 @@ namespace svgio mpParent(pParent), mpAlternativeParent(nullptr), maChildren(), - mpId(nullptr), - mpClass(nullptr), maXmlSpace(XmlSpace_notset), maDisplay(Display_inline), maCssStyleVector(), @@ -422,7 +420,7 @@ namespace svgio { if(!aContent.isEmpty()) { - setId(&aContent); + setId(aContent); } break; } @@ -430,7 +428,7 @@ namespace svgio { if(!aContent.isEmpty()) { - setClass(&aContent); + setClass(aContent); } break; } @@ -629,7 +627,7 @@ namespace svgio return getCurrentXHeightInherited(); } - void SvgNode::setId(const OUString* pfId) + void SvgNode::setId(OUString const & rId) { if(mpId) { @@ -637,14 +635,11 @@ namespace svgio mpId.reset(); } - if(pfId) - { - mpId.reset( new OUString(*pfId) ); - mrDocument.addSvgNodeToMapper(*mpId, *this); - } + mpId = rId; + mrDocument.addSvgNodeToMapper(*mpId, *this); } - void SvgNode::setClass(const OUString* pfClass) + void SvgNode::setClass(OUString const & rClass) { if(mpClass) { @@ -652,11 +647,8 @@ namespace svgio mpClass.reset(); } - if(pfClass) - { - mpClass.reset( new OUString(*pfClass) ); - mrDocument.addSvgNodeToMapper(*mpClass, *this); - } + mpClass = rClass; + mrDocument.addSvgNodeToMapper(*mpClass, *this); } XmlSpace SvgNode::getXmlSpace() const |