DEKI/ENGINE docs
Deki 0.19.0
Modular C++ 2D engine for embedded displays and desktop
Loading...
Searching...
No Matches
DekiEditor::Command Class Referenceabstract

An undoable edit. More...

#include <C:/Users/kirby/Documents/Github/deki/deki-editor/deki-editor/include/deki-editor/Command.h>

Inherited by DekiEditor::CompoundCommand.

Public Member Functions

virtual ~Command ()=default
virtual std::string GetDescription () const =0
 Human-readable text shown in the UI, in the editor's current language.
virtual void Execute ()=0
virtual void Undo ()=0
virtual void Redo ()
 Calls Execute by default.
virtual bool CanMerge (const Command *other) const
 Whether other can be folded into this command.
virtual void Merge (const Command *other)
 Folds other into this command.
virtual bool ReferencesAny (const DeadMemory &dead) const
 Whether this command holds a raw pointer to anything in dead.

Detailed Description

An undoable edit.

Constructor & Destructor Documentation

◆ ~Command()

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

Member Function Documentation

◆ GetDescription()

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

Human-readable text shown in the UI, in the editor's current language.

Implemented in DekiEditor::CompoundCommand.

◆ Execute()

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

Implemented in DekiEditor::CompoundCommand.

◆ Undo()

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

Implemented in DekiEditor::CompoundCommand.

◆ Redo()

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

Calls Execute by default.

Reimplemented in DekiEditor::CompoundCommand.

◆ CanMerge()

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

Whether other can be folded into this command.

◆ Merge()

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

Folds other into this command.

◆ ReferencesAny()

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

Whether this command holds a raw pointer to anything in dead.

CommandHistory asks this when the scene is about to free objects and discards any command that answers true, since Undo()/Redo() on a freed target is a use-after-free.

The default, false, is right for commands that address their target by value or by id. Any command storing a Deki::Object*, Deki::Component* or Scene* MUST override this; see src/core/commands/ for the pattern.

Reimplemented in DekiEditor::CompoundCommand.


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