载入中...
搜索中...
未找到
EditorScriptProjection.h
浏览该文件的文档.
42[[nodiscard]] inline ssq::Table project(HSQUIRRELVM vm, const eve::Result<T>& result, Value value) {
57[[nodiscard]] inline ssq::Table bindingFailure(HSQUIRRELVM vm, const char* source, DiagnosticCode code,
61 vm, Status::failure(Diagnostic::error(code, std::move(message), std::move(path), {}, source ? source : "")));
72[[nodiscard]] inline ssq::Table projectHistoryRevision(HSQUIRRELVM vm, const eve::Result<T>& result) {
86[[nodiscard]] inline ssq::Table projectOwnedInstance(HSQUIRRELVM vm, std::unique_ptr<T> instance) {
107[[nodiscard]] inline ssq::Table projectOwnedCreate(HSQUIRRELVM vm, const char* source, std::string emptyIdMessage,
111 return bindingFailure(vm, source, DiagnosticCode::InvalidArgument, std::move(emptyIdMessage), "targetId");
197 [[nodiscard]] ssq::Table checked(bool ready, std::string nullMessage, Fn&& fn, std::string path = {}) const {
198 if (!ready) return fail(DiagnosticCode::InvalidArgument, std::move(nullMessage), std::move(path));
244 [[nodiscard]] ssq::Table ownedCreate(std::string emptyIdMessage, const std::string& targetId) const {
274inline void registerEditorWorkspace(ssq::Class& cls, const ScriptBind& bind, const char* nullMessage) {
275 cls.addFunc("configureWorkspace", [bind, nullMessage](ScriptT* self, EditorWorkspace* workspace) {
290inline void registerDirectEditorWorkspace(ssq::Class& cls, const ScriptBind& bind, const char* nullMessage) {
291 cls.addFunc("configureWorkspace", [bind, nullMessage](EditorT* self, EditorWorkspace* workspace) {
292 return bind.checked(self && workspace, nullMessage, [&] { return self->configureWorkspace(*workspace); });
306inline void registerEditorHistory(ssq::Class& cls, const ScriptBind& bind, const char* nullMessage) {
328inline void registerEditorOwnedCreate(ssq::Class& moduleClass, const ScriptBind& bind, const char* emptyIdMessage) {
Move-only, checked operation results for the common layer.
Per-translation-unit VM + diagnostic-source helper for Squirrel bindings.
The single Squirrel projection for common Result, Status and Value.
Explicit Value/Owned/Borrowed semantics at the Squirrel boundary.
Owning, renderer-independent dynamic values.
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={}, DiagnosticDetails details={}, std::string source={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.h:125
const T & value() const &
Borrow the value from a const lvalue after checking success.
Definition Result.h:308
bool ok() const noexcept
Whether this result represents a non-failure outcome.
Definition Result.h:255
const Status & status() const noexcept
Inspect the structured operation status.
Definition Result.h:269
static Status failure(StatusCode code, Diagnostic diagnostic)
Construct a failed status with one diagnostic.
Definition Status.h:84
static Status success(StatusCode code=StatusCode::Ok)
Construct a successful status with an explicit non-error outcome.
Definition Status.h:81
Composition model shared by project-specific developer and runtime editors.
Definition EditorWorkspace.h:43
Editor facade binder: common script::BindContext plus history/owned-create helpers.
Definition EditorScriptProjection.h:135
ssq::Table history(T *self, std::string nullMessage, Fn &&fn) const
Null-self guard then project a history mutation that exposes afterRevision.
Definition EditorScriptProjection.h:229
constexpr const script::BindContext & context() const noexcept
Underlying common binder (VM + source + fail/checked).
Definition EditorScriptProjection.h:152
ssq::Table ownedCreate(std::string emptyIdMessage, const std::string &targetId) const
Create T(targetId) and project it as an owned script Result.
Definition EditorScriptProjection.h:244
ssq::Table ownedInstance(std::unique_ptr< T > instance) const
Project an already-built instance as an owned script Result.
Definition EditorScriptProjection.h:256
constexpr HSQUIRRELVM vm() const noexcept
Active Squirrel VM handle.
Definition EditorScriptProjection.h:163
constexpr const char * source() const noexcept
Diagnostic source tag for this binder.
Definition EditorScriptProjection.h:174
ssq::Table fail(DiagnosticCode code, std::string message, std::string path={}) const
Project a binding-layer argument failure.
Definition EditorScriptProjection.h:183
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.
Definition EditorScriptProjection.h:214
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.
Definition EditorScriptProjection.h:197
constexpr ScriptBind(HSQUIRRELVM vm, const char *source) noexcept
Construct a binder for one expose() translation unit.
Definition EditorScriptProjection.h:144
Pins the active VM and a stable diagnostic source for one expose() TU.
Definition SquirrelBindContext.h:32
ssq::Table fail(DiagnosticCode code, std::string message, std::string path={}) const
Project a binding-layer argument failure.
Definition SquirrelBindContext.h:67
constexpr const char * source() const noexcept
Diagnostic source tag for this binder.
Definition SquirrelBindContext.h:58
constexpr HSQUIRRELVM vm() const noexcept
Active Squirrel VM handle.
Definition SquirrelBindContext.h:49
Definition ActionPreviewController.cpp:6
void registerDirectEditorWorkspace(ssq::Class &cls, const ScriptBind &bind, const char *nullMessage)
Register configureWorkspace when the script class is the editor (no .editor()).
Definition EditorScriptProjection.h:290
void registerEditorOwnedCreate(ssq::Class &moduleClass, const ScriptBind &bind, const char *emptyIdMessage)
Register module create(targetId) that builds an owned Script* wrapper.
Definition EditorScriptProjection.h:328
ssq::Table projectHistoryRevision(HSQUIRRELVM vm, const eve::Result< T > &result)
Project an undo/redo (or similar) result whose payload exposes afterRevision.
Definition EditorScriptProjection.h:72
ssq::Table projectOwnedInstance(HSQUIRRELVM vm, std::unique_ptr< T > instance)
Wrap an already-built owned C++ instance as a script Result {value, ownership}.
Definition EditorScriptProjection.h:86
void registerEditorWorkspace(ssq::Class &cls, const ScriptBind &bind, const char *nullMessage)
Register configureWorkspace for a Script* wrapper that exposes editor().
Definition EditorScriptProjection.h:274
void registerEditorHistory(ssq::Class &cls, const ScriptBind &bind, const char *nullMessage)
Register shared undo, redo, canUndo, canRedo, and getRevision methods.
Definition EditorScriptProjection.h:306
ssq::Table projectOwnedCreate(HSQUIRRELVM vm, const char *source, std::string emptyIdMessage, const std::string &targetId)
Create a target-id editor wrapper and project it as an owned script Result.
Definition EditorScriptProjection.h:107
ssq::Table project(HSQUIRRELVM vm, const eve::Result< void > &result)
Project a completed editing result that has no payload.
Definition EditorScriptProjection.h:28
auto addScriptClass(ssq::Table &table, const char *name)
Register a script class whose default constructor returns null (factory-only types).
Definition EditorScriptProjection.h:124
ssq::Table bindingFailure(HSQUIRRELVM vm, const char *source, DiagnosticCode code, std::string message, std::string path={})
Project a binding-layer argument failure with a stable diagnostic source.
Definition EditorScriptProjection.h:57
ssq::Table projectStatusResult(HSQUIRRELVM vm, const Status &status)
Project a checked native status that carries no payload.
Definition SquirrelBinding.cpp:454
@ InvalidArgument
@ Applied