BlankMat 0.1.0
Free open-source 3D texture creation application
Loading...
Searching...
No Matches
ActionNode Struct Reference

Doubly linked node that stores the do and undo command of an action. More...

Collaboration diagram for ActionNode:

Public Member Functions

bool HasPrev () const
 Returns whether this action has a previous node.
 
bool HasNext () const
 Returns whether this action has a next node.
 
bool HasCommand () const
 Returns whether this action has a valid command.
 
bool CanUndo () const
 Returns whether this action can be undone.
 
void Execute ()
 Executes the command of the node.
 
void Undo ()
 Undoes the command of the node.
 
bool Combine (ICommand *&newCommand)
 Attempts to combine the new command with the current command.
 
std::string GetName () const
 Returns the name of the command.
 
 ActionNode (ActionNode *prev, ActionNode *next, ICommand *command)
 Creates a new action node for the given command.
 

Public Attributes

ActionNodemPrevNode
 The previous node of the action.
 
ActionNodemNextNode
 The next node of the action.
 
ICommandmCommand
 The command that the node executes.
 

Detailed Description

Doubly linked node that stores the do and undo command of an action.

Constructor & Destructor Documentation

◆ ActionNode()

ActionNode::ActionNode ( ActionNode prev,
ActionNode next,
ICommand command 
)
inline

Creates a new action node for the given command.

Parameters
prevPreviously run node
nextNext node (should be null)
commandCommand to run

Member Function Documentation

◆ CanUndo()

bool ActionNode::CanUndo ( ) const
inline

Returns whether this action can be undone.

Returns

◆ Combine()

bool ActionNode::Combine ( ICommand *&  newCommand)
inline

Attempts to combine the new command with the current command.

Parameters
newCommandNew command to try combining
Returns
Whether the commands were combined

◆ Execute()

void ActionNode::Execute ( )
inline

Executes the command of the node.

◆ GetName()

std::string ActionNode::GetName ( ) const
inline

Returns the name of the command.

Returns

◆ HasCommand()

bool ActionNode::HasCommand ( ) const
inline

Returns whether this action has a valid command.

Returns

◆ HasNext()

bool ActionNode::HasNext ( ) const
inline

Returns whether this action has a next node.

Returns

◆ HasPrev()

bool ActionNode::HasPrev ( ) const
inline

Returns whether this action has a previous node.

Returns

◆ Undo()

void ActionNode::Undo ( )
inline

Undoes the command of the node.

Member Data Documentation

◆ mCommand

ICommand* ActionNode::mCommand

The command that the node executes.

◆ mNextNode

ActionNode* ActionNode::mNextNode

The next node of the action.

◆ mPrevNode

ActionNode* ActionNode::mPrevNode

The previous node of the action.