载入中...
搜索中...
未找到
WorkspacePresentation.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
5
6#include <optional>
7#include <string>
8#include <string_view>
9
10namespace eve::editor {
11
14 std::uint64_t revision = 0;
15 std::string context;
16 bool canUndo = false;
17 bool canRedo = false;
18 bool playing = false;
19};
20
28public:
29 virtual ~IWorkspacePresentationSource() = default;
31 virtual WorkspacePresentationState state() const = 0;
33 virtual PropertySchema schema() const = 0;
35 virtual PropertyReadResult read(const PropertyPath& path) const = 0;
37 [[nodiscard]] virtual Result<void> write(const PropertyPath& path, const EditorValue& value) = 0;
39 [[nodiscard]] virtual Result<void> action(std::string_view id) = 0;
40};
41
50public:
56 void cancel() noexcept;
60 [[nodiscard]] Result<void> action(IWorkspacePresentationSource& source, std::string_view id);
62 bool hasDraft() const noexcept { return draft_.has_value(); }
64 [[nodiscard]] Value snapshot(const IWorkspacePresentationSource& source) const;
65
66private:
67 struct Draft {
70 EditorValue original;
72 };
73 std::optional<Draft> draft_;
74};
75
76} // namespace eve::editor
Duration start
#define EVENGINE_API_ORCHESTRATION
Definition Export.h:111
Snapshot snapshot
std::string action
Definition PlayHost.cpp:118
std::string path
Definition PlayHost.cpp:111
Object::Ptr value
std::string_view source
Move-only operation result carrying either a value or Status.
Definition Result.h:176
The canonical owning dynamic value used by data-facing protocols.
Definition Value.h:31
Dotted property path (layout.size) compared and persisted as text.
Definition EditingIds.h:78
Deterministic owning value tree shared by authoring hosts.
Synchronous adapter for an open domain editor, without UI or domain includes. @ownership Caller owns ...
virtual PropertySchema schema() const =0
Owning schema; field identity is its canonical property path.
virtual WorkspacePresentationState state() const =0
Snapshot of document revision, selection/playhead context and history availability.
virtual PropertyReadResult read(const PropertyPath &path) const =0
Read a field for the current selection without mutation.
virtual Result< void > action(std::string_view id)=0
Execute a domain action, including undo/redo on its sole history backend.
virtual Result< void > write(const PropertyPath &path, const EditorValue &value)=0
Commit one validated field through the domain's existing transaction path.
Shared validation and draft/commit controller used by domain editor UI adapters. @ownership Owns only...
bool hasDraft() const noexcept
Whether an uncommitted draft exists.
PropertyReadResult public API.
EVENGINE_API_PLATFORM public API.
Owning state projection; the bound domain remains the only document/history owner.