[studio] Add NoChangeException
This commit is contained in:
parent
c47f48eba7
commit
6971c3109a
@ -134,11 +134,13 @@ class Editor: public studio::BaseEditor {
|
|||||||
void pushCommand(ox::UPtr<UndoCommand> &&cmd) noexcept;
|
void pushCommand(ox::UPtr<UndoCommand> &&cmd) noexcept;
|
||||||
|
|
||||||
template<typename UC, typename ...Args>
|
template<typename UC, typename ...Args>
|
||||||
void pushCommand(Args&&... args) noexcept {
|
bool pushCommand(Args&&... args) noexcept {
|
||||||
try {
|
try {
|
||||||
m_undoStack.push(ox::make_unique<UC>(ox::forward<Args>(args)...));
|
m_undoStack.push(ox::make_unique<UC>(ox::forward<Args>(args)...));
|
||||||
|
return true;
|
||||||
} catch (ox::Exception const&ex) {
|
} catch (ox::Exception const&ex) {
|
||||||
oxLogError(ex.toError());
|
oxLogError(ex.toError());
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,8 +4,15 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <ox/std/error.hpp>
|
||||||
|
|
||||||
namespace studio {
|
namespace studio {
|
||||||
|
|
||||||
|
class NoChangesException: public ox::Exception {
|
||||||
|
public:
|
||||||
|
inline NoChangesException(): ox::Exception(OxError(1, "Command makes no changes.")) {}
|
||||||
|
};
|
||||||
|
|
||||||
class UndoCommand {
|
class UndoCommand {
|
||||||
public:
|
public:
|
||||||
virtual ~UndoCommand() noexcept = default;
|
virtual ~UndoCommand() noexcept = default;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user