载入中...
搜索中...
未找到
ReflectedPropertyModel.cpp
浏览该文件的文档.
122 if (sharedCode == "property_access.property.read-only") return "property_access.script.read-only";
148 : runtime_(&runtime), instance_(std::move(instance)), observers_(std::make_shared<ObserverState>()) {
166 descriptor.category = member.attrString("category", ownerClass(*runtime_, schema_.typeId, member.name));
185Value ReflectedPropertyModel::convertValue(const std::string &path, const ReflectedValue &value) const {
232 if (!descriptor) return WriteResult::reject("property_access.script.missing", "Property is not reflected");
245 return WriteResult::reject("property_access.script.write", "Runtime rejected the property write");
257 return WriteResult::reject("property_access.script.write", "Runtime rejected the property write");
268 return WriteResult::reject("property_access.script.write", "Runtime rejected the property write");
275 return WriteResult::reject("property_access.script.write", "Runtime rejected the property write");
282 return WriteResult::reject("property_access.script.write", "Runtime rejected the property write");
297 std::erase_if(state->entries, [id](const ObserverState::Entry &entry) { return entry.id == id; });
bool arrayRemove(const ssq::Object &instance, const std::string &name, size_t index) const
Removes one element of an array member (shifts the rest).
Definition Runtime.cpp:887
std::vector< ReflectedMember > reflectInstance(const ssq::Object &instance) const
Inspects a live instance: own + inherited members with current values.
Definition Runtime.cpp:669
ReflectedValue tableGet(const ssq::Object &instance, const std::string &name, const std::string &key) const
Value of a table member key; empty when missing.
Definition Runtime.cpp:936
bool writeProperty(const ssq::Object &instance, const std::string &name, const ReflectedValue &value) const
Writes one property of a live instance.
Definition Runtime.cpp:732
ssq::Object readObjectProperty(const ssq::Object &instance, const std::string &name) const
Reads a live object-valued property (nested instance).
Definition Runtime.cpp:791
bool tableRemove(const ssq::Object &instance, const std::string &name, const std::string &key) const
Removes a key from a table member.
Definition Runtime.cpp:995
bool tableSet(const ssq::Object &instance, const std::string &name, const std::string &key, const ReflectedValue &value) const
Sets a key of a table member (creates the key when missing).
Definition Runtime.cpp:957
bool arrayAppend(const ssq::Object &instance, const std::string &name, const ReflectedValue &value) const
Appends an element to an array member.
Definition Runtime.cpp:870
std::string classNameOf(const ssq::Object &instance) const
Name of the script class of a live instance ("" when unknown).
Definition Runtime.cpp:1163
ReflectedValue readProperty(const ssq::Object &instance, const std::string &name) const
Reads one property of a live instance.
Definition Runtime.cpp:716
size_t arraySize(const ssq::Object &instance, const std::string &name) const
Element count of an array member (0 when missing/not an array).
Definition Runtime.cpp:810
bool arraySet(const ssq::Object &instance, const std::string &name, size_t index, const ReflectedValue &value) const
Replaces one element of an array member.
Definition Runtime.cpp:846
ReflectedValue arrayGet(const ssq::Object &instance, const std::string &name, size_t index) const
Element value of an array member; empty when out of range.
Definition Runtime.cpp:826
std::vector< std::string > tableKeys(const ssq::Object &instance, const std::string &name) const
String keys of a table member.
Definition Runtime.cpp:910
Move-only RAII token that owns one observer registration.
Definition Subscription.h:27
std::function< void(const PropertyChange &)> ChangeCallback
Definition PropertyAccess.h:153
~ReflectedPropertyModel() override
Reflected property model.
ReflectedPropertyModel(Runtime &runtime, ssq::Object instance)
Bind one live script instance to the shared property-access contract.
Definition ReflectedPropertyModel.cpp:147
void rebuildSchema()
Rebuild reflection metadata after a script reload.
Definition ReflectedPropertyModel.cpp:155
void refresh()
Pull live values and notify observers for changed properties.
Definition ReflectedPropertyModel.cpp:301
Subscription subscribe(ChangeCallback callback) override
Subscribe.
Definition ReflectedPropertyModel.cpp:291
std::optional< eve::Value > read(const std::string &path) const override
Reads .
Definition ReflectedPropertyModel.cpp:225
WriteResult write(const std::string &path, const eve::Value &value) override
Writes .
Definition ReflectedPropertyModel.cpp:230
Definition PropertyAccess.cpp:7
eve::Subscription Subscription
Compatibility alias for the common observer lifetime token.
Definition PropertyAccess.h:142
@ EditorOnly
PropertyKind
Semantic property kind used by renderer-independent presenters.
Definition PropertyAccess.h:19
@ ReadOnlyText
enum EVENGINE_API_FOUNDATION ReflectedValueKind
Runtime value kind read from a live script instance slot.
Definition Runtime.h:114
Definition Container.h:602
Immutable notification emitted after a model property changes.
Definition PropertyAccess.h:128
One stable property description consumed by any UI shell.
Definition PropertyAccess.h:72
eve::OptionalRef< const PropertyDescriptor > find(const std::string &path) const
Find a property by stable path, or an empty immediate borrow.
Definition PropertyAccess.cpp:9
std::vector< PropertyDescriptor > properties
Definition PropertyAccess.h:89
Definition ReflectedPropertyModel.cpp:139
ChangeCallback callback
Definition ReflectedPropertyModel.cpp:141
Definition ReflectedPropertyModel.cpp:138
std::uint64_t nextId
Definition ReflectedPropertyModel.cpp:143
std::vector< Entry > entries
Definition ReflectedPropertyModel.cpp:144
Result of a model write, including a stable diagnostic code.
Definition PropertyAccess.h:96
static WriteResult reject(std::string code, std::string message)
Reject.
Definition PropertyAccess.h:104