载入中...
搜索中...
未找到
eve::editor::EditorSession类 参考

Hosts interchangeable editor tools and routes their lifecycle/input. 更多...

#include <EditorSession.h>

Public 成员函数

 EditorSession ()
 Editor session.
 
 ~EditorSession () noexcept
 Editor session.
 
 EditorSession (const EditorSession &)=delete
 
EditorSession & operator= (const EditorSession &)=delete
 
bool addTool (IEditorTool *tool)
 Register a tool. Returns false for null or duplicate id/pointer.
 
bool removeTool (const std::string &id)
 Remove a registered tool by id, deactivating it when necessary.
 
void clearTools ()
 Remove all tools and release any pointer capture.
 
int getToolCount () const
 Returns the tool count.
 
IEditorTool * getTool (int index) const
 Returns the tool.
 
IEditorTool * findTool (const std::string &id) const
 Finds tool.
 
bool activateTool (const std::string &id)
 Activate a registered tool by id. Empty id deactivates all tools.
 
IEditorTool * activeTool () const
 Active tool.
 
std::string activeToolId () const
 Active tool id.
 
ToolResponse dispatchPointer (const EditorPointerEvent &event)
 Route input to the active tool and apply pointer-capture response.
 
ToolResponse dispatchKey (const EditorKeyEvent &event)
 Route keyboard input to the active tool.
 
void update (float dt)
 Update the active tool.
 
void drawOverlay (IEditorOverlay &overlay)
 Ask the active tool to emit viewport feedback.
 
void inspect (IEditorInspector &inspector)
 Ask the active tool to expose its configurable properties.
 
void cancelActiveTool ()
 Cancel its gesture and clear pointer capture.
 
bool hasPointerCapture () const
 True when pointer capture.
 
int capturedPointerId () const
 Captured pointer id.
 
EditorContext & context ()
 Context.
 
const EditorContext & context () const
 Context.
 
void bindTarget (IEditableTarget &target)
 Bind a caller-managed editable target available to every tool callback.
 
void bindTarget (IEditableTarget *target)
 Compatibility-only nullable pointer facade over bindTarget() and clearTarget().
 
void clearTarget ()
 Clear the active target and invalidate retained plans derived from it.
 
IEditableTarget * target () const
 Return the live borrowed target, or null after an explicit or tracked unbind.
 
const TargetId & boundTargetId () const noexcept
 Return the identity of the current binding without dereferencing the target.
 
EditorTransactions & transactions ()
 Transactions.
 
EditConstraintPipeline & constraints ()
 Constraints.
 
bool execute (std::unique_ptr< IEditCommand > command)
 Validate then execute a command in the active transaction.
 
Result< void > executeChecked (std::unique_ptr< IEditCommand > command)
 Validate and execute a command while preserving constraint and transaction diagnostics.
 
void bindCommandService (EditorCommandService &service)
 Bind a non-owning V2 command service that must outlive this binding.
 
void clearCommandService ()
 Clear the V2 command service binding.
 
void setCommandService (EditorCommandService *service)
 Compatibility-only nullable pointer facade over bindCommandService() and clearCommandService().
 
EditorCommandService * commandService () const
 Return the bound V2 command service, or nullptr.
 
void setHostProfile (HostProfile profile)
 Set the host capability boundary used for command discovery and execution.
 
const HostProfile & hostProfile () const
 Return the current host capability boundary.
 
void setSessionId (SessionId id)
 Assign the stable identity included in asynchronous context snapshots.
 
const SessionId & sessionId () const
 Return the stable session identity.
 
EditorContextSnapshot contextSnapshot () const
 Capture target revision and host identity for delayed command work.
 
Result< EditorValue > executeCommand (const CommandId &id, const EditorValue &payload={}, CommandSource source=CommandSource::Api)
 Execute a registered V2 command in this session.
 
Result< CommandPlan > planCommand (const CommandId &id, const EditorValue &payload={}, CommandSource source=CommandSource::Api, std::optional< Revision > expectedRevision=std::nullopt) const
 Plan a registered command without applying target mutations.
 
