aboutsummaryrefslogtreecommitdiff
path: root/include/cru/ui/render
diff options
context:
space:
mode:
Diffstat (limited to 'include/cru/ui/render')
-rw-r--r--include/cru/ui/render/MeasureRequirement.h24
1 files changed, 17 insertions, 7 deletions
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 <algorithm>
+#include <format>
#include <limits>
+#include <string>
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),