summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-01-15 14:26:54 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-01-17 10:16:35 +0200
commitf91c856e9be2f9a2dc15740b7cae78954d574d91 (patch)
tree1cc961e028fec4fa52a6ff4710f1db2a097b6a10 /vcl
parent17fa3f64c2d7732e7db8f4f29359c2dbf883f75a (diff)
loplugin:useuniqueptr in ImplAllSettingsData
Change-Id: If1894bd1a77fa1aab72896574357bd9852f66708
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/app/settings.cxx38
1 files changed, 18 insertions, 20 deletions
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index c1a02dc27a91..97723e7a21b5 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -243,10 +243,10 @@ struct ImplAllSettingsData
LanguageTag maLocale;
AllSettingsFlags mnWindowUpdate;
LanguageTag maUILocale;
- LocaleDataWrapper* mpLocaleDataWrapper;
- LocaleDataWrapper* mpUILocaleDataWrapper;
- vcl::I18nHelper* mpI18nHelper;
- vcl::I18nHelper* mpUII18nHelper;
+ std::unique_ptr<LocaleDataWrapper> mpLocaleDataWrapper;
+ std::unique_ptr<LocaleDataWrapper> mpUILocaleDataWrapper;
+ std::unique_ptr<vcl::I18nHelper> mpI18nHelper;
+ std::unique_ptr<vcl::I18nHelper> mpUII18nHelper;
SvtSysLocale maSysLocale;
};
@@ -2680,10 +2680,10 @@ ImplAllSettingsData::ImplAllSettingsData( const ImplAllSettingsData& rData ) :
ImplAllSettingsData::~ImplAllSettingsData()
{
- delete mpLocaleDataWrapper;
- delete mpUILocaleDataWrapper;
- delete mpI18nHelper;
- delete mpUII18nHelper;
+ mpLocaleDataWrapper.reset();
+ mpUILocaleDataWrapper.reset();
+ mpI18nHelper.reset();
+ mpUII18nHelper.reset();
}
AllSettings::AllSettings()
@@ -2801,13 +2801,11 @@ void AllSettings::SetLanguageTag( const LanguageTag& rLanguageTag )
if ( mxData->mpLocaleDataWrapper )
{
- delete mxData->mpLocaleDataWrapper;
- mxData->mpLocaleDataWrapper = nullptr;
+ mxData->mpLocaleDataWrapper.reset();
}
if ( mxData->mpI18nHelper )
{
- delete mxData->mpI18nHelper;
- mxData->mpI18nHelper = nullptr;
+ mxData->mpI18nHelper.reset();
}
}
}
@@ -2911,24 +2909,24 @@ const LanguageTag& AllSettings::GetUILanguageTag() const
const LocaleDataWrapper& AllSettings::GetLocaleDataWrapper() const
{
if ( !mxData->mpLocaleDataWrapper )
- const_cast<AllSettings*>(this)->mxData->mpLocaleDataWrapper = new LocaleDataWrapper(
- comphelper::getProcessComponentContext(), GetLanguageTag() );
+ const_cast<AllSettings*>(this)->mxData->mpLocaleDataWrapper.reset( new LocaleDataWrapper(
+ comphelper::getProcessComponentContext(), GetLanguageTag() ) );
return *mxData->mpLocaleDataWrapper;
}
const LocaleDataWrapper& AllSettings::GetUILocaleDataWrapper() const
{
if ( !mxData->mpUILocaleDataWrapper )
- const_cast<AllSettings*>(this)->mxData->mpUILocaleDataWrapper = new LocaleDataWrapper(
- comphelper::getProcessComponentContext(), GetUILanguageTag() );
+ const_cast<AllSettings*>(this)->mxData->mpUILocaleDataWrapper.reset( new LocaleDataWrapper(
+ comphelper::getProcessComponentContext(), GetUILanguageTag() ) );
return *mxData->mpUILocaleDataWrapper;
}
const vcl::I18nHelper& AllSettings::GetLocaleI18nHelper() const
{
if ( !mxData->mpI18nHelper ) {
- const_cast<AllSettings*>(this)->mxData->mpI18nHelper = new vcl::I18nHelper(
- comphelper::getProcessComponentContext(), GetLanguageTag() );
+ const_cast<AllSettings*>(this)->mxData->mpI18nHelper.reset( new vcl::I18nHelper(
+ comphelper::getProcessComponentContext(), GetLanguageTag() ) );
}
return *mxData->mpI18nHelper;
}
@@ -2936,8 +2934,8 @@ const vcl::I18nHelper& AllSettings::GetLocaleI18nHelper() const
const vcl::I18nHelper& AllSettings::GetUILocaleI18nHelper() const
{
if ( !mxData->mpUII18nHelper ) {
- const_cast<AllSettings*>(this)->mxData->mpUII18nHelper = new vcl::I18nHelper(
- comphelper::getProcessComponentContext(), GetUILanguageTag() );
+ const_cast<AllSettings*>(this)->mxData->mpUII18nHelper.reset( new vcl::I18nHelper(
+ comphelper::getProcessComponentContext(), GetUILanguageTag() ) );
}
return *mxData->mpUII18nHelper;
}