diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-03-01 10:37:53 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-03-05 07:31:57 +0100 |
commit | 73668f8e009534ec38460ccea1065e1c1f52c8f7 (patch) | |
tree | 87e8935d4d291e4ad6b1774dd48c4197df3e01e6 /lotuswordpro | |
parent | dca7203aaba8e3ded03850d53b5d58280fdf5fb6 (diff) |
loplugin:useuniqueptr in LwpGlobalMgr
Change-Id: I04651e32dd036bc12ed12097e4ee3bf6e5bf3dcf
Reviewed-on: https://gerrit.libreoffice.org/50725
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'lotuswordpro')
-rw-r--r-- | lotuswordpro/inc/lwpglobalmgr.hxx | 20 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwpglobalmgr.cxx | 42 |
2 files changed, 20 insertions, 42 deletions
diff --git a/lotuswordpro/inc/lwpglobalmgr.hxx b/lotuswordpro/inc/lwpglobalmgr.hxx index 32a290f0d4a1..d0e2eee3ca7a 100644 --- a/lotuswordpro/inc/lwpglobalmgr.hxx +++ b/lotuswordpro/inc/lwpglobalmgr.hxx @@ -79,11 +79,11 @@ public: ~LwpGlobalMgr(); static LwpGlobalMgr* GetInstance(LwpSvStream* pSvStream=nullptr); static void DeleteInstance(); - LwpObjectFactory* GetLwpObjFactory(){return m_pObjFactory;} - LwpBookmarkMgr* GetLwpBookmarkMgr(){return m_pBookmarkMgr;} - LwpChangeMgr* GetLwpChangeMgr(){return m_pChangeMgr;} - XFFontFactory* GetXFFontFactory(){return m_pXFFontFactory;} - XFStyleManager* GetXFStyleManager(){return m_pXFStyleManager;} + LwpObjectFactory* GetLwpObjFactory(){return m_pObjFactory.get();} + LwpBookmarkMgr* GetLwpBookmarkMgr(){return m_pBookmarkMgr.get();} + LwpChangeMgr* GetLwpChangeMgr(){return m_pChangeMgr.get();} + XFFontFactory* GetXFFontFactory(){return m_pXFFontFactory.get();} + XFStyleManager* GetXFStyleManager(){return m_pXFStyleManager.get();} void SetEditorAttrMap(sal_uInt16 nID, LwpEditorAttr* pAttr); OUString GetEditorName(sal_uInt8 nID); XFColor GetHighlightColor(sal_uInt8 nID); @@ -91,11 +91,11 @@ private: explicit LwpGlobalMgr(LwpSvStream* pSvStream); private: static std::map< sal_uInt32,LwpGlobalMgr* > m_ThreadMap; - LwpObjectFactory* m_pObjFactory; - LwpBookmarkMgr* m_pBookmarkMgr; - LwpChangeMgr* m_pChangeMgr; - XFFontFactory* m_pXFFontFactory; - XFStyleManager* m_pXFStyleManager; + std::unique_ptr<LwpObjectFactory> m_pObjFactory; + std::unique_ptr<LwpBookmarkMgr> m_pBookmarkMgr; + std::unique_ptr<LwpChangeMgr> m_pChangeMgr; + std::unique_ptr<XFFontFactory> m_pXFFontFactory; + std::unique_ptr<XFStyleManager> m_pXFStyleManager; std::map<sal_uInt16, std::unique_ptr<LwpEditorAttr>> m_EditorAttrMap; }; diff --git a/lotuswordpro/source/filter/lwpglobalmgr.cxx b/lotuswordpro/source/filter/lwpglobalmgr.cxx index 94eec192a7c0..7ccbb71f74db 100644 --- a/lotuswordpro/source/filter/lwpglobalmgr.cxx +++ b/lotuswordpro/source/filter/lwpglobalmgr.cxx @@ -59,42 +59,20 @@ std::map< sal_uInt32,LwpGlobalMgr* > LwpGlobalMgr::m_ThreadMap; LwpGlobalMgr::LwpGlobalMgr(LwpSvStream* pSvStream) { if (pSvStream) - m_pObjFactory = new LwpObjectFactory(pSvStream); - else - m_pObjFactory = nullptr; - m_pBookmarkMgr = new LwpBookmarkMgr; - m_pChangeMgr = new LwpChangeMgr; - m_pXFFontFactory = new XFFontFactory; - m_pXFStyleManager = new XFStyleManager; + m_pObjFactory.reset( new LwpObjectFactory(pSvStream) ); + m_pBookmarkMgr.reset( new LwpBookmarkMgr ); + m_pChangeMgr.reset( new LwpChangeMgr ); + m_pXFFontFactory.reset( new XFFontFactory ); + m_pXFStyleManager.reset( new XFStyleManager ); } LwpGlobalMgr::~LwpGlobalMgr() { - if (m_pObjFactory) - { - delete m_pObjFactory; - m_pObjFactory = nullptr; - } - if (m_pBookmarkMgr) - { - delete m_pBookmarkMgr; - m_pBookmarkMgr = nullptr; - } - if (m_pChangeMgr) - { - delete m_pChangeMgr; - m_pChangeMgr = nullptr; - } - if (m_pXFFontFactory) - { - delete m_pXFFontFactory; - m_pXFFontFactory = nullptr; - } - if (m_pXFStyleManager) - { - delete m_pXFStyleManager; - m_pXFStyleManager = nullptr; - } + m_pObjFactory.reset(); + m_pBookmarkMgr.reset(); + m_pChangeMgr.reset(); + m_pXFFontFactory.reset(); + m_pXFStyleManager.reset(); m_EditorAttrMap.clear(); } |