NDEVR
API Documentation
DesignCommandGroup

Allows for convenient groupings of commands that can be redo-undo all at once. More...

Inheritance diagram for DesignCommandGroup:
[legend]
Collaboration diagram for DesignCommandGroup:
[legend]

Public Member Functions

 DesignCommandGroup ()
 Default constructor.
 DesignCommandGroup (const Buffer< DynamicPointer< DesignCommand > > &buffer)
 Constructs a command group from a buffer of commands.
 DesignCommandGroup (const TranslatedString &name, StringView icon=StringView())
 Constructs a command group with a display name and optional icon.
 DesignCommandGroup (std::initializer_list< DynamicPointer< DesignCommand > > l)
 Constructs a command group from an initializer list of commands.
virtual ~DesignCommandGroup ()
 Virtual destructor.
template<class t_type>
void add (const DynamicPointer< t_type > &val)
 Adds a command to this group via a DynamicPointer.
template<class t_type>
void add (t_type &&val)
 Adds a command to this group via move semantics.
virtual bool addTarget (UUID id) override
 Adds a target UUID to all commands in this group.
virtual void execute (DesignObjectLookup *lookup) override
 Executes all commands in this group sequentially against the given lookup.
virtual StringView icon () const override
 Gets the icon identifier for this command group.
virtual bool isAsyncExecution () const override
 Checks whether any command in this group requires async execution.
virtual TranslatedString name () const override
 Gets the display name of this command group.
Public Member Functions inherited from DesignCommand
 DesignCommand ()
 Default constructor.
 DesignCommand (const DesignCommand &command)=default
 Default copy constructor.
virtual ~DesignCommand ()
 Virtual destructor.
virtual bool canCombineWith (const DynamicPointer< DesignCommand > &)
 Checks whether this command can be combined with another command into a single operation.
virtual bool canGroupWith (const DynamicPointer< DesignCommand > &)
 Checks whether this command can be grouped with another command for batch execution.
virtual void combineWith (const DynamicPointer< DesignCommand > &command)
 Combines this command with another compatible command, merging their operations.
void setUndoRedoID (UUID undo_redo_group)
 Sets the undo-redo group identifier for this command.
UUID undoRedoID () const
 Gets the undo-redo group identifier for this command.

Additional Inherited Members

Public Attributes inherited from DesignCommand
bool can_undo = true
 Whether this command supports being undone.
bool has_executed = false
 Whether this command has already been executed.
UUID id
 Unique identifier for this command instance.
bool is_undo = false
 Whether this command represents an undo operation.
LogPtr log
 Log pipe for reporting command progress and errors.
Time time = Constant<Time>::Invalid
 Timestamp of when the command was created or executed.
bool update_project_modified = true
 Whether executing this command should mark the project as modified.
Protected Attributes inherited from DesignCommand
UUID m_undo_redo_group
 The undo-redo group this command belongs to, for batch undo/redo.

Detailed Description

Allows for convenient groupings of commands that can be redo-undo all at once.


Execution at one time ensured.

See also
DesignCommand, DesignCommandManager

Definition at line 134 of file DesignCommand.h.

Constructor & Destructor Documentation

◆ DesignCommandGroup() [1/4]

DesignCommandGroup::DesignCommandGroup ( )
inline

Default constructor.

Creates an empty command group.

Definition at line 138 of file DesignCommand.h.

◆ DesignCommandGroup() [2/4]

DesignCommandGroup::DesignCommandGroup ( const TranslatedString & name,
StringView icon = StringView() )

Constructs a command group with a display name and optional icon.

Parameters
[in]nameThe translated display name for this group.
[in]iconThe icon identifier for this group.

References icon(), and name().

◆ DesignCommandGroup() [3/4]

DesignCommandGroup::DesignCommandGroup ( std::initializer_list< DynamicPointer< DesignCommand > > l)

Constructs a command group from an initializer list of commands.

Parameters
[in]lThe initializer list of commands to include in this group.

◆ DesignCommandGroup() [4/4]

DesignCommandGroup::DesignCommandGroup ( const Buffer< DynamicPointer< DesignCommand > > & buffer)

Constructs a command group from a buffer of commands.

Parameters
[in]bufferThe buffer of commands to include in this group.

Member Function Documentation

◆ add() [1/2]

template<class t_type>
void DesignCommandGroup::add ( const DynamicPointer< t_type > & val)
inline

Adds a command to this group via a DynamicPointer.

Parameters
[in]valThe command to add, automatically cast to DesignCommand.

Definition at line 178 of file DesignCommand.h.

Referenced by add().

◆ add() [2/2]

template<class t_type>
void DesignCommandGroup::add ( t_type && val)
inline

Adds a command to this group via move semantics.

Parameters
[in]valThe command to move into this group.

Definition at line 187 of file DesignCommand.h.

References add().

◆ addTarget()

virtual bool DesignCommandGroup::addTarget ( UUID id)
overridevirtual

Adds a target UUID to all commands in this group.

Parameters
[in]idThe UUID of the target design object.
Returns
True if any command in the group accepted the target.

Reimplemented from DesignCommand.

◆ execute()

virtual void DesignCommandGroup::execute ( DesignObjectLookup * lookup)
overridevirtual

Executes all commands in this group sequentially against the given lookup.

Parameters
[in]lookupThe design object registry to modify.

Reimplemented from DesignCommand.

◆ icon()

virtual StringView DesignCommandGroup::icon ( ) const
overridevirtual

Gets the icon identifier for this command group.

Returns
A string view of the icon name.

Implements DesignCommand.

Referenced by DesignCommandGroup().

◆ isAsyncExecution()

virtual bool DesignCommandGroup::isAsyncExecution ( ) const
overridevirtual

Checks whether any command in this group requires async execution.

Returns
True if any contained command is async, false otherwise.

Reimplemented from DesignCommand.

◆ name()

virtual TranslatedString DesignCommandGroup::name ( ) const
overridevirtual

Gets the display name of this command group.

Returns
The translated name of this group.

Implements DesignCommand.

Referenced by DesignCommandGroup().


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