[Libreoffice-commits] core.git: svl/source

Jochen Nitschke j.nitschke+logerrit at ok.de
Thu Sep 22 19:24:03 UTC 2016


 svl/source/inc/poolio.hxx   |   13 +++++++++++--
 svl/source/items/poolio.cxx |   10 ++++++++++
 2 files changed, 21 insertions(+), 2 deletions(-)

New commits:
commit c30fbfba96ab2d8d6229d7f4010718bd2b3c97d9
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date:   Thu Sep 22 13:27:55 2016 +0200

    tdf#75757 remove inheritance from std::vector
    
    Change-Id: Ief06d3ea0288e8ebf34f2f67f3d1dfc9405b6d49
    Reviewed-on: https://gerrit.libreoffice.org/29180
    Reviewed-by: Jochen Nitschke <j.nitschke+logerrit at ok.de>
    Tested-by: Jochen Nitschke <j.nitschke+logerrit at ok.de>

diff --git a/svl/source/inc/poolio.hxx b/svl/source/inc/poolio.hxx
index 627fd6b..0dd561e 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 ec23690..43e401d 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.


More information about the Libreoffice-commits mailing list