aboutsummaryrefslogtreecommitdiff
path: root/src/ui/mapper/CornerRadiusMapper.cpp
blob: ca89c18615fc1d65d8d87595062d2e47f50d2845 (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
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "cru/ui/mapper/CornerRadiusMapper.h"
#include "cru/ui/mapper/MapperRegistry.h"

namespace cru::ui::mapper {
CornerRadius CornerRadiusMapper::DoMapFromXml(xml::XmlElementNode* node) {
  auto point_mapper = MapperRegistry::GetInstance()->GetMapper<Point>();
  CornerRadius result;

  auto all = node->GetOptionalAttributeValueCaseInsensitive("all");
  if (all) {
    result.SetAll(point_mapper->MapFromString(*all));
  }

  auto lefttop = node->GetOptionalAttributeValueCaseInsensitive("lefttop");
  if (lefttop) {
    result.left_top = point_mapper->MapFromString(*lefttop);
  }

  auto righttop = node->GetOptionalAttributeValueCaseInsensitive("righttop");
  if (righttop) {
    result.right_top = point_mapper->MapFromString(*righttop);
  }

  auto rightbottom =
      node->GetOptionalAttributeValueCaseInsensitive("rightbottom");
  if (rightbottom) {
    result.right_bottom = point_mapper->MapFromString(*rightbottom);
  }

  auto leftbottom =
      node->GetOptionalAttributeValueCaseInsensitive("leftbottom");
  if (leftbottom) {
    result.left_bottom = point_mapper->MapFromString(*leftbottom);
  }

  return result;
}
}  // namespace cru::ui::mapper