fw4spl
fwCommand::UndoRedoManager Class Reference

Keep track of commands, undo/redo them. More...

#include <UndoRedoManager.hpp>

Public Member Functions

FWCOMMAND_API UndoRedoManager (size_t maxMemory=std::numeric_limits< size_t >::max(), size_t maxCommands=std::numeric_limits< size_t >::max())
 Default constructor. More...
 
FWCOMMAND_API bool enqueue (ICommand::sptr cmd)
 Push a command to the history. More...
 
FWCOMMAND_API bool redo ()
 Execute the next command if any. More...
 
FWCOMMAND_API bool undo ()
 Execute the previous command if any. More...
 
FWCOMMAND_API bool canUndo () const
 Return true if we can undo.
 
FWCOMMAND_API bool canRedo () const
 Return true if we can redo.
 
FWCOMMAND_API void clear ()
 Remove all commands in history.
 
FWCOMMAND_API size_t getCommandCount () const
 Get the number of enqueued commands.
 
FWCOMMAND_API void setCommandCount (size_t cmdCount)
 Set the maximum number of enqueued commands.
 
FWCOMMAND_API size_t getHistorySize () const
 Returns the amount of memory used by the history.
 
FWCOMMAND_API void setHistorySize (size_t histSize)
 Set the maximum amount of memory used by the history.
 

Detailed Description

Keep track of commands, undo/redo them.

Definition at line 22 of file UndoRedoManager.hpp.

Constructor & Destructor Documentation

fwCommand::UndoRedoManager::UndoRedoManager ( size_t  maxMemory = std::numeric_limits<size_t>::max(),
size_t  maxCommands = std::numeric_limits<size_t>::max() 
)

Default constructor.

Parameters
[in]maxMemorythe maximum amount of memory used by the manager (commands are dumped beyond this point)
[in]maxUndothe maximum number of commands stored by the manager (commands are dumped beyond this point)

Definition at line 16 of file UndoRedoManager.cpp.

References SLM_ASSERT.

Member Function Documentation

bool fwCommand::UndoRedoManager::enqueue ( ICommand::sptr  cmd)

Push a command to the history.

Parameters
[in]cmdthe command
Returns
false if the enqueue failed.

Definition at line 27 of file UndoRedoManager.cpp.

References SLM_WARN.

Referenced by ctrlHistory::SCommandHistory::stopping().

+ Here is the caller graph for this function:

bool fwCommand::UndoRedoManager::redo ( )

Execute the next command if any.

Returns
true if a command was redone

Definition at line 72 of file UndoRedoManager.cpp.

Referenced by ctrlHistory::SCommandHistory::stopping().

+ Here is the caller graph for this function:

bool fwCommand::UndoRedoManager::undo ( )

Execute the previous command if any.

Returns
true if a command was undone.

Definition at line 87 of file UndoRedoManager.cpp.

Referenced by ctrlHistory::SCommandHistory::stopping().

+ Here is the caller graph for this function:


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