loplugin:useuniqueptr

Change-Id: I66e3e1b3c92304643a783203e4f245e93701ba9a
This commit is contained in:
Stephan Bergmann
2017-01-26 19:04:40 +01:00
parent 79ed69ed92
commit 1041bc88ec
2 changed files with 14 additions and 16 deletions

View File

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

View File

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