Result< TransactionReceipt > executePlan (const CommandPlan &plan, const EditorValue &payload={}, CommandSource source=CommandSource::Api)
 Execute a previously returned plan through its registered executor.
 
Result< TransactionReceipt > executeCommandReceipt (const CommandId &id, const EditorValue &payload={}, CommandSource source=CommandSource::Api)
 Execute a legacy-compatible command and return a V2 transaction receipt.
 
std::vector< CommandDescriptor > availableCommands () const
 Return commands visible through this session's host profile.
 
Result< PlanId > retainPlan (const CommandId &id, const EditorValue &payload={}, CommandSource source=CommandSource::Api, std::optional< Revision > expectedRevision=std::nullopt)
 Plan a command and retain its immutable payload under the returned plan id.
 
Result< TransactionReceipt > executeRetainedPlan (const PlanId &id, CommandSource source=CommandSource::Api)
 Execute a retained plan. Successful plans are consumed exactly once.
 
Result< void > cancelRetainedPlan (const PlanId &id)
 Discard one retained plan without executing it.
 
void clearRetainedPlans ()
 Discard all retained plans, for example after replacing a document or target.
 
void setDocumentServices (DocumentService *documents, AutosaveService *autosave=nullptr)
 Bind non-owning persistence services used by the active document.
 
void bindDocumentServices (DocumentService &documents, AutosaveService *autosave=nullptr)
 Bind document services; documents must outlive this binding.
 
void clearDocumentServices ()
 Clear document service bindings and unbind the active document.
 
Result< DocumentSnapshot > bindDocument (const DocumentId &document)
 Select an already-open document for save, autosave and conflict polling.
 
void unbindDocument ()
 Stop coordinating the active document without closing it.
 
const DocumentId & activeDocument () const
 Return the active document identity, or an empty id.
 
Result< DocumentSnapshot > editDocument (EditorValue content, std::optional< Revision > expectedRevision=std::nullopt)
 Replace active working content using optional optimistic edit revision.
 
Result< DocumentSnapshot > saveDocument ()
 Persist the current active revision through the document CAS store.
 
Result< StoredDocument > autosaveDocument ()
 Write the active dirty revision to its separate autosave draft.
 
Result< DocumentSnapshot > pollDocumentChanges ()
 Detect external disk changes, adopting only when the document is clean.
 
void setAutosaveInterval (float seconds)
 Configure draft cadence.
 
void setExternalPollInterval (float seconds)
 Configure external-store polling cadence.
 
Revision lastAutosavedRevision () const
 Last edit revision successfully written to the draft store.
 

友元

class EditorTargetCoordinator
 

详细描述

Hosts interchangeable editor tools and routes their lifecycle/input.

Tools are non-owning: the caller must keep a registered tool alive until it is removed or the session is destroyed. All methods are owner-thread only. Tool callbacks may re-enter the session; lifecycle state is detached before cancellation or deactivation callbacks are invoked.

在文件 EditorSession.h 第 30 行定义.

构造及析构函数说明

◆ EditorSession() [1/2]

eve::editor::EditorSession::EditorSession ( )

Editor session.

在文件 EditorSession.cpp 第 13 行定义.

◆ ~EditorSession()

eve::editor::EditorSession::~EditorSession ( )
noexcept

Editor session.

在文件 EditorSession.cpp 第 364 行定义.

◆ EditorSession() [2/2]

eve::editor::EditorSession::EditorSession ( const EditorSession &  )
delete

成员函数说明

◆ activateTool()

bool eve::editor::EditorSession::activateTool ( const std::string &  id)

Activate a registered tool by id. Empty id deactivates all tools.

在文件 EditorSession.cpp 第 413 行定义.

引用了 eve::editor::IEditorTool::activate() , 以及 findTool().

◆ activeDocument()

const DocumentId & eve::editor::EditorSession::activeDocument ( ) const
inline

