载入中...
搜索中...
未找到
ReflectedPropertyModel.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4#include "common/Runtime.h"
6
7#include <map>
8#include <memory>
9
10namespace eve::property_access {
11
26public:
38 ReflectedPropertyModel(Runtime &runtime, ssq::Object instance);
43
45 const PropertySchema &schema() const override { return schema_; }
47 std::optional<eve::Value> read(const std::string &path) const override;
49 WriteResult write(const std::string &path, const eve::Value &value) override;
51 std::uint64_t revision() const override { return revision_; }
53 Subscription subscribe(ChangeCallback callback) override;
54
56 void rebuildSchema();
58 void refresh();
59
60private:
61 struct ObserverState;
62 eve::Value convertValue(const std::string &path, const ReflectedValue &value) const;
63 void emit(const std::string &path, const eve::Value &value);
64
65 Runtime *runtime_ = nullptr;
66 ssq::Object instance_;
67 PropertySchema schema_;
68 std::map<std::string, eve::Value> cachedValues_;
69 std::uint64_t revision_ = 0;
70 std::shared_ptr<ObserverState> observers_;
71};
72
73} // namespace eve::property_access
double value
#define EVENGINE_API_FOUNDATION
每个链接组(link group)各自的导出宏。
Definition Export.h:106
std::string path
Definition PlayHost.cpp:110
ViewPreparation callback
EVENGINE_API_FOUNDATION public API.
Definition Runtime.h:189
Move-only RAII token that owns one observer registration.
The canonical owning dynamic value used by data-facing protocols.
Definition Value.h:31
Renderer- and transaction-independent MVVM property surface.
Adapts one live Squirrel instance to the renderer-independent property model.
~ReflectedPropertyModel() override
Reflected property model.
std::uint64_t revision() const override
Revision.
const PropertySchema & schema() const override
Schema.
ReflectedPropertyModel & operator=(const ReflectedPropertyModel &)=delete
ReflectedPropertyModel(const ReflectedPropertyModel &)=delete
Typed snapshot of one live instance property.
Definition Runtime.h:132
Versioned schema for one view model or editable target.
Result of a model write, including a stable diagnostic code.