diff options
author | Ian <ian.gilham@gmail.com> | 2015-08-12 15:39:21 +0100 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2015-08-13 11:57:20 +0000 |
commit | 12761ab70553bb0d2746d7d95958dc6fbc7082e0 (patch) | |
tree | 92b28b8271af58ea1038a3f298ff06b804542726 /scaddins | |
parent | e5ba9090f4809906ffa1c1dea352161cb988b97f (diff) |
migrated some raw pointers to unique_ptr's
Change-Id: Ibbe088e73bdf987bf3784b61aa8b38a86d6654e3
Reviewed-on: https://gerrit.libreoffice.org/17679
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'scaddins')
-rw-r--r-- | scaddins/source/datefunc/datefunc.cxx | 29 | ||||
-rw-r--r-- | scaddins/source/datefunc/datefunc.hxx | 11 |
2 files changed, 14 insertions, 26 deletions
diff --git a/scaddins/source/datefunc/datefunc.cxx b/scaddins/source/datefunc/datefunc.cxx index cbba443d9246..68683c9ae3aa 100644 --- a/scaddins/source/datefunc/datefunc.cxx +++ b/scaddins/source/datefunc/datefunc.cxx @@ -143,26 +143,19 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL date_component_getFactory( // "normal" service implementation ScaDateAddIn::ScaDateAddIn() : - pDefLocales( NULL ), - pResMgr( NULL ), - pFuncDataList( NULL ) + pDefLocales( nullptr ), + pResMgr( nullptr ), + pFuncDataList( nullptr ) { } -ScaDateAddIn::~ScaDateAddIn() -{ - delete pFuncDataList; - delete pResMgr; - delete[] pDefLocales; -} - static const sal_Char* pLang[] = { "de", "en" }; static const sal_Char* pCoun[] = { "DE", "US" }; static const sal_uInt32 nNumOfLoc = SAL_N_ELEMENTS( pLang ); void ScaDateAddIn::InitDefLocales() { - pDefLocales = new lang::Locale[ nNumOfLoc ]; + pDefLocales.reset(new lang::Locale[ nNumOfLoc ]); for( sal_uInt32 nIndex = 0; nIndex < nNumOfLoc; nIndex++ ) { @@ -192,24 +185,18 @@ ResMgr& ScaDateAddIn::GetResMgr() throw( uno::RuntimeException, std::exception ) void ScaDateAddIn::InitData() { - delete pResMgr; - pResMgr = ResMgr::CreateResMgr("date", LanguageTag(aFuncLoc)); - delete pFuncDataList; + pResMgr.reset(ResMgr::CreateResMgr("date", LanguageTag(aFuncLoc))); + pFuncDataList.reset(); if ( pResMgr ) { - pFuncDataList = new ScaFuncDataList; + pFuncDataList.reset(new ScaFuncDataList); InitScaFuncDataList( *pFuncDataList, *pResMgr ); } - else - { - pFuncDataList = nullptr; - } if( pDefLocales ) { - delete pDefLocales; - pDefLocales = NULL; + pDefLocales.reset(); } } diff --git a/scaddins/source/datefunc/datefunc.hxx b/scaddins/source/datefunc/datefunc.hxx index 38367ed866e4..a8abffaacecc 100644 --- a/scaddins/source/datefunc/datefunc.hxx +++ b/scaddins/source/datefunc/datefunc.hxx @@ -24,6 +24,7 @@ #include <string.h> #include <vector> +#include <memory> #include <com/sun/star/lang/XServiceName.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -183,10 +184,10 @@ class ScaDateAddIn : public ::cppu::WeakImplHelper6< ::com::sun::star::lang::XServiceInfo > { private: - ::com::sun::star::lang::Locale aFuncLoc; - ::com::sun::star::lang::Locale* pDefLocales; - ResMgr* pResMgr; - ScaFuncDataList* pFuncDataList; + ::com::sun::star::lang::Locale aFuncLoc; + std::unique_ptr< ::com::sun::star::lang::Locale[] > pDefLocales; + std::unique_ptr< ResMgr > pResMgr; + std::unique_ptr< ScaFuncDataList > pFuncDataList; void InitDefLocales(); @@ -199,7 +200,7 @@ private: public: ScaDateAddIn(); - virtual ~ScaDateAddIn(); + virtual ~ScaDateAddIn() =default; static OUString getImplementationName_Static(); static ::com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_Static(); |