summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-05-09 13:43:32 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-05-14 11:19:21 +0200
commit6e32a6575bd375ab3a5212fe07d3fb2525338ee6 (patch)
tree03b58f370592b7b1cc49fd3d4c4806f394a9d34c
parent3f32388fd4ed343ff1e3036edfc7f97127202949 (diff)
loplugin:useuniqueptr in SvxItemPropertySet
Change-Id: Ie4fa2f1a9d1cea52936f978a4dcbcaf1a616df2a Reviewed-on: https://gerrit.libreoffice.org/54179 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--editeng/source/uno/unoipset.cxx8
-rw-r--r--include/editeng/unoipset.hxx6
2 files changed, 8 insertions, 6 deletions
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 );