Mercurial > minori
annotate include/sys/x11/settings.h @ 364:99c961c91809
core: refactor out byte stream into its own file
easy dubs
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Tue, 16 Jul 2024 21:15:59 -0400 |
parents | c844f8bb87ce |
children |
rev | line source |
---|---|
351 | 1 #ifndef MINORI_SYS_X11_SETTINGS_H_ |
2 #define MINORI_SYS_X11_SETTINGS_H_ | |
3 | |
4 #include <cstdint> | |
5 #include <string> | |
6 #include <vector> | |
7 | |
8 namespace x11 { | |
9 | |
10 /* stores the item, type, etc */ | |
11 struct SettingsItem { | |
12 enum Type { | |
13 TypeInt = 0, | |
14 TypeStr = 1, | |
15 TypeRgba = 2, | |
16 }; | |
17 | |
18 /* could technically be a union */ | |
19 struct Data { | |
364
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
351
diff
changeset
|
20 std::int32_t integer; |
351 | 21 std::string string; |
22 struct { | |
23 std::uint16_t red, green, blue, alpha; | |
24 } rgba; | |
25 }; | |
26 | |
27 bool VerifyType(); | |
28 | |
29 std::uint8_t type; /* one of Type */ | |
30 std::string name; /* name of the item */ | |
31 std::uint32_t serial; /* last-changed serial */ | |
32 Data data; /* type-specific data */ | |
33 }; | |
34 | |
35 bool GetSettings(std::vector<SettingsItem>& settings); | |
36 bool FindSetting(const std::string& name, SettingsItem& setting); | |
37 | |
38 } | |
39 | |
40 #endif /* MINORI_SYS_X11_SETTINGS_H_ */ |