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

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

Constructor & Destructor Documentation

◆ UndoRedoStack()

A constructor.

Creates a new Instance of this class.

Member Function Documentation

◆ canRedo()

bool canRedo ( )

Returns the possibility to redo a Action.

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

◆ canUndo()

bool canUndo ( )

Returns the possibility to undo a Action.

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

◆ clear()

void clear ( )

Removes all actions from the history.

◆ 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

◆ redo()

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

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

◆ undo()

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

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

◆ 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

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