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

Editor facade binder: common script::BindContext plus history/owned-create helpers. 更多...

#include <EditorScriptProjection.h>

Public 成员函数

constexpr ScriptBind (HSQUIRRELVM vm, const char *source) noexcept
 Construct a binder for one expose() translation unit.
 
constexpr const script::BindContext & context () const noexcept
 Underlying common binder (VM + source + fail/checked).
 
constexpr HSQUIRRELVM vm () const noexcept
 Active Squirrel VM handle.
 
constexpr const char * source () const noexcept
 Diagnostic source tag for this binder.
 
ssq::Table fail (DiagnosticCode code, std::string message, std::string path={}) const
 Project a binding-layer argument failure.
 
template<class Fn >
ssq::Table checked (bool ready, std::string nullMessage, Fn &&fn, std::string path={}) const
 Run fn and project its Result when ready; otherwise emit InvalidArgument.
 
template<class T , class Fn >
ssq::Table checked (T *self, std::string nullMessage, Fn &&fn, std::string path={}) const
 Null-self guard then project a void/Result<void> editor call.
 
template<class T , class Fn >
ssq::Table history (T *self, std::string nullMessage, Fn &&fn) const
 Null-self guard then project a history mutation that exposes afterRevision.
 
template<class T >
ssq::Table ownedCreate (std::string emptyIdMessage, const std::string &targetId) const
 Create T(targetId) and project it as an owned script Result.
 
template<class T >
ssq::Table ownedInstance (std::unique_ptr< T > instance) const
 Project an already-built instance as an owned script Result.
 

详细描述

Editor facade binder: common script::BindContext plus history/owned-create helpers.

Use this instead of copying bindingFailure / null-self / owned-create stamps into every *EditorScriptBindings.cpp. Public addFunc names and arities stay unchanged. Non-editor domains should prefer eve::script::BindContext directly.

在文件 EditorScriptProjection.h 第 135 行定义.

构造及析构函数说明

◆ ScriptBind()

constexpr eve::editor::ScriptBind::ScriptBind ( HSQUIRRELVM  vm,
const char *  source 
)
inlineconstexprnoexcept

Construct a binder for one expose() translation unit.

参数
vmActive Squirrel VM; must remain valid for the binder's lifetime.
sourceStable diagnostic source tag for this binding file. @ownership source is borrowed; it must outlive every use of this binder (typically a file-scope kBindingSource string literal).

在文件 EditorScriptProjection.h 第 144 行定义.

成员函数说明

◆ checked() [1/2]

template<class Fn >
ssq::Table eve::editor::ScriptBind::checked ( bool  ready,
std::string  nullMessage,
Fn &&  fn,
std::string  path = {} 
) const
inline

Run fn and project its Result when ready; otherwise emit InvalidArgument.

参数
readyGuard condition (typically self != nullptr).
nullMessageFailure text when the guard fails.
fnInvoked only when ready; must return a projectable eve::Result.
pathOptional argument path for the failure diagnostic.
返回
Projected success/failure table.

Checked.

Project.

在文件 EditorScriptProjection.h 第 197 行定义.

被这些函数引用 eve::editor::registerDirectEditorWorkspace() , 以及 eve::editor::registerEditorWorkspace().

◆ checked() [2/2]

template<class T , class Fn >
ssq::Table eve::editor::ScriptBind::checked ( T *  self,
std::string  nullMessage,
Fn &&  fn,
std::string  path = {} 
) const
inline

Null-self guard then project a void/Result<void> editor call.

模板参数
TScript wrapper pointer type.
参数
selfNullable this from SimpleSquirrel.
nullMessageFailure text when self is null.
fnInvoked only when self is non-null.
pathOptional argument path.
返回
Projected success/failure table.

Checked.

Checked.

在文件 EditorScriptProjection.h 第 214 行定义.

◆ context()

constexpr const script::BindContext & eve::editor::ScriptBind::context ( ) const
inlineconstexprnoexcept

Underlying common binder (VM + source + fail/checked).

返回
Borrowed view of the embedded script::BindContext. @ownership Borrowed from this ScriptBind; valid for this object's lifetime. @lifetime Same as this binder.

在文件 EditorScriptProjection.h 第 152 行定义.

◆ fail()

ssq::Table eve::editor::ScriptBind::fail ( DiagnosticCode  code,
std::string  message,
std::string  path = {} 
) const
inline

Project a binding-layer argument failure.

参数
codeStructured diagnostic code.
messageHuman-readable failure text.
pathOptional argument path.
返回
The common script result table.

在文件 EditorScriptProjection.h 第 183 行定义.

被这些函数引用 history().

◆ history()

template<class T , class Fn >
ssq::Table eve::editor::ScriptBind::history ( T *  self,
std::string  nullMessage,
Fn &&  fn 
) const
inline

Null-self guard then project a history mutation that exposes afterRevision.

模板参数
TScript wrapper pointer type.
参数
selfNullable this from SimpleSquirrel.
nullMessageFailure text when self is null.
fnInvoked only when self is non-null; return type must provide afterRevision.
返回
Projected result with revision payload on success.

History.

Project history revision.

在文件 EditorScriptProjection.h 第 229 行定义.

引用了 fail(), fn, eve::InvalidArgument, eve::editor::projectHistoryRevision() , 以及 vm().

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

◆ ownedCreate()

template<class T >
ssq::Table eve::editor::ScriptBind::ownedCreate ( std::string  emptyIdMessage,
const std::string &  targetId 
) const
inline

Create T(targetId) and project it as an owned script Result.

模板参数
TScript wrapper constructed from target id.
参数
emptyIdMessageFailure text for an empty target id.
targetIdEditor target / catalog id.
返回
Owned create result table.

Owned create.

在文件 EditorScriptProjection.h 第 244 行定义.

引用了 source(), targetId , 以及 vm().

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

◆ ownedInstance()

template<class T >
ssq::Table eve::editor::ScriptBind::ownedInstance ( std::unique_ptr< T >  instance) const
inline

Project an already-built instance as an owned script Result.

模板参数
TScript wrapper type.
参数
instanceOwnership transfers on success.
返回
Owned create result table.

Owned instance.

在文件 EditorScriptProjection.h 第 256 行定义.

引用了 vm().

◆ source()

constexpr const char * eve::editor::ScriptBind::source ( ) const
inlineconstexprnoexcept

Diagnostic source tag for this binder.

返回
Borrowed C-string pointer to the tag passed at construction. @ownership Borrowed from the caller that constructed this binder; callers must not free or modify the returned text. @nullable Yes, when constructed with a null source. @lifetime Valid for at least as long as this binder; typically a file-scope string literal that outlives the process.

在文件 EditorScriptProjection.h 第 174 行定义.

引用了 eve::script::BindContext::source().

被这些函数引用 ownedCreate().

◆ vm()

constexpr HSQUIRRELVM eve::editor::ScriptBind::vm ( ) const
inlineconstexprnoexcept

Active Squirrel VM handle.

返回
Borrowed VM pointer stored at construction. @ownership Borrowed from the caller that constructed this binder; this accessor never retains or frees the VM. @nullable Yes, when constructed with a null VM. @lifetime Valid while the owning Runtime/VM remains alive and this binder is used only on the VM's owning thread.

在文件 EditorScriptProjection.h 第 163 行定义.

引用了 eve::script::BindContext::vm().

被这些函数引用 history(), ownedCreate() , 以及 ownedInstance().


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