载入中...
搜索中...
未找到
eve::script::BindContext类 参考

Pins the active VM and a stable diagnostic source for one expose() TU. 更多...

#include <SquirrelBindContext.h>

Public 成员函数

constexpr BindContext (HSQUIRRELVM vm, const char *source) noexcept
 Construct a binder for one expose() translation unit.
 
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.
 
ssq::Table failInvalid (std::string message, std::string path={}) const
 Convenience InvalidArgument failure with this binder's source tag.
 
template<class Fn >
ssq::Table checked (bool ready, std::string nullMessage, Fn &&fn, std::string path={}) const
 Run fn and project its void Result when ready; otherwise fail.
 
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-producing call.
 

详细描述

Pins the active VM and a stable diagnostic source for one expose() TU.

@ownership source is borrowed; it must outlive every use of this binder (typically a file-scope kBindingSource string literal). @lifetime Valid while the owning Runtime/VM remains alive and this binder is used only on the VM's owning thread.

在文件 SquirrelBindContext.h 第 32 行定义.

构造及析构函数说明

◆ BindContext()

constexpr eve::script::BindContext::BindContext ( 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.

在文件 SquirrelBindContext.h 第 40 行定义.

成员函数说明

◆ checked() [1/2]

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

Run fn and project its void Result when ready; otherwise fail.

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

Checked.

Project result.

在文件 SquirrelBindContext.h 第 92 行定义.

◆ checked() [2/2]

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

Null-self guard then project a void Result-producing 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.

在文件 SquirrelBindContext.h 第 109 行定义.

◆ fail()

ssq::Table eve::script::BindContext::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.

在文件 SquirrelBindContext.h 第 67 行定义.

◆ failInvalid()

ssq::Table eve::script::BindContext::failInvalid ( std::string  message,
std::string  path = {} 
) const
inline

Convenience InvalidArgument failure with this binder's source tag.

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

在文件 SquirrelBindContext.h 第 78 行定义.

◆ source()

constexpr const char * eve::script::BindContext::source ( ) const
inlineconstexprnoexcept

Diagnostic source tag for this binder.

返回
Borrowed C-string pointer to the tag passed at construction. @ownership Borrowed; 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.

在文件 SquirrelBindContext.h 第 58 行定义.

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

◆ vm()

constexpr HSQUIRRELVM eve::script::BindContext::vm ( ) const
inlineconstexprnoexcept

Active Squirrel VM handle.

返回
Borrowed VM pointer stored at construction. @ownership Borrowed; 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.

在文件 SquirrelBindContext.h 第 49 行定义.

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


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