summaryrefslogtreecommitdiff
path: root/include/svl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-04-17 15:19:25 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-04-20 08:02:25 +0200
commitec7ba61a6164c805f5a71b077715b7e1521a2d62 (patch)
tree4d4f3fb1ad960465897754601b0842c78db564bf /include/svl
parent7d58f26bf4dbeb4e138c2a91f039d8bc7fa00f0c (diff)
simplify SfxPoolItemArray_Impl (tdf#81765 related)
Since we want to look up items by pointer, just store them in a std::unordered_set, which allows fast find(). This dramatically simplifies most operations on this data structure. Fix a dodgy sd test that was relying on items with the same whichid being in the pool being in a certain order. Change-Id: I4d79fc718f95e3083a20788be1050fbe9fca7263 Reviewed-on: https://gerrit.libreoffice.org/70881 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/svl')
-rw-r--r--include/svl/itempool.hxx13
1 files changed, 9 insertions, 4 deletions
diff --git a/include/svl/itempool.hxx b/include/svl/itempool.hxx
index e865c9396f37..f987cf15ae62 100644
--- a/include/svl/itempool.hxx
+++ b/include/svl/itempool.hxx
@@ -25,6 +25,7 @@
#include <svl/typedwhich.hxx>
#include <memory>
#include <vector>
+#include <o3tl/sorted_vector.hxx>
class SfxBroadcaster;
struct SfxItemPool_Impl;
@@ -154,15 +155,19 @@ public:
bool CheckItemInPool(const SfxPoolItem *) const;
- const SfxPoolItem * GetItem2(sal_uInt16 nWhich, sal_uInt32 nSurrogate) const;
- template<class T> const T* GetItem2( TypedWhichId<T> nWhich, sal_uInt32 nSurrogate ) const
- { return dynamic_cast<const T*>(GetItem2(sal_uInt16(nWhich), nSurrogate)); }
-
+ struct Item2Range
+ {
+ o3tl::sorted_vector<SfxPoolItem*>::const_iterator m_begin;
+ o3tl::sorted_vector<SfxPoolItem*>::const_iterator m_end;
+ o3tl::sorted_vector<SfxPoolItem*>::const_iterator begin() { return m_begin; }
+ o3tl::sorted_vector<SfxPoolItem*>::const_iterator end() { return m_end; }
+ };
const SfxPoolItem * GetItem2Default(sal_uInt16 nWhich) const;
template<class T> const T* GetItem2Default( TypedWhichId<T> nWhich ) const
{ return static_cast<const T*>(GetItem2Default(sal_uInt16(nWhich))); }
sal_uInt32 GetItemCount2(sal_uInt16 nWhich) const;
+ Item2Range GetItemSurrogates(sal_uInt16 nWhich) const;
sal_uInt16 GetFirstWhich() const;
sal_uInt16 GetLastWhich() const;