Nui
Loading...
Searching...
No Matches
dom.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <nui/core.hpp>
6
7#include <memory>
8
9namespace Nui::Dom
10{
11 class Dom
12 {
13 public:
14 Dom();
15 Dom(const Dom&) = default;
16 Dom(Dom&&) = default;
17 Dom& operator=(const Dom&) = default;
18 Dom& operator=(Dom&&) = default;
19 ~Dom() = default;
20
21 Element& root();
22 template <typename T>
23 void setBody(T&& body)
24 {
25 root().replaceElement(std::forward<T>(body));
26 }
27
28 private:
29 std::shared_ptr<Element> root_;
30 };
31}
Definition dom.hpp:12
Dom(const Dom &)=default
Dom & operator=(Dom &&)=default
void setBody(T &&body)
Definition dom.hpp:23
~Dom()=default
Dom(Dom &&)=default
Dom()
Definition dom.cpp:8
Dom & operator=(const Dom &)=default
Element & root()
Definition dom.cpp:12
Definition element.hpp:42
void replaceElement(std::invocable< Element &, Renderer const & > auto &&fn)
Definition element.hpp:135
Definition basic_element.hpp:12