diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-10 14:54:10 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-11 14:50:11 +0100 |
commit | ccf986a77a4b218964033e70601ae220eb2c9b13 (patch) | |
tree | 08dc4cfd477a6723e8e389046fef9af67ca753a9 /include/svl | |
parent | InstallPrinteDrivers->InstallPrinterDrivers (diff) | |
download | core-ccf986a77a4b218964033e70601ae220eb2c9b13.tar.gz core-ccf986a77a4b218964033e70601ae220eb2c9b13.zip |
loplugin:useuniqueptr in svl
Change-Id: I2fdb63517349474d90cb17ad2bd667f30840e83d
Reviewed-on: https://gerrit.libreoffice.org/47727
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/svl')
-rw-r--r-- | include/svl/adrparse.hxx | 4 | ||||
-rw-r--r-- | include/svl/instrm.hxx | 3 | ||||
-rw-r--r-- | include/svl/itemiter.hxx | 4 | ||||
-rw-r--r-- | include/svl/itemset.hxx | 8 | ||||
-rw-r--r-- | include/svl/languageoptions.hxx | 5 | ||||
-rw-r--r-- | include/svl/ondemand.hxx | 19 | ||||
-rw-r--r-- | include/svl/zforlist.hxx | 10 |
7 files changed, 24 insertions, 29 deletions
diff --git a/include/svl/adrparse.hxx b/include/svl/adrparse.hxx index 2213e26c66f5..0961158a52e7 100644 --- a/include/svl/adrparse.hxx +++ b/include/svl/adrparse.hxx @@ -47,7 +47,7 @@ class SVL_DLLPUBLIC SvAddressParser friend class SvAddressParser_Impl; SvAddressEntry_Impl m_aFirst; - ::std::vector< SvAddressEntry_Impl* > + ::std::vector< SvAddressEntry_Impl > m_aRest; bool m_bHasFirst; @@ -61,7 +61,7 @@ public: const OUString& GetEmailAddress(sal_Int32 nIndex) const { return nIndex == 0 ? m_aFirst.m_aAddrSpec : - m_aRest[ nIndex - 1 ]->m_aAddrSpec; + m_aRest[ nIndex - 1 ].m_aAddrSpec; } }; diff --git a/include/svl/instrm.hxx b/include/svl/instrm.hxx index c8c914546e45..21e8ea6c3c2d 100644 --- a/include/svl/instrm.hxx +++ b/include/svl/instrm.hxx @@ -23,6 +23,7 @@ #include <svl/svldllapi.h> #include <com/sun/star/uno/Reference.h> #include <tools/stream.hxx> +#include <memory> namespace com { namespace sun { namespace star { namespace io { class XInputStream; @@ -36,7 +37,7 @@ class SVL_DLLPUBLIC SvInputStream: public SvStream { css::uno::Reference< css::io::XInputStream > m_xStream; css::uno::Reference< css::io::XSeekable > m_xSeekable; - SvDataPipe_Impl * m_pPipe; + std::unique_ptr<SvDataPipe_Impl> m_pPipe; sal_uInt64 m_nSeekedFrom; SVL_DLLPRIVATE bool open(); diff --git a/include/svl/itemiter.hxx b/include/svl/itemiter.hxx index aba136d2aa85..08aef0ea4f66 100644 --- a/include/svl/itemiter.hxx +++ b/include/svl/itemiter.hxx @@ -41,11 +41,11 @@ public: const SfxPoolItem* FirstItem() { m_nCurrent = m_nStart; - return m_rSet.m_nCount ? *(m_rSet.m_pItems + m_nCurrent) : nullptr; + return m_rSet.m_nCount ? *(m_rSet.m_pItems.get() + m_nCurrent) : nullptr; } const SfxPoolItem* GetCurItem() const { - return m_rSet.m_nCount ? *(m_rSet.m_pItems + m_nCurrent) : nullptr; + return m_rSet.m_nCount ? *(m_rSet.m_pItems.get() + m_nCurrent) : nullptr; } const SfxPoolItem* NextItem(); diff --git a/include/svl/itemset.hxx b/include/svl/itemset.hxx index ca944d282ad4..d5a2b5eb5ad7 100644 --- a/include/svl/itemset.hxx +++ b/include/svl/itemset.hxx @@ -25,6 +25,7 @@ #include <cstddef> #include <initializer_list> #include <type_traits> +#include <memory> #include <svl/svldllapi.h> #include <svl/poolitem.hxx> @@ -34,8 +35,6 @@ class SfxItemPool; class SfxPoolItem; class SvStream; -typedef SfxPoolItem const** SfxItemArray; - namespace svl { namespace detail { @@ -84,7 +83,8 @@ class SAL_WARN_UNUSED SVL_DLLPUBLIC SfxItemSet SfxItemPool* m_pPool; ///< pool that stores the items const SfxItemSet* m_pParent; ///< derivation - SfxItemArray m_pItems; ///< array of items + std::unique_ptr<SfxPoolItem const*[]> + m_pItems; ///< array of items sal_uInt16* m_pWhichRanges; ///< array of Which Ranges sal_uInt16 m_nCount; ///< number of items @@ -99,7 +99,7 @@ private: std::size_t items); public: - SfxItemArray GetItems_Impl() const { return m_pItems; } + SfxPoolItem const** GetItems_Impl() const { return m_pItems.get(); } private: const SfxItemSet& operator=(const SfxItemSet &) = delete; diff --git a/include/svl/languageoptions.hxx b/include/svl/languageoptions.hxx index 6de8eb566c5b..fadd74f08893 100644 --- a/include/svl/languageoptions.hxx +++ b/include/svl/languageoptions.hxx @@ -25,6 +25,7 @@ #include <unotools/options.hxx> #include <i18nlangtag/lang.h> #include <o3tl/typed_flags_set.hxx> +#include <memory> // class SvtLanguageOptions ---------------------------------------------------- @@ -49,8 +50,8 @@ class SvtCTLOptions; class SVL_DLLPUBLIC SvtLanguageOptions : public ::utl::detail::Options { private: - SvtCJKOptions* m_pCJKOptions; - SvtCTLOptions* m_pCTLOptions; + std::unique_ptr<SvtCJKOptions> m_pCJKOptions; + std::unique_ptr<SvtCTLOptions> m_pCTLOptions; public: enum EOption diff --git a/include/svl/ondemand.hxx b/include/svl/ondemand.hxx index a66b4aa4ef77..47fe95de4236 100644 --- a/include/svl/ondemand.hxx +++ b/include/svl/ondemand.hxx @@ -60,26 +60,19 @@ class OnDemandLocaleDataWrapper LanguageType eCurrentLanguage; LanguageType eLastAnyLanguage; const LocaleDataWrapper* pSystem; - const LocaleDataWrapper* pEnglish; - LocaleDataWrapper* pAny; + std::unique_ptr<const LocaleDataWrapper> pEnglish; + std::unique_ptr< LocaleDataWrapper> pAny; const LocaleDataWrapper* pCurrent; bool bInitialized; public: OnDemandLocaleDataWrapper() : eLastAnyLanguage( LANGUAGE_DONTKNOW ) - , pEnglish(nullptr) - , pAny(nullptr) , bInitialized(false) { pCurrent = pSystem = aSysLocale.GetLocaleDataPtr(); eCurrentLanguage = LANGUAGE_SYSTEM; } - ~OnDemandLocaleDataWrapper() - { - delete pEnglish; - delete pAny; - } bool isInitialized() const { return bInitialized; } @@ -101,14 +94,14 @@ public: else if ( eLang == LANGUAGE_ENGLISH_US ) { if ( !pEnglish ) - pEnglish = new LocaleDataWrapper( m_xContext, rLanguageTag ); - pCurrent = pEnglish; + pEnglish.reset( new LocaleDataWrapper( m_xContext, rLanguageTag ) ); + pCurrent = pEnglish.get(); } else { if ( !pAny ) { - pAny = new LocaleDataWrapper( m_xContext, rLanguageTag ); + pAny.reset( new LocaleDataWrapper( m_xContext, rLanguageTag ) ); eLastAnyLanguage = eLang; } else if ( eLastAnyLanguage != eLang ) @@ -116,7 +109,7 @@ public: pAny->setLanguageTag( rLanguageTag ); eLastAnyLanguage = eLang; } - pCurrent = pAny; + pCurrent = pAny.get(); } eCurrentLanguage = eLang; } diff --git a/include/svl/zforlist.hxx b/include/svl/zforlist.hxx index 6e7d196c2a61..e82d68072c75 100644 --- a/include/svl/zforlist.hxx +++ b/include/svl/zforlist.hxx @@ -887,15 +887,15 @@ private: std::map<sal_uInt32, std::unique_ptr<SvNumberformat>> aFTable; // Table of format keys to format entries typedef std::map<sal_uInt32, sal_uInt32> DefaultFormatKeysMap; DefaultFormatKeysMap aDefaultFormatKeys; // Table of default standard to format keys - SvNumberFormatTable* pFormatTable; // For the UI dialog - SvNumberFormatterIndexTable* pMergeTable; // List of indices for merging two formatters - CharClass* pCharClass; // CharacterClassification + std::unique_ptr<SvNumberFormatTable> pFormatTable; // For the UI dialog + std::unique_ptr<SvNumberFormatterIndexTable> pMergeTable; // List of indices for merging two formatters + std::unique_ptr<CharClass> pCharClass; // CharacterClassification OnDemandLocaleDataWrapper xLocaleData; // LocaleData switched between SYSTEM, ENGLISH and other OnDemandTransliterationWrapper xTransliteration; // Transliteration loaded on demand OnDemandCalendarWrapper xCalendar; // Calendar loaded on demand OnDemandNativeNumberWrapper xNatNum; // Native number service loaded on demand - ImpSvNumberInputScan* pStringScanner; // Input string scanner - ImpSvNumberformatScan* pFormatScanner; // Format code string scanner + std::unique_ptr<ImpSvNumberInputScan> pStringScanner; // Input string scanner + std::unique_ptr<ImpSvNumberformatScan> pFormatScanner; // Format code string scanner Link<sal_uInt16,Color*> aColorLink; // User defined color table CallBack sal_uInt32 MaxCLOffset; // Max language/country offset used sal_uInt32 nDefaultSystemCurrencyFormat; // NewCurrency matching SYSTEM locale |