Return the active document identity, or an empty id.

在文件 EditorSession.h 第 180 行定义.

◆ activeTool()

IEditorTool * eve::editor::EditorSession::activeTool ( ) const
inline

Active tool.

在文件 EditorSession.h 第 57 行定义.

◆ activeToolId()

std::string eve::editor::EditorSession::activeToolId ( ) const

Active tool id.

在文件 EditorSession.cpp 第 439 行定义.

引用了 eve::editor::IEditorTool::descriptor() , 以及 eve::editor::ToolDescriptor::id.

◆ addTool()

bool eve::editor::EditorSession::addTool ( IEditorTool *  tool)

Register a tool. Returns false for null or duplicate id/pointer.

在文件 EditorSession.cpp 第 375 行定义.

引用了 eve::editor::IEditorTool::descriptor() , 以及 eve::editor::ToolDescriptor::id.

◆ autosaveDocument()

Result< StoredDocument > eve::editor::EditorSession::autosaveDocument ( )

◆ availableCommands()

std::vector< CommandDescriptor > eve::editor::EditorSession::availableCommands ( ) const

Return commands visible through this session's host profile.

在文件 EditorSession.cpp 第 227 行定义.

引用了 eve::editor::EditorCommandService::commands().

◆ bindCommandService()

void eve::editor::EditorSession::bindCommandService ( EditorCommandService &  service)
inline

Bind a non-owning V2 command service that must outlive this binding.

在文件 EditorSession.h 第 106 行定义.

引用了 service.

◆ bindDocument()

Result< DocumentSnapshot > eve::editor::EditorSession::bindDocument ( const DocumentId &  document)

Select an already-open document for save, autosave and conflict polling.

参数
documentStable identity already opened by DocumentService.
返回
Bound document snapshot or a structured lookup failure.

在文件 EditorSession.cpp 第 285 行定义.

引用了 eve::Result< T >::ok(), eve::editor::DocumentService::snapshot() , 以及 eve::Result< T >::value().

◆ bindDocumentServices()

void eve::editor::EditorSession::bindDocumentServices ( DocumentService &  documents,
AutosaveService *  autosave = nullptr 
)

Bind document services; documents must outlive this binding.

在文件 EditorSession.cpp 第 273 行定义.

引用了 unbindDocument().

被这些函数引用 setDocumentServices().

◆ bindTarget() [1/2]

void eve::editor::EditorSession::bindTarget ( IEditableTarget &  target)

Bind a caller-managed editable target available to every tool callback.

参数
targetBorrowed target; the caller must clear the binding before destroying it. @thread Owner-thread only. Tool callbacks are never invoked by this function.

在文件 EditorSession.cpp 第 45 行定义.

引用了 target() , 以及 eve::editing::IEditableTarget::targetId().

被这些函数引用 bindTarget().

◆ bindTarget() [2/2]

void eve::editor::EditorSession::bindTarget ( IEditableTarget *  target)

Compatibility-only nullable pointer facade over bindTarget() and clearTarget().

在文件 EditorSession.cpp 第 54 行定义.

引用了 bindTarget(), clearTarget() , 以及 target().

◆ boundTargetId()

const TargetId & eve::editor::EditorSession::boundTargetId ( ) const
inlinenoexcept

Return the identity of the current binding without dereferencing the target.

在文件 EditorSession.h 第 95 行定义.

被这些函数引用 eve::editor::EditorAutomationProvider::targetUnregistered().

◆ cancelActiveTool()

void eve::editor::EditorSession::cancelActiveTool ( )

Cancel its gesture and clear pointer capture.

在文件 EditorSession.cpp 第 492 行定义.

引用了 eve::editor::IEditorTool::cancel().

◆ cancelRetainedPlan()

Result< void > eve::editor::EditorSession::cancelRetainedPlan ( const PlanId &  id)

Discard one retained plan without executing it.

在文件 EditorSession.cpp 第 254 行定义.

引用了 found.

