UndoRedoStack Class Reference

A Stack to save a history of Actions. More...

#include <MemoryX/gui-plugins/SceneEditor/controller/UndoRedoStack.h>

Public Member Functions

bool canRedo ()
 Returns the possibility to redo a Action. More...
 
bool canUndo ()
 Returns the possibility to undo a Action. More...
 
void clear ()
 Removes all actions from the history. More...
 
void push (const std::shared_ptr< std::vector< OperationPtr > > &operations)
 Adds a Action to the history. More...
 
std::shared_ptr< std::vector< OperationPtr > > redo ()
 Goes one step forward in the history and returns the Operations need to redo. More...
 
std::shared_ptr< std::vector< OperationPtr > > undo ()
 Goes one step back in the history and returns the Operations need to redo. More...
 
 UndoRedoStack ()
 A constructor. More...
 
void updateObjectId (std::string oldId, std::string newId)
 Swaps oldId and newId in all Operations saved in this class. More...
 

Detailed Description

A Stack to save a history of Actions.

This Stack provides Functions to move forward and backward in the history.

See also
controller::UndoAction

Definition at line 44 of file UndoRedoStack.h.

Constructor & Destructor Documentation

◆ UndoRedoStack()

A constructor.

Creates a new Instance of this class.

Definition at line 33 of file UndoRedoStack.cpp.

Member Function Documentation

◆ canRedo()

bool canRedo ( )

Returns the possibility to redo a Action.

Returns
True, if there is a Action to redo; false otherwise.

Definition at line 44 of file UndoRedoStack.cpp.

◆ canUndo()

bool canUndo ( )

Returns the possibility to undo a Action.

Returns
True, if there is a Action to undo; false otherwise.

Definition at line 39 of file UndoRedoStack.cpp.

◆ clear()

void clear ( )

Removes all actions from the history.

Definition at line 130 of file UndoRedoStack.cpp.

◆ push()

void push ( const std::shared_ptr< std::vector< OperationPtr > > &  operations)

Adds a Action to the history.

The redo history will be cleared.

Parameters
actionThe action to add to the history.
See also
controller::UndoAction

Definition at line 86 of file UndoRedoStack.cpp.

◆ redo()

std::shared_ptr< std::vector< controller::OperationPtr > > redo ( )

Goes one step forward in the history and returns the Operations need to redo.

Definition at line 68 of file UndoRedoStack.cpp.

◆ undo()

std::shared_ptr< std::vector< controller::OperationPtr > > undo ( )

Goes one step back in the history and returns the Operations need to redo.

Definition at line 49 of file UndoRedoStack.cpp.

◆ updateObjectId()

void updateObjectId ( std::string  oldId,
std::string  newId 
)

Swaps oldId and newId in all Operations saved in this class.

Parameters
oldIdthe first ID
newIdthe second ID

Definition at line 97 of file UndoRedoStack.cpp.


The documentation for this class was generated from the following files: