Registry and execution gate for UI-, script- and automation-neutral commands. 更多...
#include <EditorCommandService.h>
Public 成员函数 | |
| Result< EditorValue > | registerCommand (CommandDescriptor descriptor, EditorCommandHandler handler, bool replace=false) |
| Register one command. | |
| Result< EditorValue > | registerPlannedCommand (CommandDescriptor descriptor, EditorCommandPlanner planner, EditorCommandPlanExecutor executor, bool replace=false) |
| Register a side-effect-free planner and explicit plan executor. | |
| bool | unregisterCommand (const CommandId &id, const std::string &ownerModule={}) |
| Remove one command, optionally requiring a matching owner. | |
| size_t | unregisterOwner (const std::string &ownerModule) |
| Remove every command registered by a module. | |
| void | clear () |
| Remove all registrations. Primarily useful for isolated tests. | |
| const CommandDescriptor * | find (const CommandId &id) const |
| Return command metadata or nullptr when it is not registered. | |
| bool | supportsPlanning (const CommandId &id) const |
| Return whether the registered command requires plan/commit execution. | |
| std::vector< CommandDescriptor > | commands (const HostProfile &profile) const |
| Return descriptors visible to a host profile. | |
| uint64_t | revision () const |
| Monotonic registry generation changed by registration mutations. | |
| Result< EditorValue > | execute (const CommandId &id, const CommandContext &context, const EditorValue &payload) const |
| Execute a command after payload and profile checks. | |
| Result< CommandPlan > | plan (const CommandRequest &request, const HostProfile &profile) const |
| Produce a side-effect-free plan bound to the target, command generation, payload and source. | |
| Result< TransactionReceipt > | executePlan (const CommandRequest &request, const CommandPlan &plan, const HostProfile &profile) const |
| Execute a plan only when its lifetime, registration, policy and input bindings remain valid. | |
详细描述
Registry and execution gate for UI-, script- and automation-neutral commands.
Registration is intended for module startup on the main thread. Execution is synchronous in this first slice; asynchronous work should return a stable task handle as its EditorValue.
在文件 EditorCommandService.h 第 51 行定义.
成员函数说明
◆ clear()
| void eve::editor::EditorCommandService::clear | ( | ) |
Remove all registrations. Primarily useful for isolated tests.
在文件 EditorCommandService.cpp 第 101 行定义.
◆ commands()
| std::vector< CommandDescriptor > eve::editor::EditorCommandService::commands | ( | const HostProfile & | profile | ) | const |
Return descriptors visible to a host profile.
在文件 EditorCommandService.cpp 第 119 行定义.
引用了 eve::editor::HostProfile::allowsCommand() , 以及 eve::editor::HostProfile::hasFeatures().
◆ execute()
| Result< EditorValue > eve::editor::EditorCommandService::execute | ( | const CommandId & | id, |
| const CommandContext & | context, | ||
| const EditorValue & | payload | ||
| ) | const |
Execute a command after payload and profile checks.
- 参数
-
id Registered command identity. context Captured session, target, source and host profile. payload Structured input value.
- 返回
- Handler result or a structured rejection/failure.
在文件 EditorCommandService.cpp 第 128 行定义.
◆ executePlan()
| Result< TransactionReceipt > eve::editor::EditorCommandService::executePlan | ( | const CommandRequest & | request, |
| const CommandPlan & | plan, | ||
| const HostProfile & | profile | ||
| ) | const |
◆ find()
| const CommandDescriptor * eve::editor::EditorCommandService::find | ( | const CommandId & | id | ) | const |
Return command metadata or nullptr when it is not registered.
在文件 EditorCommandService.cpp 第 107 行定义.
◆ plan()
| Result< CommandPlan > eve::editor::EditorCommandService::plan | ( | const CommandRequest & | request, |
| const HostProfile & | profile | ||
| ) | const |
Produce a side-effect-free plan bound to the target, command generation, payload and source.
在文件 EditorCommandService.cpp 第 154 行定义.
引用了 message, eve::Result< T >::ok(), request, status , 以及 eve::Result< T >::value().
被这些函数引用 executePlan() , 以及 eve::editor::EditorSession::planCommand().
◆ registerCommand()
| Result< EditorValue > eve::editor::EditorCommandService::registerCommand | ( | CommandDescriptor | descriptor, |
| EditorCommandHandler | handler, | ||
| bool | replace = false |
||
| ) |
Register one command.
- 参数
-
descriptor Stable metadata. id and ownerModule must be non-empty. handler Function invoked after host/profile checks. replace True to replace an existing command owned by the same module.
- 返回
- Applied on success, Rejected for invalid or duplicate registration.
在文件 EditorCommandService.cpp 第 39 行定义.
引用了 descriptor, error , 以及 handler.
被这些函数引用 eve::editor::EditorExtensionRegistry::registerCommand().
◆ registerPlannedCommand()
| Result< EditorValue > eve::editor::EditorCommandService::registerPlannedCommand | ( | CommandDescriptor | descriptor, |
| EditorCommandPlanner | planner, | ||
| EditorCommandPlanExecutor | executor, | ||
| bool | replace = false |
||
| ) |
Register a side-effect-free planner and explicit plan executor.
- 参数
-
descriptor Stable command metadata. planner Function that validates and produces a plan. executor Function that commits an accepted plan. replace True to replace the same owner's registration.
- 返回
- Applied on success, otherwise a structured registration error.
在文件 EditorCommandService.cpp 第 59 行定义.
引用了 descriptor , 以及 error.
◆ revision()
|
inline |
Monotonic registry generation changed by registration mutations.
在文件 EditorCommandService.h 第 86 行定义.
◆ supportsPlanning()
| bool eve::editor::EditorCommandService::supportsPlanning | ( | const CommandId & | id | ) | const |
Return whether the registered command requires plan/commit execution.
在文件 EditorCommandService.cpp 第 113 行定义.
◆ unregisterCommand()
| bool eve::editor::EditorCommandService::unregisterCommand | ( | const CommandId & | id, |
| const std::string & | ownerModule = {} |
||
| ) |
Remove one command, optionally requiring a matching owner.
在文件 EditorCommandService.cpp 第 82 行定义.
◆ unregisterOwner()
| size_t eve::editor::EditorCommandService::unregisterOwner | ( | const std::string & | ownerModule | ) |
该类的文档由以下文件生成:
- src/modules/editor/EditorCommandService.h
- src/modules/editor/EditorCommandService.cpp