SDFormat Editor
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
AddElementCommand Class Reference

Add Element command implementation of CommandI. More...

#include <AddElementCommand.h>

Inheritance diagram for AddElementCommand:
Inheritance graph
Collaboration diagram for AddElementCommand:
Collaboration graph

Public Member Functions

 AddElementCommand (std::shared_ptr< GUII > gui, std::shared_ptr< SDFormatParserI > sdformatParser, sdf::ElementPtr parent_element, sdf::ElementPtr new_element)
 Constructor for add element command objects.
 

Private Member Functions

bool Execute () override
 Implementation of interface method.
 
bool ExecuteUndo () override
 Implementation of interface method.
 
bool ExecuteRedo () override
 Implementation of interface method.
 
bool IsUndoable () override
 Implementation of interface method.
 
bool IsRedoable () override
 Implementation of interface method.
 
bool IsThreaded (bool &prevent_user_input) override
 Implementation of interface method.
 
bool ChangesProgramStateIrreversibly () override
 Implementation of interface method.
 
void AddElement (sdf::ElementPtr parent, sdf::ElementPtr element)
 Internal function to add element.
 

Private Attributes

std::shared_ptr< GUIIgui
 Pointer to the gui interface.
 
std::shared_ptr< SDFormatParserIsdformatParser
 Pointer to the sdformat parser interface.
 
sdf::ElementPtr parent_element
 Pointer to the parent of the element that may be added.
 
sdf::ElementPtr new_element
 Pointer to the added element.
 
bool is_currently_undoable = false
 Store if the command is currently undo-able.
 
bool is_currently_redoable = false
 Store if the command is currently redo-able.
 

Detailed Description

Add Element command implementation of CommandI.

Constructor & Destructor Documentation

◆ AddElementCommand()

AddElementCommand::AddElementCommand ( std::shared_ptr< GUII gui,
std::shared_ptr< SDFormatParserI sdformatParser,
sdf::ElementPtr  parent_element,
sdf::ElementPtr  new_element 
)

Constructor for add element command objects.

Parameters
[in]guiPointer to the GUII object
[in]sdformatParserPointer to the SDFormatParserI object
[in]parent_elementPointer to the parent of the element that may be added
[in]new_elementPointer to the element that is to be added

Member Function Documentation

◆ ChangesProgramStateIrreversibly()

bool AddElementCommand::ChangesProgramStateIrreversibly ( )
overrideprivatevirtual

Implementation of interface method.

Returns
Always false

Implements CommandI.

◆ Execute()

bool AddElementCommand::Execute ( )
overrideprivatevirtual

Implementation of interface method.

Returns
True if a new element is added to the specified parent

Implements CommandI.

◆ ExecuteRedo()

bool AddElementCommand::ExecuteRedo ( )
overrideprivatevirtual

Implementation of interface method.

Returns
Returns true if the added element was restored to its parent again

Implements CommandI.

◆ ExecuteUndo()

bool AddElementCommand::ExecuteUndo ( )
overrideprivatevirtual

Implementation of interface method.

Returns
Returns true if the added element was removed from its parent

Implements CommandI.

◆ IsRedoable()

bool AddElementCommand::IsRedoable ( )
overrideprivatevirtual

Implementation of interface method.

Returns
Returns true if the command can be redone

Implements CommandI.

◆ IsThreaded()

bool AddElementCommand::IsThreaded ( bool &  prevent_user_input)
overrideprivatevirtual

Implementation of interface method.

Parameters
[out]prevent_user_inputindicates if user input should be prevented if this happens to be a threaded command
Returns
Always false

Implements CommandI.

◆ IsUndoable()

bool AddElementCommand::IsUndoable ( )
overrideprivatevirtual

Implementation of interface method.

Returns
Returns true if the command can be undone

Implements CommandI.


The documentation for this class was generated from the following files: