[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;
|
||||
|
||||
template<typename UC, typename ...Args>
|
||||
void pushCommand(Args&&... args) noexcept {
|
||||
bool pushCommand(Args&&... args) noexcept {
|
||||
try {
|
||||
m_undoStack.push(ox::make_unique<UC>(ox::forward<Args>(args)...));
|
||||
return true;
|
||||
} catch (ox::Exception const&ex) {
|
||||
oxLogError(ex.toError());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,8 +4,15 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ox/std/error.hpp>
|
||||
|
||||
namespace studio {
|
||||
|
||||
class NoChangesException: public ox::Exception {
|
||||
public:
|
||||
inline NoChangesException(): ox::Exception(OxError(1, "Command makes no changes.")) {}
|
||||
};
|
||||
|
||||
class UndoCommand {
|
||||
public:
|
||||
virtual ~UndoCommand() noexcept = default;
|
||||
|
Loading…
x
Reference in New Issue
Block a user