From 20123151d12a0b01453ab6a36c84e4d3e5ea9504 Mon Sep 17 00:00:00 2001 From: Yuqian Yang Date: Sun, 7 Sep 2025 03:34:56 +0800 Subject: Remove some usage of my format. --- include/cru/ui/render/MeasureRequirement.h | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'include/cru/ui/render/MeasureRequirement.h') diff --git a/include/cru/ui/render/MeasureRequirement.h b/include/cru/ui/render/MeasureRequirement.h index 3f4e0a3d..544e0788 100644 --- a/include/cru/ui/render/MeasureRequirement.h +++ b/include/cru/ui/render/MeasureRequirement.h @@ -4,7 +4,9 @@ #include "cru/base/String.h" #include +#include #include +#include namespace cru::ui::render { constexpr Size Min(const Size& left, const Size& right) { @@ -111,10 +113,13 @@ class MeasureLength final { } } - String ToDebugString() const { - return IsSpecified() ? ToString(GetLengthOrUndefined()) : u"UNSPECIFIED"; + std::string ToDebugStringUtf8() const { + return IsSpecified() ? std::to_string(GetLengthOrUndefined()) + : "UNSPECIFIED"; } + String ToDebugString() const { return String::FromUtf8(ToDebugStringUtf8()); } + private: // -1 for not specify float length_; @@ -163,10 +168,13 @@ struct MeasureSize { }; } - String ToDebugString() const { - return Format(u"({}, {})", width.ToDebugString(), height.ToDebugString()); + std::string ToDebugStringUtf8() const { + return std::format("({}, {})", width.ToDebugStringUtf8(), + height.ToDebugStringUtf8()); } + String ToDebugString() const { return String::FromUtf8(ToDebugStringUtf8()); } + constexpr static MeasureSize NotSpecified() { return MeasureSize{MeasureLength::NotSpecified(), MeasureLength::NotSpecified()}; @@ -233,11 +241,13 @@ struct MeasureRequirement { return result; } - String ToDebugString() const { - return Format(u"{{min: {}, max: {}}}", min.ToDebugString(), - max.ToDebugString()); + std::string ToDebugStringUtf8() const { + return std::format("{{min: {}, max: {}}}", min.ToDebugStringUtf8(), + max.ToDebugStringUtf8()); } + String ToDebugString() const { return String::FromUtf8(ToDebugStringUtf8()); } + constexpr static MeasureRequirement Merge(const MeasureRequirement& left, const MeasureRequirement& right) { return MeasureRequirement{MeasureSize::Min(left.max, right.max), -- cgit v1.2.3