被这些函数引用 eve::editor::EditorAutomationProvider::invoke().

◆ capturedPointerId()

int eve::editor::EditorSession::capturedPointerId ( ) const
inline

Captured pointer id.

在文件 EditorSession.h 第 77 行定义.

◆ clearCommandService()

void eve::editor::EditorSession::clearCommandService ( )
inline

Clear the V2 command service binding.

在文件 EditorSession.h 第 108 行定义.

◆ clearDocumentServices()

void eve::editor::EditorSession::clearDocumentServices ( )

Clear document service bindings and unbind the active document.

在文件 EditorSession.cpp 第 279 行定义.

引用了 unbindDocument().

被这些函数引用 setDocumentServices().

◆ clearRetainedPlans()

void eve::editor::EditorSession::clearRetainedPlans ( )

Discard all retained plans, for example after replacing a document or target.

在文件 EditorSession.cpp 第 264 行定义.

被这些函数引用 eve::editor::EditorAutomationProvider::targetUnregistered().

◆ clearTarget()

void eve::editor::EditorSession::clearTarget ( )

Clear the active target and invalidate retained plans derived from it.

在文件 EditorSession.cpp 第 84 行定义.

被这些函数引用 bindTarget() , 以及 eve::editor::EditorAutomationProvider::targetUnregistered().

◆ clearTools()

void eve::editor::EditorSession::clearTools ( )

Remove all tools and release any pointer capture.

在文件 EditorSession.cpp 第 394 行定义.

◆ commandService()

EditorCommandService * eve::editor::EditorSession::commandService ( ) const
inline

Return the bound V2 command service, or nullptr.

在文件 EditorSession.h 第 112 行定义.

◆ constraints()

EditConstraintPipeline & eve::editor::EditorSession::constraints ( )
inline

Constraints.

在文件 EditorSession.h 第 99 行定义.

◆ context() [1/2]

EditorContext & eve::editor::EditorSession::context ( )
inline

Context.

在文件 EditorSession.h 第 79 行定义.

◆ context() [2/2]

const EditorContext & eve::editor::EditorSession::context ( ) const
inline

Context.

在文件 EditorSession.h 第 81 行定义.

◆ contextSnapshot()

EditorContextSnapshot eve::editor::EditorSession::contextSnapshot ( ) const

◆ dispatchKey()

ToolResponse eve::editor::EditorSession::dispatchKey ( const EditorKeyEvent &  event)

Route keyboard input to the active tool.

在文件 EditorSession.cpp 第 459 行定义.

引用了 eve::editor::ToolResponse::ignored() , 以及 eve::editor::IEditorTool::keyEvent().

◆ dispatchPointer()

◆ drawOverlay()

void eve::editor::EditorSession::drawOverlay ( IEditorOverlay &  overlay)

Ask the active tool to emit viewport feedback.

在文件 EditorSession.cpp 第 484 行定义.

引用了 eve::editor::IEditorTool::drawOverlay().

◆ editDocument()

Result< DocumentSnapshot > eve::editor::EditorSession::editDocument ( EditorValue  content,
std::optional< Revision >  expectedRevision = std::nullopt 
)

Replace active working content using optional optimistic edit revision.

参数
contentNew serializable working content.
expectedRevisionOptional edit revision used to reject stale writers.
返回
Updated document snapshot or a structured conflict.

在文件 EditorSession.cpp 第 306 行定义.

引用了 eve::editor::DocumentService::edit() , 以及 eve::UuidIdAdapter< Tag >::empty().

◆ execute()

bool eve::editor::EditorSession::execute ( std::unique_ptr< IEditCommand >  command)

Validate then execute a command in the active transaction.

在文件 EditorSession.cpp 第 30 行定义.

引用了 executeChecked() , 以及 eve::Result< void >::ok().

被这些函数引用 eve::editor::EditorContext::execute().

◆ executeChecked()

Result< void > eve::editor::EditorSession::executeChecked ( std::unique_ptr< IEditCommand >  command)

