Envision
A visual programming IDE for object-oriented languages
|
Public Member Functions | |
UndoCommand (Node *target, const QString &text) | |
virtual | ~UndoCommand () |
virtual Node * | insertedNode () const |
Returns the node that this command inserted into the tree, or nullptr if no node was inserted. More... | |
bool | isUndone () const |
Returns whether the command has been undone since it was applied. More... | |
virtual Node * | owned () const |
Returns the node owned by this command or nullptr if no node is owned. More... | |
virtual void | redo () |
virtual Node * | removedNode () const |
Returns the node that this command removed from the tree, or nullptr if no node was removed. More... | |
Node * | target () const |
virtual void | undo () |
Private Attributes | |
Node * | target_ |
bool | undone |
Model::UndoCommand::UndoCommand | ( | Node * | target, |
const QString & | text | ||
) |
|
virtual |
|
virtual |
Returns the node that this command inserted into the tree, or nullptr if no node was inserted.
The default implementaion returns nullptr. Reimplement this in commands that own a node.
Reimplemented in Model::NodeOwningCommand.
|
inline |
Returns whether the command has been undone since it was applied.
If a command is undone after it was originally executed, this will return true. If a command which was undone is redone this will return false.
This is used for memory management. If a command is destroyed (leaves the undo stack) it may need to delete objects associated with it. A command can leave the stack for two reasons:
|
virtual |
Returns the node owned by this command or nullptr if no node is owned.
Nodes which are owned should be deleted by the command when it is deleted.
Reimplemented in Model::NodeOwningCommand.
|
virtual |
|
virtual |
Returns the node that this command removed from the tree, or nullptr if no node was removed.
The default implementaion returns nullptr. Reimplement this in commands that own a node.
Reimplemented in Model::NodeOwningCommand.
|
inline |
|
virtual |
|
private |
|
private |