summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorJochen Nitschke <j.nitschke+logerrit@ok.de>2016-09-22 13:27:55 +0200
committerJochen Nitschke <j.nitschke+logerrit@ok.de>2016-09-22 19:21:46 +0000
commitc30fbfba96ab2d8d6229d7f4010718bd2b3c97d9 (patch)
treefa3016f4af92724bb9b150e7ae76cd3bc38e6eb0 /svl
parentb0eecd2d3ba4a1a424a2d52cccf64fe6fc09c34b (diff)
tdf#75757 remove inheritance from std::vector
Change-Id: Ief06d3ea0288e8ebf34f2f67f3d1dfc9405b6d49 Reviewed-on: https://gerrit.libreoffice.org/29180 Reviewed-by: Jochen Nitschke <j.nitschke+logerrit@ok.de> Tested-by: Jochen Nitschke <j.nitschke+logerrit@ok.de>
Diffstat (limited to 'svl')
-rw-r--r--svl/source/inc/poolio.hxx13
-rw-r--r--svl/source/items/poolio.cxx10
2 files changed, 21 insertions, 2 deletions
diff --git a/svl/source/inc/poolio.hxx b/svl/source/inc/poolio.hxx
index 627fd6ba62ab..0dd561e30346 100644
--- a/svl/source/inc/poolio.hxx
+++ b/svl/source/inc/poolio.hxx
@@ -68,11 +68,12 @@ typedef std::shared_ptr< SfxPoolVersion_Impl > SfxPoolVersion_ImplPtr;
* often search linearly to ensure uniqueness. If they are
* non-poolable we maintain an (often large) list of pointers.
*/
-struct SfxPoolItemArray_Impl: public SfxPoolItemArrayBase_Impl
+struct SfxPoolItemArray_Impl
{
typedef std::vector<sal_uInt32> FreeList;
typedef std::unordered_map<SfxPoolItem*,sal_uInt32> PoolItemPtrToIndexMap;
-
+private:
+ std::vector<SfxPoolItem*> maPoolItemVector;
public:
/// Track list of indices into our array that contain an empty slot
FreeList maFree;
@@ -80,6 +81,14 @@ public:
PoolItemPtrToIndexMap maPtrToIndex;
SfxPoolItemArray_Impl () {}
+ SfxPoolItem*& operator[](size_t n) {return maPoolItemVector[n];}
+ std::vector<SfxPoolItem*>::iterator begin() {return maPoolItemVector.begin();}
+ std::vector<SfxPoolItem*>::iterator end() {return maPoolItemVector.end();}
+ /// clear array of PoolItem variants after all PoolItems are deleted
+ /// or all ref counts are decreased
+ void clear();
+ size_t size() const {return maPoolItemVector.size();}
+ void push_back(SfxPoolItem* pItem) {maPoolItemVector.push_back(pItem);}
/// re-build the list of free slots and hash from clean
void SVL_DLLPUBLIC ReHash();
diff --git a/svl/source/items/poolio.cxx b/svl/source/items/poolio.cxx
index ec236900a532..43e401dcc1ff 100644
--- a/svl/source/items/poolio.cxx
+++ b/svl/source/items/poolio.cxx
@@ -30,6 +30,16 @@
#include <algorithm>
#include <memory>
+/// clear array of PoolItem variants
+/// after all PoolItems are deleted
+/// or all ref counts are decreased
+void SfxPoolItemArray_Impl::clear()
+{
+ maPoolItemVector.clear();
+ maFree.clear();
+ maPtrToIndex.clear();
+}
+
/**
* Returns the <SfxItemPool> that is being saved.
* This should only be used in very exceptional cases e.g.