blob: 4f92e9f6e2d2e00cc31b1b8d7afe4787de88845c (
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.h"
#include "cru/common/ClonablePtr.h"
#include "cru/ui/style/Condition.h"
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
|