Nui
Loading...
Searching...
No Matches
attribute_factory.hpp
Go to the documentation of this file.
1#pragma once
2
10
11#include <nui/frontend/val.hpp>
12
13#include <traits/functions.hpp>
14
15#include <concepts>
16#include <memory>
17#include <functional>
18
20{
21 namespace Detail
22 {
23 template <typename ElementT, typename T>
25 std::weak_ptr<ElementT> element,
26 T const& obs,
27 std::function<bool(std::shared_ptr<ElementT> const&)> onLock)
28 {
29 const auto eventId = globalEventContext.registerEvent(
30 Event{
31 [element, obs, onLock = std::move(onLock)](auto eventId) {
32 if (auto shared = element.lock(); shared)
33 {
34 return onLock(shared);
35 }
36 obs.detachEvent(eventId);
37 return false;
38 },
39 [element]() {
40 return !element.expired();
41 }});
42 obs.attachEvent(eventId);
43 return eventId;
44 }
45
46 template <typename ElementT, typename T>
47 EventContext::EventIdType defaultAttributeEvent(std::weak_ptr<ElementT> element, T const& obs, char const* name)
48 {
49 return changeEventHandler(
50 element,
51 obs,
52 std::function<bool(std::shared_ptr<ElementT> const&)>{
53 [name, obs](std::shared_ptr<ElementT> const& shared) {
54 shared->setAttribute(name, obs.value());
55 return true;
56 }});
57 }
58
59 template <typename ElementT, typename T>
60 EventContext::EventIdType defaultPropertyEvent(std::weak_ptr<ElementT> element, T const& obs, char const* name)
61 {
62 return changeEventHandler(
63 element,
64 obs,
65 std::function<bool(std::shared_ptr<ElementT> const&)>{
66 [name, obs](std::shared_ptr<ElementT> const& shared) {
67 shared->setProperty(name, obs.value());
68 return true;
69 }});
70 }
71
72 template <typename FunctionT>
74 {
75 static constexpr bool value = false;
76 };
77
78 template <typename FunctionT>
79 requires Traits::IsCallableOfArity<FunctionT, 1>
81 {
82 static constexpr bool value =
83 std::is_constructible_v<typename Traits::FunctionTraits<FunctionT>::template Argument<0>, Nui::val>;
84 };
85
86 template <typename FunctionCallableByExplicitConstructionOfVal>
88 IsCallableByExplicitConstructionOfValImpl<std::decay_t<FunctionCallableByExplicitConstructionOfVal>>::value;
89 }
90
92 {
93 public:
94 explicit constexpr PropertyFactory(char const* name)
95 : name_{name}
96 {}
97
98 constexpr PropertyFactory(PropertyFactory const& other) = default;
99 constexpr PropertyFactory(PropertyFactory&& other) noexcept = default;
102 ~PropertyFactory() = default;
103
104 constexpr char const* name() const
105 {
106 return name_;
107 };
108
109 template <typename U>
110 requires(
111 !IsObservedLike<std::decay_t<U>> && !std::invocable<U, Nui::val> && !std::invocable<U> &&
113 // NOLINTNEXTLINE(misc-unconventional-assign-operator, cppcoreguidelines-c-copy-assignment-signature)
114 Attribute operator=(U val) const
115 {
116 return Attribute{
117 [name = name(), val = std::move(val)](Dom::ChildlessElement& element) {
118 element.setProperty(name, val);
119 },
120 };
121 }
122
123 template <typename U>
125 // NOLINTNEXTLINE(misc-unconventional-assign-operator, cppcoreguidelines-c-copy-assignment-signature)
126 Attribute operator=(U const& shared) const
127 {
128 return Attribute{
129 [name = name(), weak = std::weak_ptr{shared}](Dom::ChildlessElement& element) {
130 if (auto shared = weak.lock(); shared)
131 element.setProperty(name, shared->value());
132 },
133 [name = name(), weak = std::weak_ptr{shared}](std::weak_ptr<Dom::ChildlessElement> const& element) {
134 auto shared = weak.lock();
135 if (!shared)
137
138 const auto eventId = globalEventContext.registerEvent(
139 Event{
140 [name, element, obsWeak = std::weak_ptr{shared}](auto eventId) {
141 auto obsShared = obsWeak.lock();
142 if (!obsShared)
143 {
144 return false;
145 }
146 if (auto shared = element.lock(); shared)
147 {
148 shared->setProperty(name, obsShared->value());
149 return true;
150 }
151 obsShared->detachEvent(eventId);
152 return false;
153 },
154 [element, obsWeak = std::weak_ptr{shared}]() {
155 return !element.expired() && !obsWeak.expired();
156 },
157 });
158 shared->attachEvent(eventId);
159 return eventId;
160 },
161 [weak = std::weak_ptr{shared}](EventContext::EventIdType id) {
162 if (auto shared = weak.lock(); shared)
163 shared->detachEvent(id);
164 },
165 };
166 }
167
168 template <typename U>
170 // NOLINTNEXTLINE
171 Attribute operator=(U&& val) const
172 {
173 auto shared = val.lock();
174 if (!shared)
175 return Attribute{};
176
177 return operator=(shared);
178 }
179
180 template <typename U>
182 // NOLINTNEXTLINE(misc-unconventional-assign-operator, cppcoreguidelines-c-copy-assignment-signature)
183 Attribute operator=(U& val) const
184 {
185 return Attribute{
186 [name = name(), &val](Dom::ChildlessElement& element) {
187 element.setProperty(name, val.value());
188 },
189 [name = name(), &val](std::weak_ptr<Dom::ChildlessElement>&& element) {
191 std::move(element), Nui::Detail::CopyableObservedWrap{val}, name);
192 },
194 val.detachEvent(id);
195 },
196 };
197 }
198
199 template <typename RendererType, typename... ObservedValues>
200 // NOLINTNEXTLINE(misc-unconventional-assign-operator, cppcoreguidelines-c-copy-assignment-signature)
203 {
204 return Attribute{
205 [name = name(), combinator](Dom::ChildlessElement& element) {
206 element.setProperty(name, combinator.value());
207 },
208 [name = name(), combinator](std::weak_ptr<Dom::ChildlessElement>&& element) {
209 return Detail::defaultPropertyEvent(std::move(element), combinator, name);
210 },
211 [combinator](EventContext::EventIdType id) {
212 combinator.detachEvent(id);
213 },
214 };
215 }
216
217 template <typename RendererType, typename... ObservedValues>
218 // NOLINTNEXTLINE(misc-unconventional-assign-operator, cppcoreguidelines-c-copy-assignment-signature)
221 {
222 return Attribute{
223 [name = name(), combinator](Dom::ChildlessElement& element) {
224 element.setProperty(name, combinator.value());
225 },
226 [name = name(), combinator](std::weak_ptr<Dom::ChildlessElement>&& element) {
227 return Detail::defaultPropertyEvent(std::move(element), combinator, name);
228 },
229 [combinator](EventContext::EventIdType id) {
230 combinator.detachEvent(id);
231 },
232 };
233 }
234
235 // NOLINTNEXTLINE(misc-unconventional-assign-operator, cppcoreguidelines-c-copy-assignment-signature)
236 Attribute operator=(std::function<void(Nui::val)> func) const
237 {
238 return Attribute{
239 [name = name(), func = std::move(func)](Dom::ChildlessElement& element) {
240 element.setProperty(name, [func](Nui::val val) {
241 func(std::move(val));
243 });
244 },
245 };
246 }
247
248 // NOLINTNEXTLINE(misc-unconventional-assign-operator, cppcoreguidelines-c-copy-assignment-signature)
249 Attribute operator=(std::function<void()> func) const
250 {
251 return Attribute{
252 [name = name(), func = std::move(func)](Dom::ChildlessElement& element) {
253 element.setProperty(name, [func](Nui::val const&) {
254 func();
256 });
257 },
258 };
259 }
260
261 template <typename FunctionT>
263 // NOLINTNEXTLINE(misc-unconventional-assign-operator, cppcoreguidelines-c-copy-assignment-signature)
264 Attribute operator=(FunctionT func) const
265 {
266 return Attribute{
267 [name = name(), func = std::move(func)](Dom::ChildlessElement& element) {
268 element.setProperty(name, [func](Nui::val val) {
269 func(
270 std::decay_t<typename Traits::FunctionTraits<FunctionT>::template Argument<0>>{
271 std::move(val)});
273 });
274 },
275 };
276 }
277
278 private:
279 char const* name_;
280 };
281
283 {
284 public:
285 explicit constexpr AttributeFactory(char const* name)
286 : name_{name}
287 {}
288
289 constexpr AttributeFactory(AttributeFactory const& other) = default;
290 constexpr AttributeFactory(AttributeFactory&& other) = default;
293 ~AttributeFactory() = default;
294
295 constexpr char const* name() const
296 {
297 return name_;
298 };
299
300 template <typename U>
301 requires(
302 !IsObservedLike<std::decay_t<U>> && !std::invocable<U, Nui::val> &&
305 // NOLINTNEXTLINE(misc-unconventional-assign-operator, cppcoreguidelines-c-copy-assignment-signature)
306 Attribute operator=(U val) const
307 {
308 return Attribute{
309 [name = name(), val = std::move(val)](Dom::ChildlessElement& element) {
310 element.setAttribute(name, val);
311 },
312 };
313 }
314
315 template <typename U>
317 // NOLINTNEXTLINE(misc-unconventional-assign-operator, cppcoreguidelines-c-copy-assignment-signature)
318 Attribute operator=(U const& shared) const
319 {
320 return Attribute{
321 [name = name(), weak = std::weak_ptr{shared}](Dom::ChildlessElement& element) {
322 if (auto shared = weak.lock(); shared)
323 element.setAttribute(name, shared->value());
324 },
325 [name = name(), weak = std::weak_ptr{shared}](std::weak_ptr<Dom::ChildlessElement> const& element) {
326 auto shared = weak.lock();
327 if (!shared)
329
330 const auto eventId = globalEventContext.registerEvent(
331 Event{
332 [name, element, obsWeak = std::weak_ptr{shared}](auto eventId) {
333 auto obsShared = obsWeak.lock();
334 if (!obsShared)
335 {
336 return false;
337 }
338 if (auto shared = element.lock(); shared)
339 {
340 shared->setAttribute(name, obsShared->value());
341 return true;
342 }
343 obsShared->detachEvent(eventId);
344 return false;
345 },
346 [element, obsWeak = std::weak_ptr{shared}]() {
347 return !element.expired() && !obsWeak.expired();
348 },
349 });
350 shared->attachEvent(eventId);
351 return eventId;
352 },
353 [weak = std::weak_ptr{shared}](EventContext::EventIdType id) {
354 if (auto shared = weak.lock(); shared)
355 shared->detachEvent(id);
356 },
357 };
358 }
359
360 template <typename U>
362 // NOLINTNEXTLINE
363 Attribute operator=(U&& val) const
364 {
365 auto shared = val.lock();
366 if (!shared)
367 return Attribute{};
368
369 return operator=(shared);
370 }
371
372 template <typename U>
374 // NOLINTNEXTLINE(misc-unconventional-assign-operator, cppcoreguidelines-c-copy-assignment-signature)
375 Attribute operator=(U& val) const
376 {
377 return Attribute{
378 [name = name(), &val](Dom::ChildlessElement& element) {
379 element.setAttribute(name, val.value());
380 },
381 [name = name(), &val](std::weak_ptr<Dom::ChildlessElement>&& element) {
383 std::move(element), Nui::Detail::CopyableObservedWrap{val}, name);
384 },
386 val.detachEvent(id);
387 },
388 };
389 }
390
391 template <typename U>
393 // NOLINTNEXTLINE(misc-unconventional-assign-operator, cppcoreguidelines-c-copy-assignment-signature)
394 Attribute operator=(Nui::Detail::Property<U> const& prop) const
395 {
396 return Attribute{
397 [name = name(), p = prop.prop](Dom::ChildlessElement& element) {
398 element.setProperty(name, p->value());
399 },
400 [name = name(), p = prop.prop](std::weak_ptr<Dom::ChildlessElement>&& element) {
402 std::move(element), Nui::Detail::CopyableObservedWrap{*p}, name);
403 },
404 [p = prop.prop](EventContext::EventIdType id) {
405 p->detachEvent(id);
406 },
407 };
408 }
409
410 template <typename U>
412 // NOLINTNEXTLINE(misc-unconventional-assign-operator, cppcoreguidelines-c-copy-assignment-signature)
413 Attribute operator=(Nui::Detail::Property<U> const& prop) const
414 {
415 auto shared = prop.prop.lock();
416 if (!shared)
417 return Attribute{};
418
419 return Attribute{
420 [name = name(), weak = std::weak_ptr{shared}](Dom::ChildlessElement& element) {
421 if (auto shared = weak.lock(); shared)
422 element.setProperty(name, shared->value());
423 },
424 [name = name(), weak = std::weak_ptr{shared}](std::weak_ptr<Dom::ChildlessElement> const& element) {
425 auto shared = weak.lock();
426 if (!shared)
428
429 const auto eventId = globalEventContext.registerEvent(
430 Event{
431 [name, element, obsWeak = std::weak_ptr{shared}](auto eventId) {
432 auto obsShared = obsWeak.lock();
433 if (!obsShared)
434 {
435 return false;
436 }
437 if (auto shared = element.lock(); shared)
438 {
439 shared->setProperty(name, obsShared->value());
440 return true;
441 }
442 obsShared->detachEvent(eventId);
443 return false;
444 },
445 [element, obsWeak = std::weak_ptr{shared}]() {
446 return !element.expired() && !obsWeak.expired();
447 },
448 });
449 shared->attachEvent(eventId);
450 return eventId;
451 },
452 [weak = std::weak_ptr{shared}](EventContext::EventIdType id) {
453 if (auto shared = weak.lock(); shared)
454 shared->detachEvent(id);
455 },
456 };
457 }
458
459 template <typename U>
460 requires(
461 !IsObservedLike<std::decay_t<U>> && !std::invocable<U, Nui::val> &&
463 // NOLINTNEXTLINE(misc-unconventional-assign-operator, cppcoreguidelines-c-copy-assignment-signature)
464 Attribute operator=(Nui::Detail::Property<U> const& prop) const
465 {
466 return Attribute{[name = name(), p = std::move(prop.prop)](Dom::ChildlessElement& element) {
467 element.setProperty(name, p);
468 }};
469 }
470
471 template <typename RendererType, typename... ObservedValues>
472 // NOLINTNEXTLINE(misc-unconventional-assign-operator, cppcoreguidelines-c-copy-assignment-signature)
475 {
476 return Attribute{
477 [name = name(), combinator](Dom::ChildlessElement& element) {
478 element.setProperty(name, combinator.value());
479 },
480 [name = name(), combinator](std::weak_ptr<Dom::ChildlessElement>&& element) {
481 return Detail::defaultPropertyEvent(std::move(element), combinator, name);
482 },
483 [combinator](EventContext::EventIdType id) {
484 combinator.detachEvent(id);
485 },
486 };
487 }
488
489 template <typename RendererType, typename... ObservedValues>
490 // NOLINTNEXTLINE(misc-unconventional-assign-operator, cppcoreguidelines-c-copy-assignment-signature)
493 {
494 return Attribute{
495 [name = name(), combinator](Dom::ChildlessElement& element) {
496 element.setAttribute(name, combinator.value());
497 },
498 [name = name(), combinator](std::weak_ptr<Dom::ChildlessElement>&& element) {
499 return Detail::defaultAttributeEvent(std::move(element), combinator, name);
500 },
501 [combinator](EventContext::EventIdType id) {
502 combinator.detachEvent(id);
503 },
504 };
505 }
506
507 // NOLINTNEXTLINE(misc-unconventional-assign-operator, cppcoreguidelines-c-copy-assignment-signature)
508 Attribute operator=(std::function<void(Nui::val)> func) const
509 {
510 return Attribute{
511 [name = name(), func = std::move(func)](Dom::ChildlessElement& element) {
512 element.setAttribute(name, [func](Nui::val val) {
513 func(std::move(val));
515 });
516 },
517 };
518 }
519
520 // NOLINTNEXTLINE(misc-unconventional-assign-operator, cppcoreguidelines-c-copy-assignment-signature)
521 Attribute operator=(std::function<void()> func) const
522 {
523 return Attribute{
524 [name = name(), func = std::move(func)](Dom::ChildlessElement& element) {
525 element.setAttribute(name, [func](Nui::val const&) {
526 func();
528 });
529 },
530 };
531 }
532
533 template <typename FunctionT>
535 // NOLINTNEXTLINE(misc-unconventional-assign-operator, cppcoreguidelines-c-copy-assignment-signature)
536 Attribute operator=(FunctionT func) const
537 {
538 return Attribute{
539 [name = name(), func = std::move(func)](Dom::ChildlessElement& element) {
540 element.setProperty(name, [func](Nui::val val) {
541 func(
542 std::decay_t<typename Traits::FunctionTraits<FunctionT>::template Argument<0>>{
543 std::move(val)});
545 });
546 },
547 };
548 }
549
550 // NOLINTNEXTLINE(misc-unconventional-assign-operator, cppcoreguidelines-c-copy-assignment-signature)
551 Attribute operator=(Nui::Detail::Property<std::function<void(Nui::val)>> func) const
552 {
553 return Attribute{
554 [name = name(), func = std::move(func.prop)](Dom::ChildlessElement& element) {
555 element.setProperty(name, [func](Nui::val val) {
556 func(std::move(val));
558 });
559 },
560 };
561 }
562
563 // NOLINTNEXTLINE(misc-unconventional-assign-operator, cppcoreguidelines-c-copy-assignment-signature)
564 Attribute operator=(Nui::Detail::Property<std::function<void()>> func) const
565 {
566 return Attribute{
567 [name = name(), func = std::move(func.prop)](Dom::ChildlessElement& element) {
568 element.setProperty(name, [func](Nui::val const&) {
569 func();
571 });
572 },
573 };
574 }
575
576 template <typename FunctionT>
578 // NOLINTNEXTLINE(misc-unconventional-assign-operator, cppcoreguidelines-c-copy-assignment-signature)
580 {
581 return Attribute{
582 [name = name(), func = std::move(func.prop)](Dom::ChildlessElement& element) {
583 element.setProperty(name, [func](Nui::val val) {
584 func(
585 std::decay_t<typename Traits::FunctionTraits<FunctionT>::template Argument<0>>{
586 std::move(val)});
588 });
589 },
590 };
591 }
592
593 private:
594 char const* name_;
595 };
596
598 {
599 public:
600 explicit constexpr EventFactory(char const* name)
601 : name_{name}
602 {}
603
604 constexpr EventFactory(EventFactory const& other) = default;
605 constexpr EventFactory(EventFactory&& other) = default;
608 ~EventFactory() = default;
609
610 constexpr char const* name() const
611 {
612 return name_;
613 };
614
615 // NOLINTNEXTLINE(misc-unconventional-assign-operator, cppcoreguidelines-c-copy-assignment-signature)
616 Attribute operator=(std::function<void()> func) const
617 {
618 return Attribute{
619 [name = name(), func = std::move(func)](Dom::ChildlessElement& element) {
620 element.addEventListener(name, [func](Nui::val const&) {
621 func();
623 });
624 },
625 };
626 }
627
628 // NOLINTNEXTLINE(misc-unconventional-assign-operator, cppcoreguidelines-c-copy-assignment-signature)
629 Attribute operator=(std::function<void(Nui::val)> func) const
630 {
631 return Attribute{
632 [name = name(), func = std::move(func)](Dom::ChildlessElement& element) {
633 element.addEventListener(name, [func](Nui::val val) {
634 func(std::move(val));
636 });
637 },
638 };
639 }
640
641 template <typename FunctionT>
643 // NOLINTNEXTLINE(misc-unconventional-assign-operator, cppcoreguidelines-c-copy-assignment-signature)
644 Attribute operator=(FunctionT func) const
645 {
646 return Attribute{
647 [name = name(), func = std::move(func)](Dom::ChildlessElement& element) {
648 element.addEventListener(name, [func](Nui::val val) {
649 func(
650 std::decay_t<typename Traits::FunctionTraits<FunctionT>::template Argument<0>>{
651 std::move(val)});
653 });
654 },
655 };
656 }
657
658 private:
659 char const* name_;
660 };
661
662 inline namespace Literals
663 {
664 constexpr AttributeFactory operator""_attr(char const* name, std::size_t)
665 {
666 return AttributeFactory{name};
667 }
668 constexpr PropertyFactory operator""_prop(char const* name, std::size_t)
669 {
670 return PropertyFactory{name};
671 }
672 constexpr EventFactory operator""_event(char const* name, std::size_t)
673 {
674 return EventFactory{name};
675 }
676 }
677
678 namespace Detail
679 {
680 template <typename T>
681 struct DeferWrap
682 {
683 T factory;
684
685 template <typename... Args>
686 // NOLINTNEXTLINE(misc-unconventional-assign-operator, cppcoreguidelines-c-copy-assignment-signature)
687 Attribute operator=(Args&&... args) const
688 {
689 auto attr = factory.operator=(std::forward<Args>(args)...);
690 attr.defer(true);
691 return attr;
692 };
693 };
694 }
695
696 template <typename T>
697 requires(
698 std::is_same_v<T, AttributeFactory> || std::is_same_v<T, PropertyFactory> || std::is_same_v<T, EventFactory>)
699 Detail::DeferWrap<T> operator!(T const& factory)
700 {
701 return Detail::DeferWrap<T>{.factory = T{std::move(factory)}};
702 }
703}
704
705// NOLINTBEGIN
706#define MAKE_HTML_VALUE_ATTRIBUTE_RENAME(NAME, HTML_NAME) \
707 namespace Nui::Attributes \
708 { \
709 static constexpr auto NAME = AttributeFactory{HTML_NAME}; \
710 }
711
712#define MAKE_HTML_VALUE_ATTRIBUTE(NAME) MAKE_HTML_VALUE_ATTRIBUTE_RENAME(NAME, #NAME)
713
714#define MAKE_HTML_EVENT_ATTRIBUTE_RENAME(NAME, HTML_ACTUAL) \
715 namespace Nui::Attributes \
716 { \
717 namespace Names \
718 { \
719 static constexpr auto Attr##NAME = fixToLower(HTML_ACTUAL); \
720 } \
721 static constexpr auto NAME = AttributeFactory{Names::Attr##NAME}; \
722 }
723// NOLINTEND
724
725#define MAKE_HTML_EVENT_ATTRIBUTE(NAME) MAKE_HTML_EVENT_ATTRIBUTE_RENAME(NAME, #NAME)
Definition attribute.hpp:15
bool defer() const
Definition attribute.cpp:41
Definition attribute_factory.hpp:283
Attribute operator=(Nui::Detail::Property< FunctionT > func) const
Definition attribute_factory.hpp:579
AttributeFactory & operator=(AttributeFactory &&)=delete
constexpr AttributeFactory(AttributeFactory &&other)=default
constexpr AttributeFactory(char const *name)
Definition attribute_factory.hpp:285
Attribute operator=(ObservedValueCombinatorWithPropertyGenerator< RendererType, ObservedValues... > const &combinator) const
Definition attribute_factory.hpp:474
AttributeFactory & operator=(AttributeFactory const &)=delete
Attribute operator=(std::function< void()> func) const
Definition attribute_factory.hpp:521
Attribute operator=(std::function< void(Nui::val)> func) const
Definition attribute_factory.hpp:508
Attribute operator=(ObservedValueCombinatorWithGenerator< RendererType, ObservedValues... > const &combinator) const
Definition attribute_factory.hpp:492
Attribute operator=(Nui::Detail::Property< std::function< void(Nui::val)> > func) const
Definition attribute_factory.hpp:551
constexpr AttributeFactory(AttributeFactory const &other)=default
constexpr char const * name() const
Definition attribute_factory.hpp:295
Attribute operator=(Nui::Detail::Property< std::function< void()> > func) const
Definition attribute_factory.hpp:564
Attribute operator=(FunctionT func) const
Definition attribute_factory.hpp:536
Definition attribute_factory.hpp:598
constexpr EventFactory(EventFactory const &other)=default
EventFactory & operator=(EventFactory &&)=delete
Attribute operator=(std::function< void(Nui::val)> func) const
Definition attribute_factory.hpp:629
constexpr EventFactory(EventFactory &&other)=default
Attribute operator=(std::function< void()> func) const
Definition attribute_factory.hpp:616
constexpr char const * name() const
Definition attribute_factory.hpp:610
constexpr EventFactory(char const *name)
Definition attribute_factory.hpp:600
Attribute operator=(FunctionT func) const
Definition attribute_factory.hpp:644
EventFactory & operator=(EventFactory const &)=delete
Definition attribute_factory.hpp:92
constexpr PropertyFactory(char const *name)
Definition attribute_factory.hpp:94
Attribute operator=(ObservedValueCombinatorWithGenerator< RendererType, ObservedValues... > const &combinator) const
Definition attribute_factory.hpp:220
PropertyFactory & operator=(PropertyFactory &&)=delete
Attribute operator=(std::function< void()> func) const
Definition attribute_factory.hpp:249
Attribute operator=(FunctionT func) const
Definition attribute_factory.hpp:264
Attribute operator=(std::function< void(Nui::val)> func) const
Definition attribute_factory.hpp:236
PropertyFactory & operator=(PropertyFactory const &)=delete
Attribute operator=(ObservedValueCombinatorWithPropertyGenerator< RendererType, ObservedValues... > const &combinator) const
Definition attribute_factory.hpp:202
constexpr PropertyFactory(PropertyFactory &&other) noexcept=default
constexpr char const * name() const
Definition attribute_factory.hpp:104
constexpr PropertyFactory(PropertyFactory const &other)=default
The basic element cannot have children and does not hold explicit ownership of them.
Definition childless_element.hpp:19
EventRegistry::EventIdType EventIdType
Definition event_context.hpp:40
static constexpr auto invalidEventId
Definition event_context.hpp:41
void executeActiveEventsImmediately()
Definition event_context.hpp:64
EventIdType registerEvent(Event event)
Definition event_context.hpp:52
Definition event.hpp:46
constexpr void detachEvent(auto eventId) const
Definition observed_value_combinator.hpp:56
Definition observed_value_combinator.hpp:108
constexpr auto value() const
Definition observed_value_combinator.hpp:124
Definition observed_value_combinator.hpp:145
Definition property.hpp:42
Definition observed_value.hpp:1540
Definition observed_value.hpp:1534
Definition observed_value.hpp:1536
Definition observed_value.hpp:1538
EventContext::EventIdType changeEventHandler(std::weak_ptr< ElementT > element, T const &obs, std::function< bool(std::shared_ptr< ElementT > const &)> onLock)
Definition attribute_factory.hpp:24
EventContext::EventIdType defaultPropertyEvent(std::weak_ptr< ElementT > element, T const &obs, char const *name)
Definition attribute_factory.hpp:60
EventContext::EventIdType defaultAttributeEvent(std::weak_ptr< ElementT > element, T const &obs, char const *name)
Definition attribute_factory.hpp:47
Definition attribute_factory.hpp:20
static constexpr auto extractJsonMember(nlohmann::json const &json) -> decltype(auto)
Definition rpc_hub.hpp:29
thread_local EventContext globalEventContext
Definition event_context.cpp:5
RendererType
Definition materialize.hpp:48
emscripten::val val
Definition val.hpp:5
static constexpr bool value
Definition attribute_factory.hpp:75
Definition observed_value.hpp:1546
Definition property.hpp:13
T prop
Definition property.hpp:14