Nix (Dev) 3.5.10
dev - 3.5.10 - 1af9301
Loading...
Searching...
No Matches
structs.hpp
Go to the documentation of this file.
1#ifndef IV_SRC_MIMICS_STRUCTS_HPP_
2#define IV_SRC_MIMICS_STRUCTS_HPP_
3
4#include "core/color.hpp"
5#include "core/defines.hpp"
6#include "core/utils.hpp"
8#include "math/structs.hpp"
9#include "mimics/enums.hpp"
10
11namespace iv::mimics
12{
13
15{
21
22 bool load(const iv::file::xml::node &nodeLocation)
23 {
24 bool result {true};
25 const iv::file::xml::node nodePosition = nodeLocation.getChild(Sections::position);
26 result &= position.load(nodePosition);
27
28 const iv::file::xml::node nodeRotationInGrades = nodeLocation.getChild(Sections::rotationInGrades);
30 return result;
31 }
32
33 bool save(iv::file::xml::node &nodeLocation) const
34 {
35 bool result {true};
36 iv::file::xml::node nodePosition = nodeLocation.appendChild(Sections::position);
37 result &= position.save(nodePosition);
38
39 iv::file::xml::node nodeRotationInGrades = nodeLocation.appendChild(Sections::rotationInGrades);
40 nodeRotationInGrades.addAttribute(Keys::rotation, rotation);
41 return result;
42 }
43
45 double rotation;
46
47private:
48 struct Sections
49 {
50 static constexpr std::string_view position = "Position";
51 static constexpr std::string_view rotationInGrades = "Rotation";
52 };
53
54 struct Keys
55 {
56 static constexpr std::string_view rotation = "Degrees";
57 };
58
60 {
61 static constexpr iv::types::coord position = 0;
62 static constexpr iv::types::coord rotation = 0;
63 };
64};
65
67{
73
74 bool load(const iv::file::xml::node &nodeTitleSettings)
75 {
76 bool result {true};
77 show = nodeTitleSettings.getAttribute(Keys::show, DefaultValues::show);
78 align = magic_enum::enum_cast<iv::mimics::eTitleAlign>(
80 .value_or(DefaultValues::align);
84 .value_or(DefaultValues::color);
85
86 const iv::file::xml::node nodeTitles = nodeTitleSettings.getChild(Sections::titles);
87 result &= titles.load(nodeTitles);
88
89 const iv::file::xml::node nodeLocation = nodeTitleSettings.getChild(Sections::location);
90 result &= location.load(nodeLocation);
91
92 return result;
93 }
94
95 bool save(iv::file::xml::node &nodeTitleSettings) const
96 {
97 bool result {true};
98 nodeTitleSettings.addAttribute(Keys::show, show);
99 nodeTitleSettings.addAttribute(Keys::align, magic_enum::enum_name(align));
100 nodeTitleSettings.addAttribute(Keys::height, height);
101 nodeTitleSettings.addAttribute(Keys::padding, padding);
103
104 iv::file::xml::node nodeTitles = nodeTitleSettings.appendChild(Sections::titles);
105 result &= titles.save(nodeTitles, Sections::title);
106
107 iv::file::xml::node nodeLocation = nodeTitleSettings.appendChild(Sections::location);
108 result &= location.save(nodeLocation);
109 return result;
110 }
111
112 bool show;
119
120private:
121 struct Keys
122 {
123 static constexpr std::string_view show {"Show"};
124 static constexpr std::string_view align {"Align"};
125 static constexpr std::string_view height {"Height"};
126 static constexpr std::string_view padding {"Padding"};
127 static constexpr std::string_view color {"Color"};
128 };
130 {
131 static constexpr std::string string {};
132 static constexpr bool show {false};
134 static constexpr iv::types::height height {50};
135 static constexpr iv::types::padding padding {5};
137 };
138 struct Sections
139 {
140 static constexpr std::string_view titles {"Titles"};
141 static constexpr std::string_view title {"Title"};
142 static constexpr std::string_view location {"Location"};
143 };
144};
145
147{
148 bool load(const iv::file::xml::node &nodeHideCommandsSettings)
149 {
151 return true;
152 }
153
154 bool save(iv::file::xml::node &nodeHideCommandsSettings) const
155 {
156 nodeHideCommandsSettings.addAttribute(Keys::hideCommands, hideCommands);
157 return true;
158 }
159
162
163private:
164 struct Keys
165 {
166 static constexpr std::string_view hideCommands {"HideCommands"};
167 static constexpr std::string_view hideCondition {"HideCondition"};
168 };
170 {
171 static constexpr bool hideCommands {false};
172 };
173};
174
176{
183
197
198 void save(iv::file::xml::node &nodeBackground) const
199 {
200 nodeBackground.addAttribute(Keys::show, show);
202 iv::file::xml::node nodeLocation = nodeBackground.appendChild(Sections::location);
203 location.save(nodeLocation);
204 nodeBackground.addAttribute(Keys::width, width);
205 nodeBackground.addAttribute(Keys::height, height);
206 iv::file::xml::node nodeBorder = nodeBackground.appendChild(Sections::border);
209 }
210
211 bool show;
218
219private:
220 struct Sections
221 {
222 static constexpr std::string_view location {"Location"};
223 static constexpr std::string_view border {"Border"};
224 };
225
226 struct Keys
227 {
228 static constexpr std::string_view show {"Show"};
229 static constexpr std::string_view color {"Color"};
230 static constexpr std::string_view width {"Width"};
231 static constexpr std::string_view height {"Height"};
232 static constexpr std::string_view borderWidth {"Width"};
233 static constexpr std::string_view borderColor {"Color"};
234 };
235
237 {
238 static constexpr std::string string {};
239 static constexpr bool show {false};
241 static constexpr iv::types::width width {50};
242 static constexpr iv::types::height height {50};
243 static constexpr iv::types::width borderWidth {0};
245 };
246};
247
248}// namespace iv::mimics
249
250#endif//IV_SRC_MIMICS_STRUCTS_HPP_
Definition xmlFile.hpp:15
T getAttribute(const std::string_view key, T defaultValue) const
Definition xmlFile.hpp:33
iv::file::xml::node getChild(std::string_view name) const
Definition xmlFile.cpp:43
bool addAttribute(const std::string_view key, T value)
Definition xmlFile.hpp:77
iv::file::xml::node appendChild(std::string_view name)
Definition xmlFile.cpp:53
Definition LogicExpression.hpp:14
std::optional< iv::types::color > hexToColor(const std::string_view hex)
Definition utils.cpp:28
std::string colorToHex(iv::types::color value, const bool hasAlpha)
Definition utils.cpp:18
constexpr iv::types::color Black
Definition color.hpp:21
constexpr iv::types::color White
Definition color.hpp:222
Definition GeneratorPmsBuilders.cpp:9
eTitleAlign
Definition enums.hpp:58
double height
Definition types.hpp:14
double padding
Definition types.hpp:16
double width
Definition types.hpp:23
uint32_t color
Definition types.hpp:12
double coord
Definition types.hpp:13
Definition structs.hpp:68
bool load(const iv::file::xml::node &nodePoint)
Definition structs.cpp:308
bool save(iv::file::xml::node &nodePoint) const
Definition structs.cpp:317
Definition structs.hpp:237
static constexpr bool show
Definition structs.hpp:239
static constexpr iv::types::color borderColor
Definition structs.hpp:244
static constexpr std::string string
Definition structs.hpp:238
static constexpr iv::types::height height
Definition structs.hpp:242
static constexpr iv::types::color color
Definition structs.hpp:240
static constexpr iv::types::width borderWidth
Definition structs.hpp:243
static constexpr iv::types::width width
Definition structs.hpp:241
Definition structs.hpp:227
static constexpr std::string_view color
Definition structs.hpp:229
static constexpr std::string_view show
Definition structs.hpp:228
static constexpr std::string_view width
Definition structs.hpp:230
static constexpr std::string_view borderWidth
Definition structs.hpp:232
static constexpr std::string_view borderColor
Definition structs.hpp:233
static constexpr std::string_view height
Definition structs.hpp:231
Definition structs.hpp:221
static constexpr std::string_view border
Definition structs.hpp:223
static constexpr std::string_view location
Definition structs.hpp:222
Definition structs.hpp:176
iv::types::height height
Definition structs.hpp:215
bool show
Definition structs.hpp:211
void save(iv::file::xml::node &nodeBackground) const
Definition structs.hpp:198
Background()
Definition structs.hpp:177
iv::types::color color
Definition structs.hpp:212
iv::mimics::Location location
Definition structs.hpp:213
iv::types::width width
Definition structs.hpp:214
iv::types::width borderWidth
Definition structs.hpp:216
void load(const iv::file::xml::node &nodeBackground)
Definition structs.hpp:184
iv::types::color borderColor
Definition structs.hpp:217
static constexpr bool hideCommands
Definition structs.hpp:171
Definition structs.hpp:165
static constexpr std::string_view hideCommands
Definition structs.hpp:166
static constexpr std::string_view hideCondition
Definition structs.hpp:167
Definition structs.hpp:147
iv::logics::LogicExpression hideCondition
Definition structs.hpp:161
bool save(iv::file::xml::node &nodeHideCommandsSettings) const
Definition structs.hpp:154
bool hideCommands
Definition structs.hpp:160
bool load(const iv::file::xml::node &nodeHideCommandsSettings)
Definition structs.hpp:148
Definition structs.hpp:60
static constexpr iv::types::coord position
Definition structs.hpp:61
static constexpr iv::types::coord rotation
Definition structs.hpp:62
Definition structs.hpp:55
static constexpr std::string_view rotation
Definition structs.hpp:56
Definition structs.hpp:49
static constexpr std::string_view position
Definition structs.hpp:50
static constexpr std::string_view rotationInGrades
Definition structs.hpp:51
Definition structs.hpp:15
double rotation
Definition structs.hpp:45
Location()
Definition structs.hpp:16
bool load(const iv::file::xml::node &nodeLocation)
Definition structs.hpp:22
bool save(iv::file::xml::node &nodeLocation) const
Definition structs.hpp:33
iv::math::geometry::Point3d position
Definition structs.hpp:44
static constexpr iv::types::color color
Definition structs.hpp:136
static constexpr std::string string
Definition structs.hpp:131
static constexpr iv::mimics::eTitleAlign align
Definition structs.hpp:133
static constexpr iv::types::padding padding
Definition structs.hpp:135
static constexpr iv::types::height height
Definition structs.hpp:134
static constexpr bool show
Definition structs.hpp:132
Definition structs.hpp:122
static constexpr std::string_view align
Definition structs.hpp:124
static constexpr std::string_view color
Definition structs.hpp:127
static constexpr std::string_view padding
Definition structs.hpp:126
static constexpr std::string_view show
Definition structs.hpp:123
static constexpr std::string_view height
Definition structs.hpp:125
Definition structs.hpp:139
static constexpr std::string_view location
Definition structs.hpp:142
static constexpr std::string_view title
Definition structs.hpp:141
static constexpr std::string_view titles
Definition structs.hpp:140
Definition structs.hpp:67
iv::types::color color
Definition structs.hpp:116
bool show
Definition structs.hpp:112
iv::mimics::eTitleAlign align
Definition structs.hpp:113
iv::types::padding padding
Definition structs.hpp:115
iv::model::LocalizedText titles
Definition structs.hpp:117
bool save(iv::file::xml::node &nodeTitleSettings) const
Definition structs.hpp:95
iv::types::height height
Definition structs.hpp:114
TitleSettings()
Definition structs.hpp:68
iv::mimics::Location location
Definition structs.hpp:118
bool load(const iv::file::xml::node &nodeTitleSettings)
Definition structs.hpp:74
Definition structs.hpp:29
bool save(iv::file::xml::node &nodeLocalizedText, std::string_view localizedTextNodeName) const
Definition structs.cpp:88
bool load(const iv::file::xml::node &nodeLocalizedTexts)
Definition structs.cpp:63