Deki 1.3.0
Modular C++ 2D engine for embedded displays and desktop
Loading...
Searching...
No Matches
DekiEditor::CompoundCommand Class Reference

Groups multiple commands into a single undoable operation. More...

#include <Command.h>

Inherits DekiEditor::Command.

Public Member Functions

 CompoundCommand (const std::string &description, std::vector< std::unique_ptr< Command > > commands)
 CompoundCommand (const CompoundCommand &)=delete
CompoundCommandoperator= (const CompoundCommand &)=delete
std::string GetDescription () const override
 Human-readable description for UI display.
void Execute () override
 Execute the command.
void Undo () override
 Undo the command.
void Redo () override
 Redo the command (default: calls Execute).
bool ReferencesAny (const DeadMemory &dead) const override
 Report whether this command holds a raw pointer to anything in dead.
Public Member Functions inherited from DekiEditor::Command
virtual ~Command ()=default
virtual bool CanMerge (const Command *other) const
 Check if this command can merge with another.
virtual void Merge (const Command *other)
 Merge another command into this one.

Detailed Description

Groups multiple commands into a single undoable operation.

Constructor & Destructor Documentation

◆ CompoundCommand() [1/2]

DekiEditor::CompoundCommand::CompoundCommand ( const std::string & description,
std::vector< std::unique_ptr< Command > > commands )
inlineexplicit

◆ CompoundCommand() [2/2]

DekiEditor::CompoundCommand::CompoundCommand ( const CompoundCommand & )
delete

Member Function Documentation

◆ operator=()

CompoundCommand & DekiEditor::CompoundCommand::operator= ( const CompoundCommand & )
delete

◆ GetDescription()

std::string DekiEditor::CompoundCommand::GetDescription ( ) const
inlineoverridevirtual

Human-readable description for UI display.

Implements DekiEditor::Command.

◆ Execute()

void DekiEditor::CompoundCommand::Execute ( )
inlineoverridevirtual

Execute the command.

Implements DekiEditor::Command.

◆ Undo()

void DekiEditor::CompoundCommand::Undo ( )
inlineoverridevirtual

Undo the command.

Implements DekiEditor::Command.

◆ Redo()

void DekiEditor::CompoundCommand::Redo ( )
inlineoverridevirtual

Redo the command (default: calls Execute).

Reimplemented from DekiEditor::Command.

◆ ReferencesAny()

bool DekiEditor::CompoundCommand::ReferencesAny ( const DeadMemory & dead) const
inlineoverridevirtual

Report whether this command holds a raw pointer to anything in dead.

CommandHistory calls this when the scene is about to free objects, and discards any command that answers true — running Undo()/Redo() on a command whose target has been freed is a use-after-free.

The default is false, which is correct for commands that address their target by value or by id. Any command storing a DekiObject*, DekiComponent*, or Scene* MUST override this; see the implementations in src/core/commands/ for the pattern.

Reimplemented from DekiEditor::Command.


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