Kaydet (Commit) 61bfcf16 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in idl

Change-Id: I3681d119dda85400dbb33c96fab736c262f7ce8a
üst 13e55ced
...@@ -71,7 +71,7 @@ class SvIdlDataBase ...@@ -71,7 +71,7 @@ class SvIdlDataBase
sal_uInt32 nUniqueId; sal_uInt32 nUniqueId;
sal_uInt32 nVerbosity; sal_uInt32 nVerbosity;
StringList aIdFileList; StringList aIdFileList;
SvStringHashTable * pIdTable; std::unique_ptr<SvStringHashTable> pIdTable;
SvRefMemberList<SvMetaType *> aTypeList; SvRefMemberList<SvMetaType *> aTypeList;
SvRefMemberList<SvMetaClass *> aClassList; SvRefMemberList<SvMetaClass *> aClassList;
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#define INCLUDED_IDL_INC_GLOBALS_HXX #define INCLUDED_IDL_INC_GLOBALS_HXX
#include "hash.hxx" #include "hash.hxx"
#include <memory>
struct SvGlobalHashNames struct SvGlobalHashNames
{ {
...@@ -68,8 +69,8 @@ struct SvGlobalHashNames ...@@ -68,8 +69,8 @@ struct SvGlobalHashNames
class IdlDll class IdlDll
{ {
public: public:
SvStringHashTable * pHashTable; std::unique_ptr<SvStringHashTable> pHashTable;
SvGlobalHashNames * pGlobalNames; std::unique_ptr<SvGlobalHashNames> pGlobalNames;
IdlDll(); IdlDll();
~IdlDll(); ~IdlDll();
...@@ -81,7 +82,7 @@ IdlDll & GetIdlApp(); ...@@ -81,7 +82,7 @@ IdlDll & GetIdlApp();
inline SvStringHashEntry * SvHash_##Name() \ inline SvStringHashEntry * SvHash_##Name() \
{ \ { \
if( !GetIdlApp().pGlobalNames ) \ if( !GetIdlApp().pGlobalNames ) \
GetIdlApp().pGlobalNames = new SvGlobalHashNames(); \ GetIdlApp().pGlobalNames.reset( new SvGlobalHashNames() ); \
return GetIdlApp().pGlobalNames->MM_##Name; \ return GetIdlApp().pGlobalNames->MM_##Name; \
} }
......
...@@ -108,9 +108,9 @@ char const CommandLineSyntax[] = ...@@ -108,9 +108,9 @@ char const CommandLineSyntax[] =
void Init() void Init()
{ {
if( !GetIdlApp().pHashTable ) if( !GetIdlApp().pHashTable )
GetIdlApp().pHashTable = new SvStringHashTable; GetIdlApp().pHashTable.reset( new SvStringHashTable );
if( !GetIdlApp().pGlobalNames ) if( !GetIdlApp().pGlobalNames )
GetIdlApp().pGlobalNames = new SvGlobalHashNames(); GetIdlApp().pGlobalNames.reset( new SvGlobalHashNames() );
} }
bool ReadIdl( SvIdlWorkingBase * pDataBase, const SvCommand & rCommand ) bool ReadIdl( SvIdlWorkingBase * pDataBase, const SvCommand & rCommand )
......
...@@ -54,8 +54,6 @@ SvIdlDataBase::SvIdlDataBase( const SvCommand& rCmd ) ...@@ -54,8 +54,6 @@ SvIdlDataBase::SvIdlDataBase( const SvCommand& rCmd )
SvIdlDataBase::~SvIdlDataBase() SvIdlDataBase::~SvIdlDataBase()
{ {
aIdFileList.clear(); aIdFileList.clear();
delete pIdTable;
} }
#define ADD_TYPE( Name ) \ #define ADD_TYPE( Name ) \
...@@ -126,7 +124,7 @@ bool SvIdlDataBase::FindId( const OString& rIdName, sal_uLong * pVal ) ...@@ -126,7 +124,7 @@ bool SvIdlDataBase::FindId( const OString& rIdName, sal_uLong * pVal )
void SvIdlDataBase::InsertId( const OString& rIdName, sal_uLong nVal ) void SvIdlDataBase::InsertId( const OString& rIdName, sal_uLong nVal )
{ {
if( !pIdTable ) if( !pIdTable )
pIdTable = new SvStringHashTable; pIdTable.reset( new SvStringHashTable );
sal_uInt32 nHash; sal_uInt32 nHash;
pIdTable->Insert( rIdName, &nHash )->SetValue( nVal ); pIdTable->Insert( rIdName, &nHash )->SetValue( nVal );
......
...@@ -41,8 +41,6 @@ IdlDll::IdlDll() ...@@ -41,8 +41,6 @@ IdlDll::IdlDll()
IdlDll::~IdlDll() IdlDll::~IdlDll()
{ {
delete pGlobalNames;
delete pHashTable;
} }
inline SvStringHashEntry * INS( const OString& rName ) inline SvStringHashEntry * INS( const OString& rName )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment