diff options
author | Michaël Lefèvre <lefevre00@yahoo.fr> | 2014-10-06 11:39:22 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2014-10-08 20:01:29 +0000 |
commit | 9769a69f49c77599053ab8f15b149506af555134 (patch) | |
tree | 1b93f95d01d9158209e7ab4490dcea006574f86b | |
parent | bb29c5723a6053476b6f398c8550b2a839aa07fc (diff) |
fdo#75757: remove inheritance to std::vector
Change-Id: I17b1057c2551f41b15547d7563434e3344ab6be8
Reviewed-on: https://gerrit.libreoffice.org/11822
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
-rw-r--r-- | sfx2/source/appl/linksrc.cxx | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/sfx2/source/appl/linksrc.cxx b/sfx2/source/appl/linksrc.cxx index 8b8ee278fa3e..d5ff58588a98 100644 --- a/sfx2/source/appl/linksrc.cxx +++ b/sfx2/source/appl/linksrc.cxx @@ -91,22 +91,36 @@ SvLinkSource_Entry_Impl::~SvLinkSource_Entry_Impl() { } -class SvLinkSource_Array_Impl : public std::vector<SvLinkSource_Entry_Impl*> +class SvLinkSource_Array_Impl { +private : + std::vector<SvLinkSource_Entry_Impl*> mvData; + public: + SvLinkSource_Array_Impl() : mvData() {} + + size_t size() const { return mvData.size(); } + SvLinkSource_Entry_Impl *operator[](size_t idx) const { return mvData[idx]; } + std::vector<SvLinkSource_Entry_Impl*>::iterator begin() { return mvData.begin(); } + std::vector<SvLinkSource_Entry_Impl*>::iterator end() { return mvData.end(); } + std::vector<SvLinkSource_Entry_Impl*>::const_iterator cbegin() const { return mvData.cbegin(); } + std::vector<SvLinkSource_Entry_Impl*>::const_iterator cend() const { return mvData.cend(); } + void clear() { mvData.clear(); } + void push_back(SvLinkSource_Entry_Impl* rData) { mvData.push_back(rData); } + void DeleteAndDestroy(SvLinkSource_Entry_Impl* p) { - iterator it = std::find(begin(), end(), p); - if (it != end()) + std::vector<SvLinkSource_Entry_Impl*>::iterator it = std::find(mvData.begin(), mvData.end(), p); + if (it != mvData.end()) { - erase(it); + mvData.erase(it); delete p; } } ~SvLinkSource_Array_Impl() { - for(const_iterator it = begin(); it != end(); ++it) + for(std::vector<SvLinkSource_Entry_Impl*>::const_iterator it = mvData.begin(); it != mvData.end(); ++it) delete *it; } }; @@ -138,7 +152,7 @@ SvLinkSource_EntryIter_Impl::~SvLinkSource_EntryIter_Impl() bool SvLinkSource_EntryIter_Impl::IsValidCurrValue( SvLinkSource_Entry_Impl* pEntry ) { return ( nPos < aArr.size() && aArr[nPos] == pEntry - && std::find( rOrigArr.begin(), rOrigArr.end(), pEntry ) != rOrigArr.end() ); + && std::find( rOrigArr.cbegin(), rOrigArr.cend(), pEntry ) != rOrigArr.cend() ); } SvLinkSource_Entry_Impl* SvLinkSource_EntryIter_Impl::Next() @@ -155,7 +169,7 @@ SvLinkSource_Entry_Impl* SvLinkSource_EntryIter_Impl::Next() // then we must search the current (or the next) in the orig do { pRet = aArr[ nPos ]; - if( std::find(rOrigArr.begin(), rOrigArr.end(), pRet ) != rOrigArr.end() ) + if( std::find(rOrigArr.cbegin(), rOrigArr.cend(), pRet ) != rOrigArr.cend() ) break; pRet = 0; ++nPos; |