From 4347d844646907ba31dc1e0c7f53c5a93d986c2a Mon Sep 17 00:00:00 2001 From: Takeshi Abe Date: Mon, 11 Aug 2014 23:10:37 +0900 Subject: fdo#75757: remove inheritance to std::vector Change-Id: I5781799bbd8cc321ff7f659013c6cf68b3253989 Reviewed-on: https://gerrit.libreoffice.org/10868 Reviewed-by: David Tardon Tested-by: David Tardon --- sd/inc/customshowlist.hxx | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) (limited to 'sd/inc') diff --git a/sd/inc/customshowlist.hxx b/sd/inc/customshowlist.hxx index 466c43633e9f..0fdd8c041cb8 100644 --- a/sd/inc/customshowlist.hxx +++ b/sd/inc/customshowlist.hxx @@ -24,54 +24,59 @@ class SdCustomShow; -class SdCustomShowList : private std::vector +class SdCustomShowList { private: + std::vector mShows; sal_uInt16 mnCurPos; public: - using std::vector::operator[]; - using std::vector::size; - using std::vector::empty; - using std::vector::push_back; - using std::vector::erase; - using std::vector::begin; - using std::vector::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::iterator begin() {return mShows.begin();} + + void erase(std::vector::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::iterator it = std::find(mShows.begin(), mShows.end(), p); + if( it == mShows.end() ) return NULL; - erase(it); + mShows.erase(it); return p; } }; -- cgit