blob: 1a7ffd959aa9668c08404e8cdf5625f9aef1d112 (
plain)
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
|
#include "cru/ui/mapper/style/HoverConditionMapper.h"
#include "cru/base/ClonablePtr.h"
#include "cru/base/StringUtil.h"
#include "cru/ui/style/Condition.h"
namespace cru::ui::mapper::style {
using namespace cru::ui::style;
bool HoverConditionMapper::XmlElementIsOfThisType(xml::XmlElementNode* node) {
return cru::string::CaseInsensitiveCompare(node->GetTag(),
"HoverCondition") == 0;
}
ClonablePtr<HoverCondition> HoverConditionMapper::DoMapFromXml(
xml::XmlElementNode* node) {
auto value = node->GetAttributeValueCaseInsensitive("value");
if (cru::string::CaseInsensitiveCompare(value, "true") == 0) {
return ui::style::HoverCondition::Create(true);
} else if (cru::string::CaseInsensitiveCompare(value, "false") == 0) {
return ui::style::HoverCondition::Create(false);
} else {
throw Exception("Invalid value for HoverCondition: " + value);
}
}
} // namespace cru::ui::mapper::style
|