Envision
A visual programming IDE for object-oriented languages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
Model::NodeOwningCommand Class Reference
Inheritance diagram for Model::NodeOwningCommand:
Model::UndoCommand Model::CompositeNodeChangeChild Model::ListInsert Model::ListPut Model::ListRemove

Public Member Functions

 NodeOwningCommand (Node *target, const QString &text, Node *ownedIfDone, Node *ownedIfUndone)
 
virtual ~NodeOwningCommand ()
 
virtual NodeinsertedNode () const override
 Returns the node that this command inserted into the tree, or nullptr if no node was inserted. More...
 
virtual Nodeowned () const override
 Returns the node owned by this command or nullptr if no node is owned. More...
 
virtual void redo () override
 
virtual NoderemovedNode () const override
 Returns the node that this command removed from the tree, or nullptr if no node was removed. More...
 
virtual void undo () override
 
- Public Member Functions inherited from Model::UndoCommand
 UndoCommand (Node *target, const QString &text)
 
virtual ~UndoCommand ()
 
bool isUndone () const
 Returns whether the command has been undone since it was applied. More...
 
Nodetarget () const
 

Private Member Functions

void moveNodes (Node *root, NodeIdMap &source, NodeIdMap &target)
 

Private Attributes

NodeownedIfDone_ {}
 
NodeownedIfUndone_ {}
 

Constructor & Destructor Documentation

◆ NodeOwningCommand()

Model::NodeOwningCommand::NodeOwningCommand ( Node target,
const QString &  text,
Node ownedIfDone,
Node ownedIfUndone 
)

◆ ~NodeOwningCommand()

Model::NodeOwningCommand::~NodeOwningCommand ( )
virtual

Member Function Documentation

◆ insertedNode()

Node * Model::NodeOwningCommand::insertedNode ( ) const
overridevirtual

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 from Model::UndoCommand.

◆ moveNodes()

void Model::NodeOwningCommand::moveNodes ( Node root,
NodeIdMap source,
NodeIdMap target 
)
private

◆ owned()

Node * Model::NodeOwningCommand::owned ( ) const
overridevirtual

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 from Model::UndoCommand.

◆ redo()

void Model::NodeOwningCommand::redo ( )
overridevirtual

◆ removedNode()

Node * Model::NodeOwningCommand::removedNode ( ) const
overridevirtual

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 from Model::UndoCommand.

◆ undo()

void Model::NodeOwningCommand::undo ( )
overridevirtual

Member Data Documentation

◆ ownedIfDone_

Node* Model::NodeOwningCommand::ownedIfDone_ {}
private

◆ ownedIfUndone_

Node* Model::NodeOwningCommand::ownedIfUndone_ {}
private