From 62a0c3f1785e789357c892d94b3ea0bc3ea6833e Mon Sep 17 00:00:00 2001 From: crupest Date: Sun, 6 Mar 2022 16:38:51 +0800 Subject: ... --- src/ui/mapper/style/FontStylerMapper.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/ui/mapper/style/FontStylerMapper.cpp (limited to 'src/ui/mapper/style') diff --git a/src/ui/mapper/style/FontStylerMapper.cpp b/src/ui/mapper/style/FontStylerMapper.cpp new file mode 100644 index 00000000..884832ee --- /dev/null +++ b/src/ui/mapper/style/FontStylerMapper.cpp @@ -0,0 +1,25 @@ +#include "cru/ui/mapper/style/FontStylerMapper.h" +#include "cru/common/ClonablePtr.h" +#include "cru/ui/mapper/MapperRegistry.h" + +namespace cru::ui::mapper::style { +FontStylerMapper::FontStylerMapper() { SetAllowedTags({u"FontStyler"}); } + +FontStylerMapper::~FontStylerMapper() {} + +ClonablePtr FontStylerMapper::DoMapFromXml( + xml::XmlElementNode* node) { + auto font_mapper = MapperRegistry::GetInstance() + ->GetSharedPtrMapper(); + + std::shared_ptr font; + + for (auto child_node : node->GetChildren()) { + if (child_node->IsElementNode()) { + font = font_mapper->MapFromXml(child_node->AsElement()); + } + } + + return ui::style::FontStyler::Create(std::move(font)); +} +} // namespace cru::ui::mapper::style -- cgit v1.2.3