27using BindingValueTypes = meta::TypeList<double, bool, std::string, cereal::DynamicValue>;
34 std::unique_ptr<Impl> impl;
36 explicit Subscription(std::unique_ptr<Impl>);
37 friend class detail::ScreenSessionImpl;
40 LLAPI Subscription()
noexcept;
41 LLAPI ~Subscription();
43 Subscription(Subscription
const&) =
delete;
44 Subscription& operator=(Subscription
const&) =
delete;
46 LLAPI Subscription(Subscription&&)
noexcept;
47 LLAPI Subscription& operator=(Subscription&&)
noexcept;
49 LLAPI
void reset()
noexcept;
51 [[nodiscard]] LLAPI
explicit operator bool()
const noexcept;
61 std::weak_ptr<BindingSlot> impl;
63 explicit BindingHandle(std::weak_ptr<BindingSlot>);
64 friend class ::ll::ui::Property;
65 friend struct ::ll::ui::detail::BindingSlot;
66 template <BindingValue>
67 friend class ::ll::ui::Binding;
69 LLNDAPI Expected<bool> get(
bool*)
const;
70 LLNDAPI Expected<double> get(
double*)
const;
71 LLNDAPI Expected<std::string> get(std::string*)
const;
74 LLNDAPI Expected<> set(
bool value)
const;
75 LLNDAPI Expected<> set(
double value)
const;
76 LLNDAPI Expected<> set(std::string value)
const;
85 LLAPI BindingHandle()
noexcept;
86 LLAPI ~BindingHandle();
88 LLAPI BindingHandle(BindingHandle
const&);
89 LLAPI BindingHandle& operator=(BindingHandle
const&);
90 LLAPI BindingHandle(BindingHandle&&)
noexcept;
91 LLAPI BindingHandle& operator=(BindingHandle&&)
noexcept;
93 LLNDAPI Expected<> setClientWritable(
bool writable)
const;
94 LLNDAPI
bool isClientWritable()
const noexcept;
96 [[nodiscard]] LLAPI
explicit operator bool()
const noexcept;
106 friend class Property;
112 Binding()
noexcept =
default;
114 [[nodiscard]] Expected<T> get()
const {
return handle.get(
static_cast<T*
>(
nullptr)); }
115 [[nodiscard]] Expected<> set(T value)
const {
return handle.set(std::move(value)); }
117 [[nodiscard]] Expected<Subscription> listen(Callback callback)
const {
return handle.listen(std::move(callback)); }
119 [[nodiscard]] Expected<> setClientWritable(
bool writable)
const {
return handle.setClientWritable(writable); }
120 [[nodiscard]]
bool isClientWritable()
const noexcept {
return handle.isClientWritable(); }
122 [[nodiscard]]
explicit operator bool()
const noexcept {
return static_cast<bool>(handle); }
126 std::weak_ptr<detail::PropertySlot> impl;
128 explicit Property(std::weak_ptr<detail::PropertySlot>);
129 LLNDAPI Expected<detail::BindingHandle> bindErased(std::string path,
bool*)
const;
130 LLNDAPI Expected<detail::BindingHandle> bindErased(std::string path,
double*)
const;
131 LLNDAPI Expected<detail::BindingHandle> bindErased(std::string path, std::string*)
const;
132 LLNDAPI Expected<detail::BindingHandle> bindErased(std::string path,
cereal::DynamicValue*)
const;
133 Expected<detail::BindingHandle> bindErasedImpl(std::string path, std::size_t type)
const;
135 friend class detail::ScreenSessionImpl;
136 friend struct detail::PropertySlot;
137 friend class ScreenSession;
140 LLAPI Property()
noexcept;
143 LLAPI Property(Property
const&);
144 LLAPI Property& operator=(Property
const&);
145 LLAPI Property(Property&&)
noexcept;
146 LLAPI Property& operator=(Property&&)
noexcept;
149 LLNDAPI Expected<> setJson(std::string
const& json)
const;
150 LLNDAPI Expected<> erase()
const;
152 template <BindingValue T>
153 [[nodiscard]] Expected<Binding<T>> bind(std::string path)
const {
154 auto result = bindErased(std::move(path),
static_cast<T*
>(
nullptr));
156 return forwardError(result.error());
161 template <BindingValue T>
162 [[nodiscard]] Expected<Binding<T>> bindClientWritable(std::string path)
const {
163 auto result = bind<T>(std::move(path));
165 return forwardError(result.error());
167 auto binding = std::move(result.value());
168 if (
auto writable = binding.setClientWritable(
true); !writable) {
169 return forwardError(writable.error());
174 [[nodiscard]] LLAPI
explicit operator bool()
const noexcept;