MvcTransactionModel Class

class MvcTransactionModel: public CMvcModel

A transaction model records all commands that have occured within an application and is central to the undo/redo, record/playback and event logging functionality. To record a command, the controller simply has to call the Log member passing a pointer to the MvcCommand object. Later, the transaction model can undo the logged commands.

Defined in: MvcTransactionModel.h

Class Members

MvcTransactionModel()

Constructor

virtual  ~MvcTransactionModel()

Destructor

virtual void  Reset()

Reset the state of the transaction model to its initial state

virtual BOOL  IsModified() const

Tests whether the transaction model has stored new commands since last save

virtual BOOL  Log(CMvcCommand* pCmd)

Records the specified command for later undo or event logging

virtual BOOL  Do(CMvcCommand* pCmd)

Execute and log a command

virtual CMvcCommand*  Undo()

Undo a command

virtual CMvcCommand*  Redo()

Redo a command

CMvcCommand*  PeekUndo()

Get the command that will be reversed next time Undo is called

CMvcCommand*  PeekUndo(int)

Get the Undo command with index

CMvcCommand*  PeekRedo()

Get the command that will be execute next time Redo is called

CMvcCommand*  PeekRedo(int)

Get the Redo command with index

CMvcCommand*  PopUndo()

Pop the Undo command from stack

CMvcCommand*  PopRedo()

Pop the Redo command from stack

void  PushUndo(CMvcCommand* pCmd)

Push the Undo command into stack

void  PushRedo(CMvcCommand* pCmd)

Push the Redo command into stack

void  SetHistorySize(int m_nHistorySize)

Set the number of commands that can be stored by the transaction model

int  GetUndoCommandsCount() const

Get the Undo commands count

int  GetRedoCommandsCount() const

Get the redo commands count

CCStack_T&ltCMvcCommand*, CMvcCommand*>  m_undoStack

Stack of command actions that can be undone.

CCStack_T&ltCMvcCommand*, CMvcCommand*>  m_redoStack

Stack of command actions that can be redone.