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()
|
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 (typically a file-scopekBindingSourcestring literal).
在文件 EditorScriptProjection.h 第 144 行定义.
成员函数说明
◆ checked() [1/2]
|
inline |
Run fn and project its Result when ready; otherwise emit InvalidArgument.
- 参数
-
ready Guard condition (typically self != nullptr).nullMessage Failure text when the guard fails. fn Invoked only when ready; must return a projectable eve::Result.path Optional argument path for the failure diagnostic.
- 返回
- Projected success/failure table.
Checked.
Project.
在文件 EditorScriptProjection.h 第 197 行定义.
被这些函数引用 eve::editor::registerDirectEditorWorkspace() , 以及 eve::editor::registerEditorWorkspace().
◆ checked() [2/2]
|
inline |
Null-self guard then project a void/Result<void> editor 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.
在文件 EditorScriptProjection.h 第 214 行定义.
◆ context()
|
inlineconstexprnoexcept |
Underlying common binder (VM + source + fail/checked).
- 返回
- Borrowed view of the embedded
script::BindContext. @ownership Borrowed from thisScriptBind; valid for this object's lifetime. @lifetime Same as this binder.
在文件 EditorScriptProjection.h 第 152 行定义.
◆ 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.
在文件 EditorScriptProjection.h 第 183 行定义.
被这些函数引用 history().
◆ history()
|
inline |
Null-self guard then project a history mutation that exposes afterRevision.
- 模板参数
-
T Script wrapper pointer type.
- 参数
-
self Nullable thisfrom SimpleSquirrel.nullMessage Failure text when selfis null.fn Invoked 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()
|
inline |
Create T(targetId) and project it as an owned script Result.
- 模板参数
-
T Script wrapper constructed from target id.
- 参数
-
emptyIdMessage Failure text for an empty target id. targetId Editor target / catalog id.
- 返回
- Owned create result table.
Owned create.
在文件 EditorScriptProjection.h 第 244 行定义.
◆ ownedInstance()
|
inline |
Project an already-built instance as an owned script Result.
- 模板参数
-
T Script wrapper type.
- 参数
-
instance Ownership transfers on success.
- 返回
- Owned create result table.
Owned instance.
在文件 EditorScriptProjection.h 第 256 行定义.
引用了 vm().
◆ source()
|
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()
|
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().
该类的文档由以下文件生成:
- src/modules/editor/EditorScriptProjection.h