new loplugin: useuniqueptr: extensions
Change-Id: Iaafaf0117a339dbb435cec2bbf4dca55629ab8a2 Reviewed-on: https://gerrit.libreoffice.org/33154 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
parent
18c2a1a902
commit
99e09b18b7
@ -42,9 +42,9 @@ namespace COMPMOD_NAMESPACE
|
|||||||
// implementation for <type>OModule</type>. not threadsafe, has to be guarded by its owner
|
// implementation for <type>OModule</type>. not threadsafe, has to be guarded by its owner
|
||||||
class OModuleImpl
|
class OModuleImpl
|
||||||
{
|
{
|
||||||
ResMgr* m_pResources;
|
std::unique_ptr<ResMgr> m_pResources;
|
||||||
bool m_bInitialized;
|
bool m_bInitialized;
|
||||||
OString m_sFilePrefix;
|
OString m_sFilePrefix;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// ctor
|
/// ctor
|
||||||
@ -66,7 +66,6 @@ namespace COMPMOD_NAMESPACE
|
|||||||
|
|
||||||
OModuleImpl::~OModuleImpl()
|
OModuleImpl::~OModuleImpl()
|
||||||
{
|
{
|
||||||
delete m_pResources;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -77,7 +76,7 @@ namespace COMPMOD_NAMESPACE
|
|||||||
{
|
{
|
||||||
DBG_ASSERT(!m_sFilePrefix.isEmpty(), "OModuleImpl::getResManager: no resource file prefix!");
|
DBG_ASSERT(!m_sFilePrefix.isEmpty(), "OModuleImpl::getResManager: no resource file prefix!");
|
||||||
// create a manager with a fixed prefix
|
// create a manager with a fixed prefix
|
||||||
m_pResources = ResMgr::CreateResMgr(m_sFilePrefix.getStr());
|
m_pResources.reset( ResMgr::CreateResMgr(m_sFilePrefix.getStr()) );
|
||||||
DBG_ASSERT(m_pResources,
|
DBG_ASSERT(m_pResources,
|
||||||
OStringBuffer("OModuleImpl::getResManager: could not create the resource manager (file name: ")
|
OStringBuffer("OModuleImpl::getResManager: could not create the resource manager (file name: ")
|
||||||
.append(m_sFilePrefix)
|
.append(m_sFilePrefix)
|
||||||
@ -85,7 +84,7 @@ namespace COMPMOD_NAMESPACE
|
|||||||
|
|
||||||
m_bInitialized = true;
|
m_bInitialized = true;
|
||||||
}
|
}
|
||||||
return m_pResources;
|
return m_pResources.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ namespace extensions { namespace resource
|
|||||||
::osl::Mutex m_aMutex;
|
::osl::Mutex m_aMutex;
|
||||||
Reference< XResourceBundle > m_xParent;
|
Reference< XResourceBundle > m_xParent;
|
||||||
Locale m_aLocale;
|
Locale m_aLocale;
|
||||||
SimpleResMgr* m_pResourceManager;
|
std::unique_ptr<SimpleResMgr> m_pResourceManager;
|
||||||
ResourceTypes m_aResourceTypes;
|
ResourceTypes m_aResourceTypes;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -177,13 +177,11 @@ namespace extensions { namespace resource
|
|||||||
:m_aLocale( _rLocale )
|
:m_aLocale( _rLocale )
|
||||||
,m_pResourceManager( nullptr )
|
,m_pResourceManager( nullptr )
|
||||||
{
|
{
|
||||||
m_pResourceManager = new SimpleResMgr( OUStringToOString( _rBaseName, RTL_TEXTENCODING_UTF8 ).getStr(),
|
m_pResourceManager.reset( new SimpleResMgr( OUStringToOString( _rBaseName, RTL_TEXTENCODING_UTF8 ).getStr(),
|
||||||
LanguageTag( m_aLocale) );
|
LanguageTag( m_aLocale) ) );
|
||||||
|
|
||||||
if ( !m_pResourceManager->IsValid() )
|
if ( !m_pResourceManager->IsValid() )
|
||||||
{
|
{
|
||||||
delete m_pResourceManager;
|
|
||||||
m_pResourceManager = nullptr;
|
|
||||||
throw MissingResourceException();
|
throw MissingResourceException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,7 +192,6 @@ namespace extensions { namespace resource
|
|||||||
|
|
||||||
OpenOfficeResourceBundle::~OpenOfficeResourceBundle()
|
OpenOfficeResourceBundle::~OpenOfficeResourceBundle()
|
||||||
{
|
{
|
||||||
delete m_pResourceManager;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Reference< XResourceBundle > SAL_CALL OpenOfficeResourceBundle::getParent() throw (RuntimeException, std::exception)
|
Reference< XResourceBundle > SAL_CALL OpenOfficeResourceBundle::getParent() throw (RuntimeException, std::exception)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user