From 19e715973e15f9e7cf6e8237643dbbc14f8eb87a Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 29 Oct 2018 16:15:27 +0200 Subject: loplugin:useuniqueptr in MarkedUndoAction Change-Id: Ic06b990112df5bc135cfd7af6f1129580f294428 Reviewed-on: https://gerrit.libreoffice.org/62509 Tested-by: Jenkins Reviewed-by: Noel Grandin --- include/svl/undo.hxx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'include/svl/undo.hxx') diff --git a/include/svl/undo.hxx b/include/svl/undo.hxx index 9451b9bd8e71..87c5196960f2 100644 --- a/include/svl/undo.hxx +++ b/include/svl/undo.hxx @@ -83,10 +83,10 @@ typedef sal_Int32 UndoStackMark; struct MarkedUndoAction { - SfxUndoAction* pAction; + std::unique_ptr pAction; ::std::vector< UndoStackMark > aMarks; - MarkedUndoAction(SfxUndoAction* p) : pAction(p) {} + MarkedUndoAction(std::unique_ptr p) : pAction(std::move(p)) {} }; /** do not make use of these implementation details, unless you @@ -102,10 +102,13 @@ struct SVL_DLLPUBLIC SfxUndoArray 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 ); + SfxUndoArray& operator=( SfxUndoArray const & ) = delete; // MSVC2017 workaround + SfxUndoArray( SfxUndoArray const & ) = delete; // MSVC2017 workaround + + SfxUndoAction* GetUndoAction(size_t idx) { return maUndoActions[idx].pAction.get(); } + std::unique_ptr RemoveX(int idx); + void RemoveX( size_t i_pos, size_t i_count ); + void Insert( std::unique_ptr i_action, size_t i_pos ); }; -- cgit