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

Base interface for undoable commands. More...

#include <Command.h>

Inherited by DekiEditor::CompoundCommand.

Public Member Functions

virtual ~Command ()=default
virtual std::string GetDescription () const =0
 Human-readable description for UI display.
virtual void Execute ()=0
 Execute the command.
virtual void Undo ()=0
 Undo the command.
virtual void Redo ()
 Redo the command (default: calls Execute).
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.
virtual bool ReferencesAny (const DeadMemory &dead) const
 Report whether this command holds a raw pointer to anything in dead.

Detailed Description

Base interface for undoable commands.

Constructor & Destructor Documentation

◆ ~Command()

virtual DekiEditor::Command::~Command ( )
virtualdefault

Member Function Documentation

◆ GetDescription()

virtual std::string DekiEditor::Command::GetDescription ( ) const
pure virtual

Human-readable description for UI display.

Implemented in DekiEditor::CompoundCommand.

◆ Execute()

virtual void DekiEditor::Command::Execute ( )
pure virtual

Execute the command.

Implemented in DekiEditor::CompoundCommand.

◆ Undo()

virtual void DekiEditor::Command::Undo ( )
pure virtual

Undo the command.

Implemented in DekiEditor::CompoundCommand.

◆ Redo()

virtual void DekiEditor::Command::Redo ( )
inlinevirtual

Redo the command (default: calls Execute).

Reimplemented in DekiEditor::CompoundCommand.

◆ CanMerge()

virtual bool DekiEditor::Command::CanMerge ( const Command * other) const
inlinevirtual

Check if this command can merge with another.

◆ Merge()

virtual void DekiEditor::Command::Merge ( const Command * other)
inlinevirtual

Merge another command into this one.

◆ ReferencesAny()

virtual bool DekiEditor::Command::ReferencesAny ( const DeadMemory & dead) const
inlinevirtual

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 in DekiEditor::CompoundCommand.


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