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 &) |
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.
|
virtualdefault |
|
pure virtual |
Implemented in yaze::editor::DungeonObjectsAction, yaze::editor::DungeonCustomCollisionAction, yaze::editor::DungeonWaterFillAction, yaze::editor::GraphicsPixelEditAction, yaze::editor::MessageEditAction, yaze::editor::MusicSongEditAction, yaze::editor::OverworldTilePaintAction, and yaze::editor::Tile16EditAction.
|
pure virtual |
Implemented in yaze::editor::DungeonObjectsAction, yaze::editor::DungeonCustomCollisionAction, yaze::editor::DungeonWaterFillAction, yaze::editor::GraphicsPixelEditAction, yaze::editor::MessageEditAction, yaze::editor::MusicSongEditAction, yaze::editor::OverworldTilePaintAction, and yaze::editor::Tile16EditAction.
|
pure virtual |
Human-readable description (e.g., "Paint 12 tiles on map 5")
Implemented in yaze::editor::DungeonObjectsAction, yaze::editor::DungeonCustomCollisionAction, yaze::editor::DungeonWaterFillAction, yaze::editor::GraphicsPixelEditAction, yaze::editor::MessageEditAction, yaze::editor::MusicSongEditAction, yaze::editor::OverworldTilePaintAction, and yaze::editor::Tile16EditAction.
|
inlinevirtual |
Approximate memory footprint for budget enforcement.
Reimplemented in yaze::editor::DungeonObjectsAction, yaze::editor::DungeonCustomCollisionAction, yaze::editor::DungeonWaterFillAction, yaze::editor::GraphicsPixelEditAction, yaze::editor::MessageEditAction, yaze::editor::MusicSongEditAction, yaze::editor::OverworldTilePaintAction, and yaze::editor::Tile16EditAction.
Definition at line 31 of file undo_action.h.
|
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.
|
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.