summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-04-11 09:56:41 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-04-11 14:08:27 +0200
commite5246409cc384cd2ba321620e92250f7ddf153af (patch)
treeeae4b87b9df1918bc69e081d87449a34ef483a99 /svl
parent1c0e591accda7669bec9ccfc23977ce3f7386930 (diff)
return std::unique_ptr from SfxItemSet::Clone
Change-Id: Ie747b5c8ff0b82b9f8d268f9a60dbde41b5f022b Reviewed-on: https://gerrit.libreoffice.org/52712 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svl')
-rw-r--r--svl/source/items/itemset.cxx16
1 files changed, 8 insertions, 8 deletions
diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 398a74896084..784e23a33e22 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -1397,11 +1397,11 @@ bool SfxItemSet::Equals(const SfxItemSet &rCmp, bool bComparePool) const
return true;
}
-SfxItemSet *SfxItemSet::Clone(bool bItems, SfxItemPool *pToPool ) const
+std::unique_ptr<SfxItemSet> SfxItemSet::Clone(bool bItems, SfxItemPool *pToPool ) const
{
if (pToPool && pToPool != m_pPool)
{
- SfxItemSet *pNewSet = new SfxItemSet(*pToPool, m_pWhichRanges);
+ std::unique_ptr<SfxItemSet> pNewSet(new SfxItemSet(*pToPool, m_pWhichRanges));
if ( bItems )
{
SfxWhichIter aIter(*pNewSet);
@@ -1417,9 +1417,9 @@ SfxItemSet *SfxItemSet::Clone(bool bItems, SfxItemPool *pToPool ) const
return pNewSet;
}
else
- return bItems
+ return std::unique_ptr<SfxItemSet>(bItems
? new SfxItemSet(*this)
- : new SfxItemSet(*m_pPool, m_pWhichRanges);
+ : new SfxItemSet(*m_pPool, m_pWhichRanges));
}
void SfxItemSet::PutDirect(const SfxPoolItem &rItem)
@@ -1692,17 +1692,17 @@ void SfxItemSet::DisableItem(sal_uInt16 nWhich)
Put( SfxVoidItem(0), nWhich );
}
-SfxItemSet *SfxAllItemSet::Clone(bool bItems, SfxItemPool *pToPool ) const
+std::unique_ptr<SfxItemSet> SfxAllItemSet::Clone(bool bItems, SfxItemPool *pToPool ) const
{
if (pToPool && pToPool != m_pPool)
{
- SfxAllItemSet *pNewSet = new SfxAllItemSet( *pToPool );
+ std::unique_ptr<SfxAllItemSet> pNewSet(new SfxAllItemSet( *pToPool ));
if ( bItems )
pNewSet->Set( *this );
- return pNewSet;
+ return std::unique_ptr<SfxItemSet>(pNewSet.release()); // clang3.8 does not seem to be able to upcast std::unique_ptr
}
else
- return bItems ? new SfxAllItemSet(*this) : new SfxAllItemSet(*m_pPool);
+ return std::unique_ptr<SfxItemSet>(bItems ? new SfxAllItemSet(*this) : new SfxAllItemSet(*m_pPool));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */