blob: b78c12e99ecb286e3e21ba568112b7351503aa76 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#include "cru/ui/mapper/style/HoverConditionMapper.hpp"
#include "cru/common/ClonablePtr.hpp"
#include "cru/ui/style/Condition.hpp"
namespace cru::ui::mapper::style {
using namespace cru::ui::style;
bool HoverConditionMapper::XmlElementIsOfThisType(xml::XmlElementNode* node) {
return node->GetTag().CaseInsensitiveEqual(u"HoverCondition");
}
ClonablePtr<HoverCondition> HoverConditionMapper::DoMapFromXml(
xml::XmlElementNode* node) {
auto value = node->GetAttributeCaseInsensitive(u"value");
if (value.CaseInsensitiveEqual(u"true")) {
return ui::style::HoverCondition::Create(true);
} else if (value.CaseInsensitiveEqual(u"false")) {
return ui::style::HoverCondition::Create(false);
} else {
throw Exception(u"Invalid value for HoverCondition: " + value);
}
}
} // namespace cru::ui::mapper::style
|