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()
|
inlineconstexprnoexcept |
Construct a binder for one expose() translation unit.
- 参数
-
vm Active Squirrel VM; must remain valid for the binder's lifetime. source Stable diagnostic source tag for this binding file. @ownership sourceis borrowed; it must outlive every use of this binder.
在文件 SquirrelBindContext.h 第 40 行定义.
成员函数说明
◆ checked() [1/2]
|
inline |
Run fn and project its void Result when ready; otherwise fail.
- 参数
-
ready Guard condition (typically self != nullptr).nullMessage Failure text when the guard fails. fn Invoked only when ready; must return eve::Result<void>(or convertible).path Optional argument path for the failure diagnostic.
- 返回
- Projected success/failure table.
Checked.
Project result.
在文件 SquirrelBindContext.h 第 92 行定义.
◆ checked() [2/2]
|
inline |
Null-self guard then project a void Result-producing call.
- 模板参数
-
T Script wrapper pointer type.
- 参数
-
self Nullable thisfrom SimpleSquirrel.nullMessage Failure text when selfis null.fn Invoked only when self is non-null. path Optional argument path.
- 返回
- Projected success/failure table.
Checked.
Checked.
在文件 SquirrelBindContext.h 第 109 行定义.
◆ fail()
|
inline |
Project a binding-layer argument failure.
- 参数
-
code Structured diagnostic code. message Human-readable failure text. path Optional argument path.
- 返回
- The common script result table.
在文件 SquirrelBindContext.h 第 67 行定义.
◆ failInvalid()
|
inline |
Convenience InvalidArgument failure with this binder's source tag.
- 参数
-
message Human-readable failure text. path Optional argument path.
- 返回
- The common script result table.
在文件 SquirrelBindContext.h 第 78 行定义.
◆ source()
|
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()
|
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().
该类的文档由以下文件生成:
- src/engine/common/SquirrelBindContext.h