fw4spl
|
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. | |
Keep track of commands, undo/redo them.
Definition at line 22 of file UndoRedoManager.hpp.
fwCommand::UndoRedoManager::UndoRedoManager | ( | size_t | maxMemory = std::numeric_limits<size_t>::max() , |
size_t | maxCommands = std::numeric_limits<size_t>::max() |
||
) |
Default constructor.
[in] | maxMemory | the maximum amount of memory used by the manager (commands are dumped beyond this point) |
[in] | maxUndo | the 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.
bool fwCommand::UndoRedoManager::enqueue | ( | ICommand::sptr | cmd | ) |
Push a command to the history.
[in] | cmd | the command |
Definition at line 27 of file UndoRedoManager.cpp.
References SLM_WARN.
Referenced by ctrlHistory::SCommandHistory::stopping().
bool fwCommand::UndoRedoManager::redo | ( | ) |
Execute the next command if any.
Definition at line 72 of file UndoRedoManager.cpp.
Referenced by ctrlHistory::SCommandHistory::stopping().
bool fwCommand::UndoRedoManager::undo | ( | ) |
Execute the previous command if any.
Definition at line 87 of file UndoRedoManager.cpp.
Referenced by ctrlHistory::SCommandHistory::stopping().