yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::editor::UndoAction Class Referenceabstract

Abstract base for all undoable actions (Command pattern) More...

#include <undo_action.h>

Inherited by yaze::editor::DungeonCustomCollisionAction, yaze::editor::DungeonObjectsAction, yaze::editor::DungeonWaterFillAction, yaze::editor::GraphicsPixelEditAction, yaze::editor::MessageEditAction, yaze::editor::MusicSongEditAction, yaze::editor::OverworldTilePaintAction, and yaze::editor::Tile16EditAction.

Public Member Functions

virtual ~UndoAction ()=default
 
virtual absl::Status Undo ()=0
 
virtual absl::Status Redo ()=0
 
virtual std::string Description () const =0
 Human-readable description (e.g., "Paint 12 tiles on map 5")
 
virtual size_t MemoryUsage () const
 Approximate memory footprint for budget enforcement.
 
virtual bool CanMergeWith (const UndoAction &) const
 
virtual void MergeWith (UndoAction &)
 

Detailed Description

Abstract base for all undoable actions (Command pattern)

Each concrete action captures enough state to undo and redo itself. Actions may optionally merge with previous actions of the same type (e.g., sequential tile paints become a single undo step).

Definition at line 20 of file undo_action.h.

Constructor & Destructor Documentation

◆ ~UndoAction()

virtual yaze::editor::UndoAction::~UndoAction ( )
virtualdefault

Member Function Documentation

◆ Undo()

◆ Redo()

◆ Description()

◆ MemoryUsage()

virtual size_t yaze::editor::UndoAction::MemoryUsage ( ) const
inlinevirtual

◆ CanMergeWith()

virtual bool yaze::editor::UndoAction::CanMergeWith ( const UndoAction & ) const
inlinevirtual

Whether this action can merge with the previous action on the stack. Called only when both actions have the same concrete type.

Reimplemented in yaze::editor::DungeonObjectsAction, yaze::editor::DungeonCustomCollisionAction, yaze::editor::DungeonWaterFillAction, yaze::editor::GraphicsPixelEditAction, yaze::editor::Tile16EditAction, and yaze::editor::OverworldTilePaintAction.

Definition at line 35 of file undo_action.h.

◆ MergeWith()

virtual void yaze::editor::UndoAction::MergeWith ( UndoAction & )
inlinevirtual

Absorb the previous action into this one. Precondition: CanMergeWith(prev) returned true.

Reimplemented in yaze::editor::OverworldTilePaintAction.

Definition at line 39 of file undo_action.h.


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