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

loplugin:useuniqueptr in SbiGlobals

Change-Id: I0ebec3193b4369039f90be4223ebdf6d048b8478
üst 263d7325
...@@ -915,8 +915,8 @@ StarBASIC::StarBASIC( StarBASIC* p, bool bIsDocBasic ) ...@@ -915,8 +915,8 @@ StarBASIC::StarBASIC( StarBASIC* p, bool bIsDocBasic )
if( !GetSbData()->nInst++ ) if( !GetSbData()->nInst++ )
{ {
GetSbData()->pSbFac = new SbiFactory; GetSbData()->pSbFac.reset( new SbiFactory );
AddFactory( GetSbData()->pSbFac ); AddFactory( GetSbData()->pSbFac.get() );
GetSbData()->pTypeFac = new SbTypeFactory; GetSbData()->pTypeFac = new SbTypeFactory;
AddFactory( GetSbData()->pTypeFac ); AddFactory( GetSbData()->pTypeFac );
GetSbData()->pClassFac = new SbClassFactory; GetSbData()->pClassFac = new SbClassFactory;
...@@ -925,8 +925,8 @@ StarBASIC::StarBASIC( StarBASIC* p, bool bIsDocBasic ) ...@@ -925,8 +925,8 @@ StarBASIC::StarBASIC( StarBASIC* p, bool bIsDocBasic )
AddFactory( GetSbData()->pOLEFac ); AddFactory( GetSbData()->pOLEFac );
GetSbData()->pFormFac = new SbFormFactory; GetSbData()->pFormFac = new SbFormFactory;
AddFactory( GetSbData()->pFormFac ); AddFactory( GetSbData()->pFormFac );
GetSbData()->pUnoFac = new SbUnoFactory; GetSbData()->pUnoFac.reset( new SbUnoFactory );
AddFactory( GetSbData()->pUnoFac ); AddFactory( GetSbData()->pUnoFac.get() );
} }
pRtl = new SbiStdObject(RTLNAME, this ); pRtl = new SbiStdObject(RTLNAME, this );
// Search via StarBasic is always global // Search via StarBasic is always global
...@@ -954,10 +954,10 @@ StarBASIC::~StarBASIC() ...@@ -954,10 +954,10 @@ StarBASIC::~StarBASIC()
if( !--GetSbData()->nInst ) if( !--GetSbData()->nInst )
{ {
RemoveFactory( GetSbData()->pSbFac ); RemoveFactory( GetSbData()->pSbFac.get() );
delete GetSbData()->pSbFac; GetSbData()->pSbFac = nullptr; GetSbData()->pSbFac.reset();
RemoveFactory( GetSbData()->pUnoFac ); RemoveFactory( GetSbData()->pUnoFac.get() );
delete GetSbData()->pUnoFac; GetSbData()->pUnoFac = nullptr; GetSbData()->pUnoFac.reset();
RemoveFactory( GetSbData()->pTypeFac ); RemoveFactory( GetSbData()->pTypeFac );
delete GetSbData()->pTypeFac; GetSbData()->pTypeFac = nullptr; delete GetSbData()->pTypeFac; GetSbData()->pTypeFac = nullptr;
RemoveFactory( GetSbData()->pClassFac ); RemoveFactory( GetSbData()->pClassFac );
......
...@@ -60,9 +60,9 @@ SbiGlobals::SbiGlobals() ...@@ -60,9 +60,9 @@ SbiGlobals::SbiGlobals()
SbiGlobals::~SbiGlobals() SbiGlobals::~SbiGlobals()
{ {
delete pSbFac; pSbFac.reset();
delete pUnoFac; pUnoFac.reset();
delete pTransliterationWrapper; pTransliterationWrapper.reset();
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -80,8 +80,8 @@ struct SbiGlobals ...@@ -80,8 +80,8 @@ struct SbiGlobals
{ {
static SbiGlobals* pGlobals; static SbiGlobals* pGlobals;
SbiInstance* pInst; // all active runtime instances SbiInstance* pInst; // all active runtime instances
SbiFactory* pSbFac; // StarBASIC-Factory std::unique_ptr<SbiFactory> pSbFac; // StarBASIC-Factory
SbUnoFactory* pUnoFac; // Factory for Uno-Structs at DIM AS NEW std::unique_ptr<SbUnoFactory> pUnoFac; // Factory for Uno-Structs at DIM AS NEW
SbTypeFactory* pTypeFac; // Factory for user defined types SbTypeFactory* pTypeFac; // Factory for user defined types
SbClassFactory* pClassFac; // Factory for user defined classes (based on class modules) SbClassFactory* pClassFac; // Factory for user defined classes (based on class modules)
SbOLEFactory* pOLEFac; // Factory for OLE types SbOLEFactory* pOLEFac; // Factory for OLE types
...@@ -98,7 +98,7 @@ struct SbiGlobals ...@@ -98,7 +98,7 @@ struct SbiGlobals
bool bGlobalInitErr; bool bGlobalInitErr;
bool bRunInit; // true, if RunInit active from the Basic bool bRunInit; // true, if RunInit active from the Basic
OUString aErrMsg; // buffer for GetErrorText() OUString aErrMsg; // buffer for GetErrorText()
::utl::TransliterationWrapper* pTransliterationWrapper; // For StrComp std::unique_ptr<::utl::TransliterationWrapper> pTransliterationWrapper; // For StrComp
bool bBlockCompilerError; bool bBlockCompilerError;
BasicManager* pAppBasMgr; BasicManager* pAppBasMgr;
StarBASIC* pMSOMacroRuntimLib; // Lib containing MSO Macro Runtime API entry symbols StarBASIC* pMSOMacroRuntimLib; // Lib containing MSO Macro Runtime API entry symbols
......
...@@ -1536,15 +1536,16 @@ void SbRtl_StrComp(StarBASIC *, SbxArray & rPar, bool) ...@@ -1536,15 +1536,16 @@ void SbRtl_StrComp(StarBASIC *, SbxArray & rPar, bool)
sal_Int32 nRetValue = 0; sal_Int32 nRetValue = 0;
if( bTextCompare ) if( bTextCompare )
{ {
::utl::TransliterationWrapper* pTransliterationWrapper = GetSbData()->pTransliterationWrapper; ::utl::TransliterationWrapper* pTransliterationWrapper = GetSbData()->pTransliterationWrapper.get();
if( !pTransliterationWrapper ) if( !pTransliterationWrapper )
{ {
uno::Reference< uno::XComponentContext > xContext = getProcessComponentContext(); uno::Reference< uno::XComponentContext > xContext = getProcessComponentContext();
pTransliterationWrapper = GetSbData()->pTransliterationWrapper = GetSbData()->pTransliterationWrapper.reset(
new ::utl::TransliterationWrapper( xContext, new ::utl::TransliterationWrapper( xContext,
TransliterationFlags::IGNORE_CASE | TransliterationFlags::IGNORE_CASE |
TransliterationFlags::IGNORE_KANA | TransliterationFlags::IGNORE_KANA |
TransliterationFlags::IGNORE_WIDTH ); TransliterationFlags::IGNORE_WIDTH ) );
pTransliterationWrapper = GetSbData()->pTransliterationWrapper.get();
} }
LanguageType eLangType = Application::GetSettings().GetLanguageTag().getLanguageType(); LanguageType eLangType = Application::GetSettings().GetLanguageTag().getLanguageType();
......
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