Validate and execute a command while preserving constraint and transaction diagnostics.

在文件 EditorSession.cpp 第 34 行定义.

引用了 eve::editor::EditorTransactions::append(), eve::Result< T >::diagnostics(), eve::editor::EditConstraintPipeline::evaluateChecked(), eve::Result< T >::ok() , 以及 eve::Result< T >::success().

被这些函数引用 execute() , 以及 eve::editor::EditorContext::executeChecked().

◆ executeCommand()

◆ executeCommandReceipt()

◆ executePlan()

Result< TransactionReceipt > eve::editor::EditorSession::executePlan ( const CommandPlan &  plan,
const EditorValue &  payload = {},
CommandSource  source = CommandSource::Api 
)

◆ executeRetainedPlan()

Result< TransactionReceipt > eve::editor::EditorSession::executeRetainedPlan ( const PlanId &  id,
CommandSource  source = CommandSource::Api 
)

Execute a retained plan. Successful plans are consumed exactly once.

在文件 EditorSession.cpp 第 243 行定义.

引用了 executePlan(), found, eve::Result< T >::ok() , 以及 source.

被这些函数引用 eve::editor::EditorAutomationProvider::invoke().

◆ findTool()

IEditorTool * eve::editor::EditorSession::findTool ( const std::string &  id) const

Finds tool.

在文件 EditorSession.cpp 第 406 行定义.

引用了 id.

被这些函数引用 activateTool().

◆ getTool()

IEditorTool * eve::editor::EditorSession::getTool ( int  index) const

Returns the tool.

在文件 EditorSession.cpp 第 401 行定义.

引用了 index.

◆ getToolCount()

int eve::editor::EditorSession::getToolCount ( ) const

Returns the tool count.

在文件 EditorSession.cpp 第 399 行定义.

◆ hasPointerCapture()

bool eve::editor::EditorSession::hasPointerCapture ( ) const
inline

True when pointer capture.

在文件 EditorSession.h 第 75 行定义.

◆ hostProfile()

const HostProfile & eve::editor::EditorSession::hostProfile ( ) const
inline

Return the current host capability boundary.

在文件 EditorSession.h 第 116 行定义.

◆ inspect()

void eve::editor::EditorSession::inspect ( IEditorInspector &  inspector)

Ask the active tool to expose its configurable properties.

在文件 EditorSession.cpp 第 488 行定义.

引用了 eve::editor::IEditorTool::inspect().

◆ lastAutosavedRevision()

Revision eve::editor::EditorSession::lastAutosavedRevision ( ) const
inline

Last edit revision successfully written to the draft store.

在文件 EditorSession.h 第 200 行定义.

◆ operator=()

EditorSession & eve::editor::EditorSession::operator= ( const EditorSession &  )
delete

◆ planCommand()

Result< CommandPlan > eve::editor::EditorSession::planCommand ( const CommandId &  id,
const EditorValue &  payload = {},
CommandSource  source = CommandSource::Api,
std::optional< Revision >  expectedRevision = std::nullopt 
) const

Plan a registered command without applying target mutations.

在文件 EditorSession.cpp 第 174 行定义.

引用了 contextSnapshot(), id, eve::editing::CommandRequest::id, payload, eve::editor::EditorCommandService::plan(), request , 以及 source.

被这些函数引用 eve::editor::EditorAutomationProvider::invoke() , 以及 retainPlan().

◆ pollDocumentChanges()

Result< DocumentSnapshot > eve::editor::EditorSession::pollDocumentChanges ( )

Detect external disk changes, adopting only when the document is clean.

在文件 EditorSession.cpp 第 349 行定义.

引用了 eve::UuidIdAdapter< Tag >::empty() , 以及 eve::editor::DocumentService::reconcileExternal().

被这些函数引用 update().

◆ removeTool()

bool eve::editor::EditorSession::removeTool ( const std::string &  id)

Remove a registered tool by id, deactivating it when necessary.

在文件 EditorSession.cpp 第 384 行定义.

