editeng/source/uno/unoipset.cxx | 8 +++----- include/editeng/unoipset.hxx | 6 +++++- 2 files changed, 8 insertions(+), 6 deletions(-)
New commits: commit 6e32a6575bd375ab3a5212fe07d3fb2525338ee6 Author: Noel Grandin <[email protected]> Date: Wed May 9 13:43:32 2018 +0200 loplugin:useuniqueptr in SvxItemPropertySet Change-Id: Ie4fa2f1a9d1cea52936f978a4dcbcaf1a616df2a Reviewed-on: https://gerrit.libreoffice.org/54179 Tested-by: Jenkins <[email protected]> Reviewed-by: Noel Grandin <[email protected]> diff --git a/editeng/source/uno/unoipset.cxx b/editeng/source/uno/unoipset.cxx index 01e014a47530..f7b503fccdae 100644 --- a/editeng/source/uno/unoipset.cxx +++ b/editeng/source/uno/unoipset.cxx @@ -54,7 +54,7 @@ SvxItemPropertySet::~SvxItemPropertySet() uno::Any* SvxItemPropertySet::GetUsrAnyForID(sal_uInt16 nWID) const { - for (SvxIDPropertyCombine* pActual : aCombineList) + for (auto const & pActual : aCombineList) { if( pActual->nWID == nWID ) return &pActual->aAny; @@ -65,17 +65,15 @@ uno::Any* SvxItemPropertySet::GetUsrAnyForID(sal_uInt16 nWID) const void SvxItemPropertySet::AddUsrAnyForID(const uno::Any& rAny, sal_uInt16 nWID) { - SvxIDPropertyCombine* pNew = new SvxIDPropertyCombine; + std::unique_ptr<SvxIDPropertyCombine> pNew(new SvxIDPropertyCombine); pNew->nWID = nWID; pNew->aAny = rAny; - aCombineList.push_back( pNew ); + aCombineList.push_back( std::move(pNew) ); } void SvxItemPropertySet::ClearAllUsrAny() { - for (SvxIDPropertyCombine* i : aCombineList) - delete i; aCombineList.clear(); } diff --git a/include/editeng/unoipset.hxx b/include/editeng/unoipset.hxx index ade689f1379d..7bca9673f097 100644 --- a/include/editeng/unoipset.hxx +++ b/include/editeng/unoipset.hxx @@ -24,6 +24,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <editeng/editengdllapi.h> #include <svl/itemprop.hxx> +#include <memory> #include <vector> class SdrItemPool; @@ -35,13 +36,16 @@ class EDITENG_DLLPUBLIC SvxItemPropertySet { SfxItemPropertyMap m_aPropertyMap; mutable css::uno::Reference<css::beans::XPropertySetInfo> m_xInfo; - ::std::vector< SvxIDPropertyCombine* > aCombineList; + ::std::vector< std::unique_ptr<SvxIDPropertyCombine> > aCombineList; SfxItemPool& mrItemPool; public: SvxItemPropertySet( const SfxItemPropertyMapEntry *pMap, SfxItemPool& rPool ); ~SvxItemPropertySet(); + SvxItemPropertySet& operator=( SvxItemPropertySet const & ) = delete; // MSVC2015 workaround + SvxItemPropertySet( SvxItemPropertySet const & ) = delete; // MSVC2015 workaround + // Methods, which work directly with the ItemSet static css::uno::Any getPropertyValue( const SfxItemPropertySimpleEntry* pMap, const SfxItemSet& rSet, bool bSearchInParent, bool bDontConvertNegativeValues ); static void setPropertyValue( const SfxItemPropertySimpleEntry* pMap, const css::uno::Any& rVal, SfxItemSet& rSet, bool bDontConvertNegativeValues ); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
