diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-17 16:32:38 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-19 08:45:08 +0200 |
commit | 9fe3839fed4488ee7ad47bd877a6978d118891a3 (patch) | |
tree | 40a6baeb583f7d7b069701ae8bb2ec32944308ba /include/svl/undo.hxx | |
parent | d8ac55e3e53564aca4b0bade5a5b5cb01b4519b1 (diff) |
flatten SfxUndoArray
there is really no need to point to an impl which points to a
std::vector
Change-Id: I73c47cf3056a24d909e77b9b4cf9d9ae57c19c04
Reviewed-on: https://gerrit.libreoffice.org/60588
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/svl/undo.hxx')
-rw-r--r-- | include/svl/undo.hxx | 38 |
1 files changed, 14 insertions, 24 deletions
diff --git a/include/svl/undo.hxx b/include/svl/undo.hxx index 434124373666..456a31f56b18 100644 --- a/include/svl/undo.hxx +++ b/include/svl/undo.hxx @@ -26,6 +26,7 @@ #include <limits> #include <memory> +#include <vector> struct MarkedUndoAction; @@ -80,42 +81,31 @@ private: typedef sal_Int32 UndoStackMark; #define MARK_INVALID ::std::numeric_limits< UndoStackMark >::max() -class SVL_DLLPUBLIC SfxUndoActions +struct MarkedUndoAction { - struct Impl; - std::unique_ptr<Impl> mpImpl; - -public: - SfxUndoActions(); - SfxUndoActions( const SfxUndoActions& r ); - ~SfxUndoActions(); - - bool empty() const; - size_t size() const; - - const MarkedUndoAction& operator[]( size_t i ) const; - MarkedUndoAction& operator[]( size_t i ); - - const SfxUndoAction* GetUndoAction( size_t i ) const; - SfxUndoAction* GetUndoAction( size_t i ); + SfxUndoAction* pAction; + ::std::vector< UndoStackMark > aMarks; - void Remove( size_t i_pos ); - void Remove( size_t i_pos, size_t i_count ); - void Insert( SfxUndoAction* i_action, size_t i_pos ); + MarkedUndoAction(SfxUndoAction* p) : pAction(p) {} }; /** do not make use of these implementation details, unless you really really have to! */ struct SVL_DLLPUBLIC SfxUndoArray { - SfxUndoActions aUndoActions; + std::vector<MarkedUndoAction> maUndoActions; size_t nMaxUndoActions; size_t nCurUndoAction; SfxUndoArray *pFatherUndoArray; - SfxUndoArray(size_t nMax=0): - nMaxUndoActions(nMax), nCurUndoAction(0), - pFatherUndoArray(nullptr) {} + + SfxUndoArray(size_t nMax=0) : + nMaxUndoActions(nMax), nCurUndoAction(0), pFatherUndoArray(nullptr) {} virtual ~SfxUndoArray(); + + SfxUndoAction* GetUndoAction(size_t idx) { return maUndoActions[idx].pAction; } + void Remove(int idx); + void Remove( size_t i_pos, size_t i_count ); + void Insert( SfxUndoAction* i_action, size_t i_pos ); }; |