载入中...
搜索中...
未找到
EditorDocumentService.cpp
浏览该文件的文档.
17 return eve::editing::failed<StoredDocument>(EditorStatus::NotFound, RuleId("editor.document.store-not-found"),
28 const std::string currentHash = found == documents_.end() ? std::string{} : found->second.contentHash;
30 return eve::editing::failed<StoredDocument>(EditorStatus::Conflict, RuleId("editor.document.disk-conflict"),
40Result<DocumentSnapshot> DocumentService::open(DocumentKey key, std::string title, std::string resourceUri,
87 return eve::editing::failed<SaveTicket>(EditorStatus::NotFound, RuleId("editor.document.not-open"),
127 return eve::editing::failed<EditorValue>(EditorStatus::NotFound, RuleId("editor.document.not-open"),
146 [](const DocumentSnapshot& left, const DocumentSnapshot& right) { return left.id < right.id; });
154Result<DocumentSnapshot> DocumentService::reconcileExternal(const DocumentId& document, ContentValidator validator) {
156 if (found == open_.end()) return error(EditorStatus::NotFound, "editor.document.not-open", "Document is not open");
165 stored.code() == EditorStatus::NotFound || stored.code() == EditorStatus::Conflict ? DocumentState::Conflict
170 eve::editing::ruleDiagnostic(eve::DiagnosticCode::NotFound, RuleId("editor.document.external-missing"),
173 found->second.snapshot.state == DocumentState::Conflict ? EditorStatus::Conflict : stored.code();
174 return Result<DocumentSnapshot>::failure(eve::Status(status, found->second.snapshot.diagnostics));
189 eve::DiagnosticCode::Conflict, RuleId("editor.document.external-conflict"), DiagnosticSeverity::Error,
228Result<DocumentSnapshot> DocumentService::error(EditorStatus status, const char* rule, std::string message) {
260 static const std::set<std::string> layouts{"cubemap", "horizontal-cross", "vertical-cross", "equirectangular"};
261 if (!layout || !layouts.contains(*layout) || !width || !height || *width <= 0 || *height <= 0) {
264 DiagnosticSeverity::Error, "Environment map requires supported layout and positive dimensions"));
288 std::any_of(result.diagnostics.begin(), result.diagnostics.end(), [](const EditorDiagnostic& diagnostic) {
292 if (error) return Result<EnvironmentAssetCard>::failure(eve::Status(EditorStatus::Rejected, result.diagnostics));
296Result<EnvironmentAssetPage> EnvironmentAssetBrowser::query(std::string text, std::size_t offset, std::size_t limit,
380Result<std::uint64_t> EditorEventTimeline::append(EditorTimelineEvent event, std::size_t maximumPayloadNodes) {
383 return eve::editing::failed<std::uint64_t>(EditorStatus::Rejected, RuleId("editor.timeline.invalid-event"),
389 return eve::editing::failed<std::uint64_t>(EditorStatus::Conflict, RuleId("editor.timeline.sequence"),
403Result<EditorTimelinePage> EditorEventTimeline::query(const EditorTimelineQuery& filter, std::size_t offset,
407 return eve::editing::failed<EditorTimelinePage>(EditorStatus::Rejected, RuleId("editor.timeline.page-size"),
411 EditorStatus::Conflict, RuleId("editor.timeline.stale-generation"), "Timeline changed while paging");
446 return invalid("editor.extension.missing-command-service", "Extension registry has no command service");
448 if (owner.empty()) return invalid("editor.extension.missing-owner", "Game editor extension owner is required");
453 return invalid("editor.extension.duplicate-owner", "Game editor extension owner is already loaded");
490std::vector<ExtensionToolDescriptor> EditorExtensionRegistry::tools(const HostProfile& profile) const {
498std::vector<ExtensionPaletteDescriptor> EditorExtensionRegistry::palettes(const HostProfile& profile) const {
506std::vector<ExtensionRuleDescriptor> EditorExtensionRegistry::rules(const HostProfile& profile) const {
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
UUID-backed identifier adapter for legacy textual boundaries.
Definition Identity.h:313
const std::string & value() const noexcept
Returns the exact legacy or canonical compatibility spelling.
Definition Identity.h:365
bool empty() const noexcept
True when no compatibility spelling has been assigned.
Definition Identity.h:377
Deterministic owning value tree shared by authoring hosts.
Definition EditingValue.h:23
std::function< Result< void >(const EditorValue &)> ContentValidator
Synchronous content validator borrowed only for one external reconciliation call.
Definition EditorDocumentService.h:121
Result< DocumentSnapshot > reconcileExternal(const DocumentId &document)
Reconcile one open document with the latest store value. Clean documents adopt external content; dirt...
Definition EditorDocumentService.cpp:150
Result< DocumentSnapshot > edit(const DocumentId &document, EditorValue content, std::optional< Revision > expectedRevision=std::nullopt)
Replace the working content using an optional expected edit revision.
Definition EditorDocumentService.cpp:71
Result< DocumentSnapshot > snapshot(const DocumentId &document) const
Return one metadata snapshot.
Definition EditorDocumentService.cpp:132
Result< DocumentSnapshot > executeSave(const SaveTicket &ticket)
Execute a captured save ticket without reading newer working content.
Definition EditorDocumentService.cpp:99
std::vector< DocumentSnapshot > documents() const
Return all open documents in stable id order.
Definition EditorDocumentService.cpp:138
Result< EditorValue > content(const DocumentId &document) const
Return the current working content snapshot.
Definition EditorDocumentService.cpp:124
Result< SaveTicket > requestSave(const DocumentId &document)
Capture an exact content/revision pair for a later CAS save.
Definition EditorDocumentService.cpp:84
Result< void > close(const DocumentId &document)
Close and discard in-memory state; persisted content is unchanged.
Definition EditorDocumentService.cpp:220
Result< DocumentSnapshot > open(DocumentKey key, std::string title, std::string resourceUri, EditorValue initialContent={})
Open an asset-backed document, loading existing persisted content when present.
Definition EditorDocumentService.cpp:40
size_t unregisterOwner(const std::string &ownerModule)
Remove every command registered by a module.
Definition EditorAssetDatabase.cpp:306
Result< EditorValue > registerCommand(CommandDescriptor descriptor, EditorCommandHandler handler, bool replace=false)
Register one command.
Definition EditorAssetDatabase.cpp:255
Result< EditorTimelinePage > query(const EditorTimelineQuery &filter, std::size_t offset, std::size_t limit, std::optional< std::uint64_t > generation=std::nullopt) const
Query a deterministic page; stale generations return Conflict.
Definition EditorDocumentService.cpp:403
Result< void > setCapacity(std::size_t capacity)
Set retained event capacity; shrinking drops oldest events.
Definition EditorDocumentService.cpp:367
void clear()
Clear retained events while preserving the next sequence number.
Definition EditorDocumentService.cpp:434
Result< std::uint64_t > append(EditorTimelineEvent event, std::size_t maximumPayloadNodes=10000)
Copy one event, assigning a monotonic sequence when it is zero.
Definition EditorDocumentService.cpp:380
Result< void > registerPalette(ExtensionPaletteDescriptor descriptor) override
Registers palette.
Definition EditorDocumentService.cpp:537
Result< void > load(IGameEditorExtension &extension)
Load one extension under its stable owner module.
Definition EditorDocumentService.cpp:444
std::vector< ExtensionToolDescriptor > tools(const HostProfile &profile) const
Return tool descriptors visible to a host.
Definition EditorDocumentService.cpp:490
Result< EditorValue > registerCommand(CommandDescriptor descriptor, EditorCommandHandler handler, ExtensionAudience audiences) override
Registers command.
Definition EditorDocumentService.cpp:514
std::vector< ExtensionRuleDescriptor > rules(const HostProfile &profile) const
Return validation descriptors visible to a host.
Definition EditorDocumentService.cpp:506
std::vector< ExtensionPaletteDescriptor > palettes(const HostProfile &profile) const
Return palette descriptors visible to a host.
Definition EditorDocumentService.cpp:498
std::size_t unload(const std::string &ownerModule)
Remove every component registered by an owner module.
Definition EditorDocumentService.cpp:470
Result< void > registerRule(ExtensionRuleDescriptor descriptor) override
Registers rule.
Definition EditorDocumentService.cpp:545
Result< void > registerTool(ExtensionToolDescriptor descriptor) override
Registers tool.
Definition EditorDocumentService.cpp:526
void configureProfile(HostProfile &profile) const
Add player/admin/automation extension commands to a deny-by-default profile.
Definition EditorDocumentService.cpp:484
Result< EnvironmentAssetPage > query(std::string text, std::size_t offset, std::size_t limit, std::optional< std::uint64_t > generation=std::nullopt) const
Query deterministic cards; stale index generations return Conflict.
Definition EditorDocumentService.cpp:296
Result< EnvironmentAssetCard > select(const AssetGuid &asset) const
Resolve a selected environment map and reject unusable import metadata.
Definition EditorDocumentService.cpp:318
Upper capability boundary for one editor host.
Definition EditorHostProfile.h:51
virtual Result< StoredDocument > read(const std::string &resourceUri) const =0
Read the latest value for a resource URI.
virtual Result< StoredDocument > compareAndSwap(const std::string &resourceUri, Revision expectedRevision, const std::string &expectedContentHash, const EditorValue &content)=0
Replace a value only when the expected disk revision still matches.
Entry point implemented by a gameplay module to inject editor behavior.
Definition EditorExtension.h:80
Result< AssetRecord > find(const AssetGuid &guid) const
Find one asset by stable GUID.
Definition EditorAssetDatabase.cpp:102
Result< AssetPage< AssetRecord > > query(const AssetQuery &query, std::size_t offset, std::size_t limit, std::optional< std::uint64_t > generation=std::nullopt) const
Query a deterministic page; stale generations return Conflict.
Definition EditorAssetDatabase.cpp:117
Result< StoredDocument > read(const std::string &resourceUri) const override
Reads .
Definition EditorDocumentService.cpp:14
Result< StoredDocument > compareAndSwap(const std::string &resourceUri, Revision expectedRevision, const std::string &expectedContentHash, const EditorValue &content) override
Compare and swap.
Definition EditorDocumentService.cpp:22
const Value * field(const Value &value, const char *key)
Borrow an optional object field.
Definition BuildingSnapshot.cpp:96
Diagnostic ruleDiagnostic(eve::DiagnosticCode code, RuleId rule, DiagnosticSeverity severity, std::string message)
Build an owning common diagnostic carrying an open editing rule identity.
Definition EditingResult.cpp:20
Definition ActionPreviewController.cpp:6
eve::editing::Value EditorValue
Compatibility alias for the UI-independent authoring value tree.
Definition EditorValue.h:8
@ Conflict
constexpr bool hasAudience(ExtensionAudience value, ExtensionAudience audience)
True when audience.
Definition EditorExtension.h:32
std::function< Result< EditorValue >(const CommandContext &, const EditorValue &)> EditorCommandHandler
Definition EditorCommandService.h:48
@ Warning
ExtensionAudience
Host audiences to which a game-provided editor extension may be published.
Definition EditorExtension.h:15
@ Developer
@ Automation
@ InvalidArgument
@ NotFound
@ PreconditionViolation
@ Conflict
Deterministic filter used by headless and UI asset queries.
Definition EditorAssetDatabase.h:52
std::vector< std::string > typeIds
Definition EditorAssetDatabase.h:53
Presentation and execution metadata for a registered command.
Definition EditorCommandService.h:30
Stable document identity; paths are deliberately excluded.
Definition EditorDocumentService.h:33
Immutable document metadata snapshot.
Definition EditorDocumentService.h:53
Immutable normalized runtime event copied into the editor timeline.
Definition EditorEventTimeline.h:15
Generation-qualified timeline query page.
Definition EditorEventTimeline.h:38
std::uint64_t generation
Definition EditorEventTimeline.h:42
Deterministic event filter used by headless and visual presenters.
Definition EditorEventTimeline.h:27
Generation-qualified environment asset browser page.
Definition EditorEnvironmentBrowser.h:23
std::size_t nextOffset
Definition EditorEnvironmentBrowser.h:25
Semantic palette that can place the same tool differently per audience.
Definition EditorExtension.h:47
Discoverable gameplay validation rule registered by a game extension.
Definition EditorExtension.h:57
Host-neutral metadata for a game-provided editor tool.
Definition EditorExtension.h:37
Immutable save request capturing one exact edit revision.
Definition EditorDocumentService.h:69
Revision expectedDiskRevision
Definition EditorDocumentService.h:73
std::string expectedContentHash
Definition EditorDocumentService.h:74
Revision capturedEditRevision
Definition EditorDocumentService.h:72
Value snapshot returned by an atomic document store.
Definition EditorDocumentService.h:78