[olympic/studio] Move UndoCommand to its own file

This commit is contained in:
Gary Talent 2024-05-02 22:09:35 -05:00
parent acd93337d4
commit cdbc2d6cc8
3 changed files with 22 additions and 10 deletions

View File

@ -13,5 +13,6 @@
#include <studio/popup.hpp> #include <studio/popup.hpp>
#include <studio/project.hpp> #include <studio/project.hpp>
#include <studio/task.hpp> #include <studio/task.hpp>
#include <studio/undocommand.hpp>
#include <studio/undostack.hpp> #include <studio/undostack.hpp>
#include <studio/widget.hpp> #include <studio/widget.hpp>

View File

@ -0,0 +1,19 @@
/*
* Copyright 2016 - 2024 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#pragma once
namespace studio {
class UndoCommand {
public:
virtual ~UndoCommand() noexcept = default;
virtual void redo() noexcept = 0;
virtual void undo() noexcept = 0;
[[nodiscard]]
virtual int commandId() const noexcept = 0;
virtual bool mergeWith(UndoCommand const*cmd) noexcept;
};
}

View File

@ -9,17 +9,9 @@
#include <ox/std/memory.hpp> #include <ox/std/memory.hpp>
#include <ox/std/vector.hpp> #include <ox/std/vector.hpp>
namespace studio { #include "undocommand.hpp"
class UndoCommand { namespace studio {
public:
virtual ~UndoCommand() noexcept = default;
virtual void redo() noexcept = 0;
virtual void undo() noexcept = 0;
[[nodiscard]]
virtual int commandId() const noexcept = 0;
virtual bool mergeWith(UndoCommand const*cmd) noexcept;
};
class UndoStack { class UndoStack {
private: private: