loplugin:useuniqueptr in idl

Change-Id: I3681d119dda85400dbb33c96fab736c262f7ce8a
This commit is contained in:
Noel Grandin 2018-01-15 16:33:36 +02:00
parent 13e55cedd2
commit 61bfcf16dc
5 changed files with 8 additions and 11 deletions

View file

@ -71,7 +71,7 @@ class SvIdlDataBase
sal_uInt32 nUniqueId;
sal_uInt32 nVerbosity;
StringList aIdFileList;
SvStringHashTable * pIdTable;
std::unique_ptr<SvStringHashTable> pIdTable;
SvRefMemberList<SvMetaType *> aTypeList;
SvRefMemberList<SvMetaClass *> aClassList;

View file

@ -21,6 +21,7 @@
#define INCLUDED_IDL_INC_GLOBALS_HXX
#include "hash.hxx"
#include <memory>
struct SvGlobalHashNames
{
@ -68,8 +69,8 @@ struct SvGlobalHashNames
class IdlDll
{
public:
SvStringHashTable * pHashTable;
SvGlobalHashNames * pGlobalNames;
std::unique_ptr<SvStringHashTable> pHashTable;
std::unique_ptr<SvGlobalHashNames> pGlobalNames;
IdlDll();
~IdlDll();
@ -81,7 +82,7 @@ IdlDll & GetIdlApp();
inline SvStringHashEntry * SvHash_##Name() \
{ \
if( !GetIdlApp().pGlobalNames ) \
GetIdlApp().pGlobalNames = new SvGlobalHashNames(); \
GetIdlApp().pGlobalNames.reset( new SvGlobalHashNames() ); \
return GetIdlApp().pGlobalNames->MM_##Name; \
}

View file

@ -108,9 +108,9 @@ char const CommandLineSyntax[] =
void Init()
{
if( !GetIdlApp().pHashTable )
GetIdlApp().pHashTable = new SvStringHashTable;
GetIdlApp().pHashTable.reset( new SvStringHashTable );
if( !GetIdlApp().pGlobalNames )
GetIdlApp().pGlobalNames = new SvGlobalHashNames();
GetIdlApp().pGlobalNames.reset( new SvGlobalHashNames() );
}
bool ReadIdl( SvIdlWorkingBase * pDataBase, const SvCommand & rCommand )

View file

@ -54,8 +54,6 @@ SvIdlDataBase::SvIdlDataBase( const SvCommand& rCmd )
SvIdlDataBase::~SvIdlDataBase()
{
aIdFileList.clear();
delete pIdTable;
}
#define ADD_TYPE( Name ) \
@ -126,7 +124,7 @@ bool SvIdlDataBase::FindId( const OString& rIdName, sal_uLong * pVal )
void SvIdlDataBase::InsertId( const OString& rIdName, sal_uLong nVal )
{
if( !pIdTable )
pIdTable = new SvStringHashTable;
pIdTable.reset( new SvStringHashTable );
sal_uInt32 nHash;
pIdTable->Insert( rIdName, &nHash )->SetValue( nVal );

View file

@ -41,8 +41,6 @@ IdlDll::IdlDll()
IdlDll::~IdlDll()
{
delete pGlobalNames;
delete pHashTable;
}
inline SvStringHashEntry * INS( const OString& rName )