◆ retainPlan()

Result< PlanId > eve::editor::EditorSession::retainPlan ( const CommandId &  id,
const EditorValue &  payload = {},
CommandSource  source = CommandSource::Api,
std::optional< Revision >  expectedRevision = std::nullopt 
)

Plan a command and retain its immutable payload under the returned plan id.

返回
Stable plan id suitable for script and UI frontends.

在文件 EditorSession.cpp 第 231 行定义.

引用了 eve::Result< T >::failure(), eve::Result< T >::ok(), payload, planCommand(), source, eve::Result< T >::status() , 以及 eve::Result< T >::value().

被这些函数引用 eve::editor::EditorAutomationProvider::invoke().

◆ saveDocument()

Result< DocumentSnapshot > eve::editor::EditorSession::saveDocument ( )

◆ sessionId()

const SessionId & eve::editor::EditorSession::sessionId ( ) const
inline

Return the stable session identity.

在文件 EditorSession.h 第 120 行定义.

◆ setAutosaveInterval()

void eve::editor::EditorSession::setAutosaveInterval ( float  seconds)

Configure draft cadence.

参数
secondsInterval in seconds; zero disables automatic drafts.

在文件 EditorSession.cpp 第 358 行定义.

◆ setCommandService()

void eve::editor::EditorSession::setCommandService ( EditorCommandService *  service)
inline

Compatibility-only nullable pointer facade over bindCommandService() and clearCommandService().

在文件 EditorSession.h 第 110 行定义.

引用了 service.

被这些函数引用 eve::editor::EditorAutomationProvider::EditorAutomationProvider().

◆ setDocumentServices()

void eve::editor::EditorSession::setDocumentServices ( DocumentService *  documents,
AutosaveService *  autosave = nullptr 
)

Bind non-owning persistence services used by the active document.

参数
documentsFormal document coordinator; must outlive the session.
autosaveOptional draft service; must outlive the session.

在文件 EditorSession.cpp 第 266 行定义.

引用了 bindDocumentServices() , 以及 clearDocumentServices().

◆ setExternalPollInterval()

void eve::editor::EditorSession::setExternalPollInterval ( float  seconds)

Configure external-store polling cadence.

参数
secondsInterval in seconds; zero disables polling.

在文件 EditorSession.cpp 第 360 行定义.

◆ setHostProfile()

void eve::editor::EditorSession::setHostProfile ( HostProfile  profile)
inline

Set the host capability boundary used for command discovery and execution.

在文件 EditorSession.h 第 114 行定义.

◆ setSessionId()

void eve::editor::EditorSession::setSessionId ( SessionId  id)
inline

Assign the stable identity included in asynchronous context snapshots.

在文件 EditorSession.h 第 118 行定义.

被这些函数引用 eve::editor::EditorAutomationProvider::EditorAutomationProvider().

◆ target()

IEditableTarget * eve::editor::EditorSession::target ( ) const

Return the live borrowed target, or null after an explicit or tracked unbind.

在文件 EditorSession.cpp 第 107 行定义.

被这些函数引用 bindTarget(), bindTarget(), contextSnapshot(), executeCommand(), executeCommandReceipt() , 以及 eve::editor::EditorContext::target().

◆ transactions()

EditorTransactions & eve::editor::EditorSession::transactions ( )
inline

Transactions.

在文件 EditorSession.h 第 97 行定义.

被这些函数引用 eve::editor::EditorAutomationProvider::invoke() , 以及 eve::editor::EditorContext::transactions().

◆ unbindDocument()

void eve::editor::EditorSession::unbindDocument ( )

Stop coordinating the active document without closing it.

在文件 EditorSession.cpp 第 299 行定义.

被这些函数引用 bindDocumentServices() , 以及 clearDocumentServices().

◆ update()

友元及相关函数文档

◆ EditorTargetCoordinator

friend class EditorTargetCoordinator
friend

在文件 EditorSession.h 第 203 行定义.


该类的文档由以下文件生成: