载入中...
搜索中...
未找到
ObjectRegistry.cpp
浏览该文件的文档.
78 eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, "UI object class name must not be empty"));
84 eve::Diagnostic::error(eve::DiagnosticCode::Failed, "UI object registry requires an active Runtime"));
98eve::Result<ObjectHandle> ObjectRegistry::registerObject(const std::string& className, const ssq::Object& object,
113 eve::DiagnosticCode::Failed, "UI object registry requires an active Runtime to derive the class"));
118 eve::DiagnosticCode::InvalidArgument, "UI object registry could not derive a script class name"));
138 eve::DiagnosticCode::InvariantViolation, "UI object registry selected an occupied or retired slot"));
192 eve::Diagnostic::error(eve::DiagnosticCode::NotFound, "UI object handle index is outside the registry"));
202 eve::Diagnostic::error(eve::DiagnosticCode::InvariantViolation, "UI object class index is missing"));
Explicit Value/Owned/Borrowed semantics at the Squirrel boundary.
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
static Runtime * runtime()
Active runtime associated with the last expose() call, or nullptr. @ownership Borrowed; the embedding...
Definition Module.cpp:292
void ignore(std::string_view reason={}) const noexcept
Explicitly discard this result after documenting the reason.
Definition Result.h:537
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
constexpr std::optional< RuntimeHandle > nextGeneration() const noexcept
Returns this slot at its next generation.
Definition RuntimeHandle.h:170
static constexpr index_type invalidIndex
Reserved index value shared by all invalid handles.
Definition RuntimeHandle.h:124
static Status success(StatusCode code=StatusCode::Ok)
Construct a successful status with an explicit non-error outcome.
Definition Status.h:81
Releases C++-owned Squirrel roots before Runtime destroys its VM.
Definition SquirrelOwnership.h:108
Reflectable script-object registry backing the database panel.
Definition ObjectRegistry.h:56
eve::Result< ObjectHandle > create(const std::string &className)
Creates a class instance through the active Runtime and registers it.
Definition ObjectRegistry.cpp:75
const ObjectEntry * entry(ObjectHandle handle) const noexcept
Looks up a live entry without transferring ownership.
Definition ObjectRegistry.cpp:277
size_t count(const std::string &className) const
Number of entries of a class.
Definition ObjectRegistry.cpp:289
static ObjectRegistry & instance()
Returns the process-local singleton owned by the UI module.
Definition ObjectRegistry.cpp:45
std::vector< std::string > classNames() const
Class names with at least one entry, sorted.
Definition ObjectRegistry.cpp:258
void clear(const std::string &className)
Removes every entry of a class.
Definition ObjectRegistry.cpp:237
eve::Result< void > unregister(ObjectHandle handle)
Removes a live entry and advances its slot generation.
Definition ObjectRegistry.cpp:183
std::vector< ObjectEntry > entries(const std::string &className) const
Entries of a class, in registration order.
Definition ObjectRegistry.cpp:265
eve::Result< ObjectHandle > registerObject(const std::string &className, const ssq::Object &object, const std::string &label={})
Registers an existing live script instance.
Definition ObjectRegistry.cpp:98
~ObjectRegistry()
Releases remaining roots, or abandons them if the Runtime VM is gone.
Definition ObjectRegistry.cpp:51
bool isStale(ObjectHandle handle) const noexcept
Reports whether a valid handle is stale in this registry.
Definition ObjectRegistry.cpp:283
eve::Result< OwnedSquirrelObject > ownSquirrelObject(BorrowedSquirrelObject borrowed)
Promotes a borrowed VM object to an explicit rooted owner.
Definition SquirrelOwnership.h:160
BorrowedSquirrelObject borrowSquirrelObject(const ssq::Object &object) noexcept
Creates a one-call Borrowed view without retaining a VM reference.
Definition SquirrelOwnership.h:98
Definition Component.cpp:5
eve::RuntimeHandle< UiObjectHandleTag > ObjectHandle
Generation-qualified identity for one live UI database object.
Definition ObjectRegistry.h:28
@ InvalidArgument
@ NotFound
@ InvariantViolation
@ Failed
@ StaleHandle
@ Applied
ssq::Object object
Rooted script instance owned by the registry while live.
Definition ObjectRegistry.h:39
ObjectHandle handle
Generation-qualified handle for the live registry slot.
Definition ObjectRegistry.h:33