Esp32-RBGridUI
Library for creating UIs for the RBController app
Loading...
Searching...
No Matches
builder
widget.cpp
Go to the documentation of this file.
1
#include <esp_log.h>
2
#include <stdio.h>
3
4
#include "
widget.h
"
5
6
#define TAG "UiBuilderWidget"
7
8
namespace
gridui
{
9
namespace
builder {
10
11
Widget::Widget
(
const
char
* type,
WidgetState
& state)
12
: m_state(state)
13
, m_type(type) {
14
}
15
16
rbjson::Object&
Widget::extra
() {
17
return
m_state
.
data
();
18
}
19
20
rbjson::Object&
Widget::style
() {
21
auto
* res =
extra
().getObject(
"css"
);
22
if
(res ==
nullptr
) {
23
res =
new
rbjson::Object;
24
extra
().set(
"css"
, res);
25
}
26
return
*res;
27
}
28
29
void
Widget::serialize
(std::ostream& ss) {
30
extra
().shrink_to_fit();
31
32
ss <<
"{"
;
33
{
34
ss <<
"\"uuid\":"
<<
m_state
.
uuid
() <<
","
;
35
ss <<
"\"type\":\""
<< m_type <<
"\","
;
36
ss <<
"\"state\":"
;
37
extra
().serialize(ss);
38
}
39
ss <<
"}"
;
40
}
41
};
42
43
};
gridui::WidgetState
Definition
widget.h:99
gridui::WidgetState::uuid
uint16_t uuid() const
Definition
widget.h:109
gridui::WidgetState::data
const rbjson::Object & data() const
Definition
widget.h:110
gridui::Widget::Widget
Widget()
Definition
widget.h:180
gridui::builder::Widget::extra
rbjson::Object & extra()
Definition
widget.cpp:16
gridui::builder::Widget::m_state
WidgetState & m_state
Definition
widget.h:93
gridui::builder::Widget::serialize
void serialize(std::ostream &ss)
Definition
widget.cpp:29
gridui::builder::Widget::style
rbjson::Object & style()
Definition
widget.cpp:20
gridui
Definition
arm.h:8
widget.h
Generated on Tue Jul 9 2024 10:04:33 for Esp32-RBGridUI by
1.9.8