RTFValue: avoid raw pointers

This commit is contained in:
Miklos Vajna 2011-08-10 16:40:39 +02:00
parent e20a75a4f3
commit 41430f1026
2 changed files with 17 additions and 19 deletions

View file

@ -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

View file

@ -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;