-
Notifications
You must be signed in to change notification settings - Fork 1
/
structs.h
67 lines (47 loc) · 1.48 KB
/
structs.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef EEZ_LVGL_UI_STRUCTS_H
#define EEZ_LVGL_UI_STRUCTS_H
#if !defined(EEZ_FOR_LVGL)
#warning "EEZ_FOR_LVGL is not enabled"
#define EEZ_FOR_LVGL
#endif
#if defined(EEZ_FOR_LVGL)
#include <eez/flow/flow.h>
#include <stdint.h>
#include <stdbool.h>
#include "vars.h"
using namespace eez;
enum FlowStructures {
FLOW_STRUCTURE_USER = 16384
};
enum FlowArrayOfStructures {
FLOW_ARRAY_OF_STRUCTURE_USER = 81920
};
enum UserFlowStructureFields {
FLOW_STRUCTURE_USER_FIELD_NAME = 0,
FLOW_STRUCTURE_USER_FIELD_ROLE = 1,
FLOW_STRUCTURE_USER_NUM_FIELDS
};
struct UserValue {
Value value;
UserValue() {
value = Value::makeArrayRef(FLOW_STRUCTURE_USER_NUM_FIELDS, FLOW_STRUCTURE_USER, 0);
}
UserValue(Value value) : value(value) {}
operator Value() const { return value; }
operator bool() const { return value.isArray(); }
const char *name() {
return value.getArray()->values[FLOW_STRUCTURE_USER_FIELD_NAME].getString();
}
void name(const char *name) {
value.getArray()->values[FLOW_STRUCTURE_USER_FIELD_NAME] = StringValue(name);
}
UserRole role() {
return (UserRole)value.getArray()->values[FLOW_STRUCTURE_USER_FIELD_ROLE].getInt();
}
void role(UserRole role) {
value.getArray()->values[FLOW_STRUCTURE_USER_FIELD_ROLE] = IntegerValue((int)role);
}
};
typedef ArrayOf<UserValue, FLOW_ARRAY_OF_STRUCTURE_USER> ArrayOfUserValue;
#endif
#endif /*EEZ_LVGL_UI_STRUCTS_H*/