Kaydet (Commit) b0631cc1 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in XMLTextParagraphExport

Change-Id: I753bbfc60172a36e1f3ba08398dc17ee14e0c551
Reviewed-on: https://gerrit.libreoffice.org/53604Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst af73d613
...@@ -109,7 +109,7 @@ class XMLOFF_DLLPUBLIC XMLTextParagraphExport : public XMLStyleExport ...@@ -109,7 +109,7 @@ class XMLOFF_DLLPUBLIC XMLTextParagraphExport : public XMLStyleExport
bool bOpenRuby; bool bOpenRuby;
XMLTextListsHelper* mpTextListsHelper; XMLTextListsHelper* mpTextListsHelper;
::std::vector< XMLTextListsHelper* > maTextListsHelperStack; ::std::vector< std::unique_ptr<XMLTextListsHelper> > maTextListsHelperStack;
enum class FrameType { Text, Graphic, Embedded, Shape }; enum class FrameType { Text, Graphic, Embedded, Shape };
public: public:
......
...@@ -43,7 +43,7 @@ public: ...@@ -43,7 +43,7 @@ public:
CPPUNIT_TEST(testMetaGenerator); CPPUNIT_TEST(testMetaGenerator);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
private: private:
SvXMLExport *pExport; std::unique_ptr<SvXMLExport> pExport;
}; };
Test::Test() Test::Test()
...@@ -55,14 +55,14 @@ void Test::setUp() ...@@ -55,14 +55,14 @@ void Test::setUp()
{ {
BootstrapFixture::setUp(); BootstrapFixture::setUp();
pExport = new SchXMLExport( pExport.reset(new SchXMLExport(
comphelper::getProcessComponentContext(), "SchXMLExport.Compact", comphelper::getProcessComponentContext(), "SchXMLExport.Compact",
SvXMLExportFlags::ALL); SvXMLExportFlags::ALL));
} }
void Test::tearDown() void Test::tearDown()
{ {
delete pExport; pExport.reset();
BootstrapFixture::tearDown(); BootstrapFixture::tearDown();
} }
......
...@@ -3844,18 +3844,17 @@ void XMLTextParagraphExport::PreventExportOfControlsInMuteSections( ...@@ -3844,18 +3844,17 @@ void XMLTextParagraphExport::PreventExportOfControlsInMuteSections(
void XMLTextParagraphExport::PushNewTextListsHelper() void XMLTextParagraphExport::PushNewTextListsHelper()
{ {
mpTextListsHelper = new XMLTextListsHelper(); maTextListsHelperStack.emplace_back( new XMLTextListsHelper() );
maTextListsHelperStack.push_back( mpTextListsHelper ); mpTextListsHelper = maTextListsHelperStack.back().get();
} }
void XMLTextParagraphExport::PopTextListsHelper() void XMLTextParagraphExport::PopTextListsHelper()
{ {
delete mpTextListsHelper;
mpTextListsHelper = nullptr; mpTextListsHelper = nullptr;
maTextListsHelperStack.pop_back(); maTextListsHelperStack.pop_back();
if ( !maTextListsHelperStack.empty() ) if ( !maTextListsHelperStack.empty() )
{ {
mpTextListsHelper = maTextListsHelperStack.back(); mpTextListsHelper = maTextListsHelperStack.back().get();
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment