diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-05-08 08:29:46 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-05-09 08:47:50 +0200 |
commit | e0382c3ad7786910bc9aa81cf581798df0f2508c (patch) | |
tree | 6acb0196add99896ced2aa1a76ff5b432bc45401 /include/svl/itemset.hxx | |
parent | 38a684f72988f29e1c07bf9fa5a83e275e80e24c (diff) |
avoid copying when placing items into SfxItemSet
Change-Id: I05c627f590e7794c1ba11b66021dc30aa3285eb0
Reviewed-on: https://gerrit.libreoffice.org/71941
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/svl/itemset.hxx')
-rw-r--r-- | include/svl/itemset.hxx | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/include/svl/itemset.hxx b/include/svl/itemset.hxx index 88aecf5b6e06..9892855657d1 100644 --- a/include/svl/itemset.hxx +++ b/include/svl/itemset.hxx @@ -106,6 +106,8 @@ protected: void PutDirect(const SfxPoolItem &rItem); + virtual const SfxPoolItem* PutImpl( const SfxPoolItem&, sal_uInt16 nWhich, bool bPassingOwnership ); + public: struct Pair { sal_uInt16 wid1, wid2; }; @@ -191,9 +193,14 @@ public: // add, delete items, work on items public: - virtual const SfxPoolItem* Put( const SfxPoolItem&, sal_uInt16 nWhich ); + const SfxPoolItem* Put( const SfxPoolItem& rItem, sal_uInt16 nWhich ) + { return PutImpl(rItem, nWhich, /*bPassingOwnership*/false); } + const SfxPoolItem* Put( std::unique_ptr<SfxPoolItem> xItem, sal_uInt16 nWhich ) + { return PutImpl(*xItem.release(), nWhich, /*bPassingOwnership*/true); } const SfxPoolItem* Put( const SfxPoolItem& rItem ) { return Put(rItem, rItem.Which()); } + const SfxPoolItem* Put( std::unique_ptr<SfxPoolItem> xItem ) + { auto nWhich = xItem->Which(); return Put(std::move(xItem), nWhich); } bool Put( const SfxItemSet&, bool bInvalidAsDefault = true ); void PutExtended( const SfxItemSet&, @@ -249,8 +256,8 @@ public: SfxAllItemSet( const SfxAllItemSet & ); virtual std::unique_ptr<SfxItemSet> Clone( bool bItems = true, SfxItemPool *pToPool = nullptr ) const override; - virtual const SfxPoolItem* Put( const SfxPoolItem&, sal_uInt16 nWhich ) override; - using SfxItemSet::Put; +protected: + virtual const SfxPoolItem* PutImpl( const SfxPoolItem&, sal_uInt16 nWhich, bool bPassingOwnership ) override; }; #endif // INCLUDED_SVL_ITEMSET_HXX |