diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-01-26 19:04:40 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-01-26 19:04:40 +0100 |
commit | 1041bc88ec7fb83aaa228c97dafd6c0ac75dd1e0 (patch) | |
tree | 1390735d335b70ae6106ebde494f29f4cdfdfcc8 /fpicker | |
parent | 79ed69ed92694f607691c539cf179b4bc2068589 (diff) |
loplugin:useuniqueptr
Change-Id: I66e3e1b3c92304643a783203e4f245e93701ba9a
Diffstat (limited to 'fpicker')
-rw-r--r-- | fpicker/source/win32/misc/resourceprovider.cxx | 24 | ||||
-rw-r--r-- | fpicker/source/win32/misc/resourceprovider.hxx | 6 |
2 files changed, 14 insertions, 16 deletions
diff --git a/fpicker/source/win32/misc/resourceprovider.cxx b/fpicker/source/win32/misc/resourceprovider.cxx index 9360089c76ed..35ec2a2c8218 100644 --- a/fpicker/source/win32/misc/resourceprovider.cxx +++ b/fpicker/source/win32/misc/resourceprovider.cxx @@ -17,6 +17,11 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <memory> + +#include <o3tl/make_unique.hxx> #include <osl/diagnose.h> #include <rtl/ustrbuf.hxx> #include "resourceprovider.hxx" @@ -85,25 +90,16 @@ public: CResourceProvider_Impl( ) { const SolarMutexGuard aGuard; - m_ResMgr = new SimpleResMgr( + m_ResMgr = o3tl::make_unique<SimpleResMgr>( "fps_office", Application::GetSettings().GetUILanguageTag()); } - - ~CResourceProvider_Impl( ) - { - delete m_ResMgr; - } - - OUString getResString( sal_Int16 aId ) { OUString aResOUString; try { - OSL_ASSERT( m_ResMgr ); - // translate the control id to a resource id sal_Int16 aResId = CtrlIdToResId( aId ); @@ -118,18 +114,16 @@ public: } public: - SimpleResMgr* m_ResMgr; + std::unique_ptr<SimpleResMgr> m_ResMgr; }; CResourceProvider::CResourceProvider( ) : - m_pImpl( new CResourceProvider_Impl() ) + m_pImpl( o3tl::make_unique<CResourceProvider_Impl>() ) { } CResourceProvider::~CResourceProvider( ) -{ - delete m_pImpl; -} +{} OUString CResourceProvider::getResString( sal_Int16 aId ) { diff --git a/fpicker/source/win32/misc/resourceprovider.hxx b/fpicker/source/win32/misc/resourceprovider.hxx index 32f3b118f759..8d515cbeb20b 100644 --- a/fpicker/source/win32/misc/resourceprovider.hxx +++ b/fpicker/source/win32/misc/resourceprovider.hxx @@ -21,6 +21,10 @@ #ifndef INCLUDED_FPICKER_SOURCE_WIN32_MISC_RESOURCEPROVIDER_HXX #define INCLUDED_FPICKER_SOURCE_WIN32_MISC_RESOURCEPROVIDER_HXX +#include <sal/config.h> + +#include <memory> + #include <sal/types.h> #include <rtl/ustring.hxx> @@ -36,7 +40,7 @@ public: OUString getResString( sal_Int16 aId ); private: - CResourceProvider_Impl* m_pImpl; + std::unique_ptr<CResourceProvider_Impl> m_pImpl; }; #endif |