summaryrefslogtreecommitdiffstats
path: root/sw
diff options
context:
space:
mode:
authorShreyansh Gandhi <gandhishrey@gmail.com>2014-06-10 22:08:39 +0530
committerNoel Grandin <noelgrandin@gmail.com>2014-06-13 07:26:48 +0000
commit5028475adb6fa164c18b93ab7fb83b2256d78a89 (patch)
tree6feb547bd006cb947801c52647dd3159ea540ec9 /sw
parentlibgltf: fix up this patch, some forgotten changes (diff)
downloadcore-5028475adb6fa164c18b93ab7fb83b2256d78a89.tar.gz
core-5028475adb6fa164c18b93ab7fb83b2256d78a89.zip
fdo#75757: Remove inheritance from std::vector
Problem: Many classes inherit directly from std::vector See comment#6 by kendy for more details. Solution: Removed class SwpHstry altogether and moved its destructor's functionality to SwHistory's destructor. Changed type of m_SwpHstry from SwpHstry to vector<SwHistoryHint*> Change-Id: I32a7e111fef7c5e7b83ecee6469e173b5a21a5bf Reviewed-on: https://gerrit.libreoffice.org/9725 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/inc/rolbck.hxx13
-rw-r--r--sw/source/core/undo/rolbck.cxx10
2 files changed, 7 insertions, 16 deletions
diff --git a/sw/source/core/inc/rolbck.hxx b/sw/source/core/inc/rolbck.hxx
index 0c36352df003..8db7247f45e5 100644
--- a/sw/source/core/inc/rolbck.hxx
+++ b/sw/source/core/inc/rolbck.hxx
@@ -337,21 +337,16 @@ public:
};
-class SwpHstry : public std::vector<SwHistoryHint*> {
-public:
- // the destructor will free all objects still in the vector
- ~SwpHstry();
-};
-
class SwHistory
{
friend class SwDoc; // actually only SwDoc::DelUndoObj may access
friend class SwRegHistory; // for inserting History attributes
- SwpHstry m_SwpHstry;
+ std::vector<SwHistoryHint*> m_SwpHstry;
sal_uInt16 m_nEndDiff;
public:
+ typedef std::vector<SwHistoryHint*>::iterator SwpHstry_iterator;
SwHistory( sal_uInt16 nInitSz = 0 );
~SwHistory();
@@ -383,8 +378,8 @@ public:
void Move( sal_uInt16 nPos, SwHistory *pIns,
sal_uInt16 const nStart = 0)
{
- SwpHstry::iterator itSourceBegin = pIns->m_SwpHstry.begin() + nStart;
- SwpHstry::iterator itSourceEnd = pIns->m_SwpHstry.end();
+ SwpHstry_iterator itSourceBegin = pIns->m_SwpHstry.begin() + nStart;
+ SwpHstry_iterator itSourceEnd = pIns->m_SwpHstry.end();
if (itSourceBegin == itSourceEnd) return;
m_SwpHstry.insert(m_SwpHstry.begin() + nPos, itSourceBegin, itSourceEnd);
pIns->m_SwpHstry.erase( itSourceBegin, itSourceEnd );
diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx
index 20fa77bfa5ac..cafee2580a26 100644
--- a/sw/source/core/undo/rolbck.cxx
+++ b/sw/source/core/undo/rolbck.cxx
@@ -976,6 +976,9 @@ SwHistory::SwHistory( sal_uInt16 nInitSz )
SwHistory::~SwHistory()
{
+ std::vector<SwHistoryHint*>::const_iterator it;
+ for(it = m_SwpHstry.begin(); it != m_SwpHstry.end(); ++it)
+ delete *it;
Delete( 0 );
}
@@ -1429,11 +1432,4 @@ void SwRegHistory::_MakeSetWhichIds()
}
}
}
-
-SwpHstry::~SwpHstry()
-{
- for(const_iterator it = begin(); it != end(); ++it)
- delete *it;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */