[Libreoffice-commits] core.git: sd/inc

Takeshi Abe tabe at fixedpoint.jp
Tue Aug 12 00:59:14 PDT 2014


 sd/inc/customshowlist.hxx |   43 ++++++++++++++++++++++++-------------------
 1 file changed, 24 insertions(+), 19 deletions(-)

New commits:
commit 4347d844646907ba31dc1e0c7f53c5a93d986c2a
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Mon Aug 11 23:10:37 2014 +0900

    fdo#75757: remove inheritance to std::vector
    
    Change-Id: I5781799bbd8cc321ff7f659013c6cf68b3253989
    Reviewed-on: https://gerrit.libreoffice.org/10868
    Reviewed-by: David Tardon <dtardon at redhat.com>
    Tested-by: David Tardon <dtardon at redhat.com>

diff --git a/sd/inc/customshowlist.hxx b/sd/inc/customshowlist.hxx
index 466c436..0fdd8c0 100644
--- a/sd/inc/customshowlist.hxx
+++ b/sd/inc/customshowlist.hxx
@@ -24,54 +24,59 @@
 
 class SdCustomShow;
 
-class SdCustomShowList : private std::vector<SdCustomShow*>
+class SdCustomShowList
 {
 private:
+    std::vector<SdCustomShow*> mShows;
    sal_uInt16 mnCurPos;
 public:
-    using std::vector<SdCustomShow*>::operator[];
-    using std::vector<SdCustomShow*>::size;
-    using std::vector<SdCustomShow*>::empty;
-    using std::vector<SdCustomShow*>::push_back;
-    using std::vector<SdCustomShow*>::erase;
-    using std::vector<SdCustomShow*>::begin;
-    using std::vector<SdCustomShow*>::iterator;
-
     SdCustomShowList()
-        : mnCurPos(0)
+        : mShows(), mnCurPos(0)
     {
     }
 
+    bool empty() const {return mShows.empty();}
+
+    size_t size() const {return mShows.size();}
+
+    SdCustomShow* &operator[](size_t i) {return mShows[i];}
+
+    std::vector<SdCustomShow*>::iterator begin() {return mShows.begin();}
+
+    void erase(std::vector<SdCustomShow*>::iterator it) {mShows.erase(it);}
+
+    void push_back(SdCustomShow* p) {mShows.push_back(p);}
+
     sal_uInt16 GetCurPos() const { return mnCurPos; }
     void Seek(sal_uInt16 nNewPos) { mnCurPos = nNewPos; }
 
     SdCustomShow* First()
     {
-        if( empty() )
+        if( mShows.empty() )
             return NULL;
         mnCurPos = 0;
-        return operator[](mnCurPos);
+        return mShows[mnCurPos];
     }
     SdCustomShow* Next()
     {
         ++mnCurPos;
-        return mnCurPos >= size() ? NULL : operator[](mnCurPos);
+        return mnCurPos >= mShows.size() ? NULL : mShows[mnCurPos];
     }
     void Last()
     {
-        if( !empty() )
-            mnCurPos = size() - 1;
+        if( !mShows.empty() )
+            mnCurPos = mShows.size() - 1;
     }
     SdCustomShow* GetCurObject()
     {
-        return empty() ? NULL : operator[](mnCurPos);
+        return mShows.empty() ? NULL : mShows[mnCurPos];
     }
     SdCustomShow* Remove(SdCustomShow* p)
     {
-        iterator it = std::find(begin(), end(), p);
-        if( it == end() )
+        std::vector<SdCustomShow*>::iterator it = std::find(mShows.begin(), mShows.end(), p);
+        if( it == mShows.end() )
             return NULL;
-        erase(it);
+        mShows.erase(it);
         return p;
     }
 };


More information about the Libreoffice-commits mailing list