diff options
author | Miklos Vajna <vmiklos@frugalware.org> | 2011-08-10 16:40:39 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@frugalware.org> | 2011-08-10 16:40:39 +0200 |
commit | 41430f10267643eefb7163682b30b12c4ff24911 (patch) | |
tree | 1b0c15a0fbffe2258c2bdf768e8ed54d2f75196d | |
parent | e20a75a4f3b991f78d67bc333b23d2a9fa9c1470 (diff) |
RTFValue: avoid raw pointers
-rw-r--r-- | writerfilter/source/rtftok/rtfvalue.cxx | 30 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfvalue.hxx | 6 |
2 files changed, 17 insertions, 19 deletions
diff --git a/writerfilter/source/rtftok/rtfvalue.cxx b/writerfilter/source/rtftok/rtfvalue.cxx index 961f6d758402..0469adc51413 100644 --- a/writerfilter/source/rtftok/rtfvalue.cxx +++ b/writerfilter/source/rtftok/rtfvalue.cxx @@ -45,8 +45,8 @@ RTFValue::RTFValue(int nValue, rtl::OUString sValue, RTFSprms rAttributes, m_rStream(rStream), m_bForceString(false) { - m_pAttributes = new RTFSprms(rAttributes); - m_pSprms = new RTFSprms(rSprms); + m_pAttributes.reset(new RTFSprms(rAttributes)); + m_pSprms.reset(new RTFSprms(rSprms)); } RTFValue::RTFValue(int nValue) @@ -56,8 +56,8 @@ RTFValue::RTFValue(int nValue) m_rStream(), m_bForceString(false) { - m_pAttributes = new RTFSprms(); - m_pSprms = new RTFSprms(); + m_pAttributes.reset(new RTFSprms()); + m_pSprms.reset(new RTFSprms()); } RTFValue::RTFValue(OUString sValue, bool bForce) @@ -67,8 +67,8 @@ RTFValue::RTFValue(OUString sValue, bool bForce) m_rStream(), m_bForceString(bForce) { - m_pAttributes = new RTFSprms(); - m_pSprms = new RTFSprms(); + m_pAttributes.reset(new RTFSprms()); + m_pSprms.reset(new RTFSprms()); } RTFValue::RTFValue(RTFSprms rAttributes) @@ -78,8 +78,8 @@ RTFValue::RTFValue(RTFSprms rAttributes) m_rStream(), m_bForceString(false) { - m_pAttributes = new RTFSprms(rAttributes); - m_pSprms = new RTFSprms(); + m_pAttributes.reset(new RTFSprms(rAttributes)); + m_pSprms.reset(new RTFSprms()); } RTFValue::RTFValue(RTFSprms rAttributes, RTFSprms rSprms) @@ -89,8 +89,8 @@ RTFValue::RTFValue(RTFSprms rAttributes, RTFSprms rSprms) m_rStream(), m_bForceString(false) { - m_pAttributes = new RTFSprms(rAttributes); - m_pSprms = new RTFSprms(rSprms); + m_pAttributes.reset(new RTFSprms(rAttributes)); + m_pSprms.reset(new RTFSprms(rSprms)); } RTFValue::RTFValue(uno::Reference<drawing::XShape> rShape) @@ -100,8 +100,8 @@ RTFValue::RTFValue(uno::Reference<drawing::XShape> rShape) m_rStream(), m_bForceString(false) { - m_pAttributes = new RTFSprms(); - m_pSprms = new RTFSprms(); + m_pAttributes.reset(new RTFSprms()); + m_pSprms.reset(new RTFSprms()); } RTFValue::RTFValue(uno::Reference<io::XInputStream> rStream) @@ -111,14 +111,12 @@ RTFValue::RTFValue(uno::Reference<io::XInputStream> rStream) m_rStream(rStream), m_bForceString(false) { - m_pAttributes = new RTFSprms(); - m_pSprms = new RTFSprms(); + m_pAttributes.reset(new RTFSprms()); + m_pSprms.reset(new RTFSprms()); } RTFValue::~RTFValue() { - delete m_pAttributes; - delete m_pSprms; } int RTFValue::getInt() const diff --git a/writerfilter/source/rtftok/rtfvalue.hxx b/writerfilter/source/rtftok/rtfvalue.hxx index db9005f02832..b83340e4c7a3 100644 --- a/writerfilter/source/rtftok/rtfvalue.hxx +++ b/writerfilter/source/rtftok/rtfvalue.hxx @@ -42,7 +42,7 @@ namespace writerfilter { : public Value { public: - typedef ::boost::shared_ptr<RTFValue> Pointer_t; + typedef boost::shared_ptr<RTFValue> Pointer_t; RTFValue(int nValue, rtl::OUString sValue, RTFSprms rAttributes, RTFSprms rSprms, uno::Reference<drawing::XShape> rShape, uno::Reference<io::XInputStream> rStream); RTFValue(int nValue); @@ -66,8 +66,8 @@ namespace writerfilter { private: int m_nValue; rtl::OUString m_sValue; - RTFSprms* m_pAttributes; - RTFSprms* m_pSprms; + boost::shared_ptr<RTFSprms> m_pAttributes; + boost::shared_ptr<RTFSprms> m_pSprms; uno::Reference<drawing::XShape> m_rShape; uno::Reference<io::XInputStream> m_rStream; bool m_bForceString; |