aboutsummaryrefslogtreecommitdiff
path: root/src/ui/mapper
diff options
context:
space:
mode:
authorYuqian Yang <crupest@crupest.life>2025-10-17 12:06:14 +0800
committerYuqian Yang <crupest@crupest.life>2025-10-17 12:06:14 +0800
commit32aa6f116acc6e3e20a1ec76cef45b29f7005ad7 (patch)
tree892b71060a88b58d9293d78033000b05818783df /src/ui/mapper
parentfaf77949e19dc0d01f75bf8abb783eda70328048 (diff)
downloadcru-32aa6f116acc6e3e20a1ec76cef45b29f7005ad7.tar.gz
cru-32aa6f116acc6e3e20a1ec76cef45b29f7005ad7.tar.bz2
cru-32aa6f116acc6e3e20a1ec76cef45b29f7005ad7.zip
Remove String stage 1.
Diffstat (limited to 'src/ui/mapper')
-rw-r--r--src/ui/mapper/ColorMapper.cpp2
-rw-r--r--src/ui/mapper/FontMapper.cpp4
-rw-r--r--src/ui/mapper/Mapper.cpp3
-rw-r--r--src/ui/mapper/PointMapper.cpp2
-rw-r--r--src/ui/mapper/SizeMapper.cpp2
-rw-r--r--src/ui/mapper/StringMapper.cpp3
-rw-r--r--src/ui/mapper/ThicknessMapper.cpp1
-rw-r--r--src/ui/mapper/style/ContentBrushStylerMapper.cpp2
-rw-r--r--src/ui/mapper/style/FontStylerMapper.cpp2
-rw-r--r--src/ui/mapper/style/MarginStylerMapper.cpp2
-rw-r--r--src/ui/mapper/style/PaddingStylerMapper.cpp2
11 files changed, 16 insertions, 9 deletions
diff --git a/src/ui/mapper/ColorMapper.cpp b/src/ui/mapper/ColorMapper.cpp
index dcf3a522..82e9dfbc 100644
--- a/src/ui/mapper/ColorMapper.cpp
+++ b/src/ui/mapper/ColorMapper.cpp
@@ -1,5 +1,7 @@
#include "cru/ui/mapper/ColorMapper.h"
+#include <cru/base/String.h>
+
namespace cru::ui::mapper {
bool ColorMapper::XmlElementIsOfThisType(xml::XmlElementNode* node) {
return cru::string::CaseInsensitiveCompare(node->GetTag(), "Color") == 0;
diff --git a/src/ui/mapper/FontMapper.cpp b/src/ui/mapper/FontMapper.cpp
index bb3550ea..1f749513 100644
--- a/src/ui/mapper/FontMapper.cpp
+++ b/src/ui/mapper/FontMapper.cpp
@@ -1,5 +1,6 @@
#include "cru/ui/mapper/FontMapper.h"
#include "../Helper.h"
+#include "cru/base/String.h"
#include "cru/platform/graphics/Factory.h"
namespace cru::ui::mapper {
@@ -16,7 +17,6 @@ std::shared_ptr<platform::graphics::IFont> FontMapper::DoMapFromXml(
auto font_size =
font_size_attr ? String::FromUtf8(*font_size_attr).ParseToFloat() : 24.0f;
- return GetGraphicsFactory()->CreateFont(String::FromUtf8(font_family),
- font_size);
+ return GetGraphicsFactory()->CreateFont(font_family, font_size);
}
} // namespace cru::ui::mapper
diff --git a/src/ui/mapper/Mapper.cpp b/src/ui/mapper/Mapper.cpp
index ca6cf0b3..47e783c9 100644
--- a/src/ui/mapper/Mapper.cpp
+++ b/src/ui/mapper/Mapper.cpp
@@ -9,8 +9,7 @@ MapperBase::MapperBase(std::type_index type_index)
bool MapperBase::XmlElementIsOfThisType(xml::XmlElementNode* node) {
for (const auto& tag : allowed_tags_) {
- if (cru::string::CaseInsensitiveCompare(node->GetTag(), tag.ToUtf8()) ==
- 0) {
+ if (cru::string::CaseInsensitiveCompare(node->GetTag(), tag) == 0) {
return true;
}
}
diff --git a/src/ui/mapper/PointMapper.cpp b/src/ui/mapper/PointMapper.cpp
index 16731544..12f000ef 100644
--- a/src/ui/mapper/PointMapper.cpp
+++ b/src/ui/mapper/PointMapper.cpp
@@ -1,5 +1,7 @@
#include "cru/ui/mapper/PointMapper.h"
+#include <cru/base/String.h>
+
namespace cru::ui::mapper {
bool PointMapper::XmlElementIsOfThisType(xml::XmlElementNode* node) {
return cru::string::CaseInsensitiveCompare(node->GetTag(), "Point") == 0;
diff --git a/src/ui/mapper/SizeMapper.cpp b/src/ui/mapper/SizeMapper.cpp
index f976bfe4..de8a0ded 100644
--- a/src/ui/mapper/SizeMapper.cpp
+++ b/src/ui/mapper/SizeMapper.cpp
@@ -1,5 +1,7 @@
#include "cru/ui/mapper/SizeMapper.h"
+#include <cru/base/String.h>
+
namespace cru::ui::mapper {
bool SizeMapper::XmlElementIsOfThisType(xml::XmlElementNode* node) {
return cru::string::CaseInsensitiveCompare(node->GetTag(), "Size") == 0;
diff --git a/src/ui/mapper/StringMapper.cpp b/src/ui/mapper/StringMapper.cpp
index 6e224d3f..5914da17 100644
--- a/src/ui/mapper/StringMapper.cpp
+++ b/src/ui/mapper/StringMapper.cpp
@@ -1,8 +1,9 @@
#include "cru/ui/mapper/StringMapper.h"
#include "cru/xml/XmlNode.h"
+#include "cru/base/String.h"
namespace cru::ui::mapper {
-StringMapper::StringMapper() { SetAllowedTags({u"String"}); }
+StringMapper::StringMapper() { SetAllowedTags({"String"}); }
StringMapper::~StringMapper() {}
diff --git a/src/ui/mapper/ThicknessMapper.cpp b/src/ui/mapper/ThicknessMapper.cpp
index 61c3641c..96f016a7 100644
--- a/src/ui/mapper/ThicknessMapper.cpp
+++ b/src/ui/mapper/ThicknessMapper.cpp
@@ -1,5 +1,6 @@
#include "cru/ui/mapper/ThicknessMapper.h"
#include "cru/xml/XmlNode.h"
+#include "cru/base/String.h"
namespace cru::ui::mapper {
bool ThicknessMapper::XmlElementIsOfThisType(xml::XmlElementNode* node) {
diff --git a/src/ui/mapper/style/ContentBrushStylerMapper.cpp b/src/ui/mapper/style/ContentBrushStylerMapper.cpp
index b3571374..027622fe 100644
--- a/src/ui/mapper/style/ContentBrushStylerMapper.cpp
+++ b/src/ui/mapper/style/ContentBrushStylerMapper.cpp
@@ -7,7 +7,7 @@
namespace cru::ui::mapper::style {
ContentBrushStylerMapper::ContentBrushStylerMapper() {
- SetAllowedTags({u"ContentBrushStyler"});
+ SetAllowedTags({"ContentBrushStyler"});
}
ContentBrushStylerMapper::~ContentBrushStylerMapper() {}
diff --git a/src/ui/mapper/style/FontStylerMapper.cpp b/src/ui/mapper/style/FontStylerMapper.cpp
index 3b1817ac..1555c071 100644
--- a/src/ui/mapper/style/FontStylerMapper.cpp
+++ b/src/ui/mapper/style/FontStylerMapper.cpp
@@ -3,7 +3,7 @@
#include "cru/ui/mapper/MapperRegistry.h"
namespace cru::ui::mapper::style {
-FontStylerMapper::FontStylerMapper() { SetAllowedTags({u"FontStyler"}); }
+FontStylerMapper::FontStylerMapper() { SetAllowedTags({"FontStyler"}); }
FontStylerMapper::~FontStylerMapper() {}
diff --git a/src/ui/mapper/style/MarginStylerMapper.cpp b/src/ui/mapper/style/MarginStylerMapper.cpp
index 0968b53e..ffbdcd75 100644
--- a/src/ui/mapper/style/MarginStylerMapper.cpp
+++ b/src/ui/mapper/style/MarginStylerMapper.cpp
@@ -4,7 +4,7 @@
#include "cru/ui/style/Styler.h"
namespace cru::ui::mapper::style {
-MarginStylerMapper::MarginStylerMapper() { SetAllowedTags({u"MarginStyler"}); }
+MarginStylerMapper::MarginStylerMapper() { SetAllowedTags({"MarginStyler"}); }
MarginStylerMapper::~MarginStylerMapper() {}
diff --git a/src/ui/mapper/style/PaddingStylerMapper.cpp b/src/ui/mapper/style/PaddingStylerMapper.cpp
index 0f0f87d7..faa86082 100644
--- a/src/ui/mapper/style/PaddingStylerMapper.cpp
+++ b/src/ui/mapper/style/PaddingStylerMapper.cpp
@@ -5,7 +5,7 @@
namespace cru::ui::mapper::style {
PaddingStylerMapper::PaddingStylerMapper() {
- SetAllowedTags({u"PaddingStyler"});
+ SetAllowedTags({"PaddingStyler"});
}
PaddingStylerMapper::~PaddingStylerMapper() {}