载入中...
搜索中...
未找到
EditorTransactions.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
6
7#include <memory>
8#include <string>
9
10namespace eve::editor {
11
14public:
16 [[nodiscard]] eve::Result<TransactionId> beginTransaction(TransactionSpec specification);
18 [[nodiscard]] eve::Result<TransactionId> beginTransaction(std::string label);
20 [[nodiscard]] eve::Result<void> append(std::unique_ptr<IEditCommand> command);
22 [[nodiscard]] eve::Result<EditorTransactionRecord> commitTransaction();
24 [[nodiscard]] eve::Result<void> rollbackTransaction();
26 [[nodiscard]] eve::Result<EditorTransactionRecord> undoTransaction();
28 [[nodiscard]] eve::Result<EditorTransactionRecord> redoTransaction();
29
31 bool begin(const std::string &name);
33 bool execute(std::unique_ptr<IEditCommand> command);
35 bool commit();
37 bool rollback();
39 bool undo();
41 bool redo();
43 void clear();
45 bool isActive() const { return consumer_.active(); }
47 bool canUndo() const { return consumer_.canUndo(); }
49 bool canRedo() const { return consumer_.canRedo(); }
51 int undoCount() const { return static_cast<int>(consumer_.undoCount()); }
53 int redoCount() const { return static_cast<int>(consumer_.redoCount()); }
54
55private:
57};
58
59} // namespace eve::editor
std::string label
#define EVENGINE_API_ORCHESTRATION
Definition Export.h:111
std::string name
float begin
Move-only operation result carrying either a value or Status.
Definition Result.h:155
Editor consumer of the common transaction participant/coordinator protocol.
Executes, groups, rolls back and replays arbitrary edit commands.
bool isActive() const
True when active.
TransactionSpec public API.