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

Takeshi Abe tabe at fixedpoint.jp
Thu Oct 20 14:22:34 UTC 2016


 sw/inc/swtable.hxx |   31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

New commits:
commit 5e4a2abde982416c5dcaf5f481582115463a4219
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Thu Oct 20 17:35:07 2016 +0900

    sw: Avoid inheritance from std::vector
    
    Change-Id: I4ee09871ec0fa5c67a8d4c4c448229ec2deda4c2
    Reviewed-on: https://gerrit.libreoffice.org/30075
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Takeshi Abe <tabe at fixedpoint.jp>

diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx
index 96d212e..c1e9a50 100644
--- a/sw/inc/swtable.hxx
+++ b/sw/inc/swtable.hxx
@@ -62,11 +62,40 @@ class SwServerObject;
 
 void sw_GetTableBoxColStr( sal_uInt16 nCol, OUString& rNm );
 
-class SwTableLines : public std::vector<SwTableLine*> {
+class SwTableLines
+{
+    std::vector<SwTableLine*> m_vLines;
+
 public:
+    typedef std::vector<SwTableLine*>::size_type size_type;
+    typedef std::vector<SwTableLine*>::iterator iterator;
+    typedef std::vector<SwTableLine*>::const_iterator const_iterator;
+
     // free's any remaining child objects
     ~SwTableLines();
 
+    bool empty() const { return m_vLines.empty(); }
+    size_type size() const { return m_vLines.size(); }
+    iterator begin() { return m_vLines.begin(); }
+    const_iterator begin() const { return m_vLines.begin(); }
+    iterator end() { return m_vLines.end(); }
+    const_iterator end() const { return m_vLines.end(); }
+    SwTableLine* front() const { return m_vLines.front(); }
+    SwTableLine* back() const { return m_vLines.back(); }
+    void clear() { m_vLines.clear(); }
+    iterator erase( iterator aIt ) { return m_vLines.erase( aIt ); }
+    iterator erase( iterator aFirst, iterator aLast ) { return m_vLines.erase( aFirst, aLast ); }
+    iterator insert( iterator aIt, SwTableLine* pLine ) { return m_vLines.insert( aIt, pLine ); }
+    template<typename TInputIterator>
+    void insert( iterator aIt, TInputIterator aFirst, TInputIterator aLast )
+    {
+        m_vLines.insert( aIt, aFirst, aLast );
+    }
+    void push_back( SwTableLine* pLine ) { m_vLines.push_back( pLine ); }
+    void reserve( size_type nSize ) { m_vLines.reserve( nSize ); }
+    SwTableLine*& operator[]( size_type nPos ) { return m_vLines[ nPos ]; }
+    SwTableLine* operator[]( size_type nPos ) const { return m_vLines[ nPos ]; }
+
     // return USHRT_MAX if not found, else index of position
     sal_uInt16 GetPos(const SwTableLine* pBox) const
     {


More information about the Libreoffice-commits mailing list