diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-02 10:55:46 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-04 08:15:37 +0200 |
commit | 5c7de51f908e866cdab7dbf4aa22aa48f42dc153 (patch) | |
tree | 5ff2f6f3d7ec4de89faef7a5bdb4787a517b3945 /sd | |
parent | 5f5d890c242b8a092804991dba809f6f4287cfb2 (diff) |
loplugin:useuniqueptr in ResultMembers
no need to store a small structure separately on the heap
Change-Id: I054ca078242225d12cf8abc86e25813586e6495f
Reviewed-on: https://gerrit.libreoffice.org/61299
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/filter/eppt/pptx-text.cxx | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/sd/source/filter/eppt/pptx-text.cxx b/sd/source/filter/eppt/pptx-text.cxx index bbcc1a1a7312..71d05d0910cd 100644 --- a/sd/source/filter/eppt/pptx-text.cxx +++ b/sd/source/filter/eppt/pptx-text.cxx @@ -1267,11 +1267,10 @@ struct ImplTextObj { sal_uInt32 mnTextSize; int mnInstance; - std::vector<ParagraphObj*> maList; + std::vector<std::unique_ptr<ParagraphObj>> maList; bool mbHasExtendedBullets; explicit ImplTextObj( int nInstance ); - ~ImplTextObj(); }; ImplTextObj::ImplTextObj( int nInstance ) @@ -1282,12 +1281,6 @@ ImplTextObj::ImplTextObj( int nInstance ) mbHasExtendedBullets = false; } -ImplTextObj::~ImplTextObj() -{ - for ( std::vector<ParagraphObj*>::const_iterator it = maList.begin(); it != maList.end(); ++it ) - delete *it; -} - TextObj::TextObj( css::uno::Reference< css::text::XSimpleText > const & rXTextRef, int nInstance, FontCollection& rFontCollection, PPTExBulletProvider& rProv ): mpImplTextObj(new ImplTextObj(nInstance)) @@ -1308,9 +1301,9 @@ TextObj::TextObj( css::uno::Reference< css::text::XSimpleText > const & rXTextRe { if ( !aXTextParagraphE->hasMoreElements() ) aParaFlags.bLastParagraph = true; - ParagraphObj* pPara = new ParagraphObj( aXParagraph, aParaFlags, rFontCollection, rProv ); + std::unique_ptr<ParagraphObj> pPara(new ParagraphObj( aXParagraph, aParaFlags, rFontCollection, rProv )); mpImplTextObj->mbHasExtendedBullets |= pPara->bExtendedBulletsUsed; - mpImplTextObj->maList.push_back( pPara ); + mpImplTextObj->maList.push_back( std::move(pPara) ); aParaFlags.bFirstParagraph = false; } } @@ -1328,7 +1321,7 @@ void TextObj::ImplCalculateTextPositions() ParagraphObj* TextObj::GetParagraph(int idx) { - return mpImplTextObj->maList[idx]; + return mpImplTextObj->maList[idx].get(); } sal_uInt32 TextObj::ParagraphCount() const |