diff options
author | Yuqian Yang <crupest@crupest.life> | 2025-09-07 03:34:56 +0800 |
---|---|---|
committer | Yuqian Yang <crupest@crupest.life> | 2025-09-07 03:34:56 +0800 |
commit | 20123151d12a0b01453ab6a36c84e4d3e5ea9504 (patch) | |
tree | 27543f3e5bf6430298c94c38bad6ecc83dafdd47 /include/cru/ui | |
parent | 227118866190a7fe17b42e8c589c475781c69f33 (diff) | |
download | cru-20123151d12a0b01453ab6a36c84e4d3e5ea9504.tar.gz cru-20123151d12a0b01453ab6a36c84e4d3e5ea9504.tar.bz2 cru-20123151d12a0b01453ab6a36c84e4d3e5ea9504.zip |
Remove some usage of my format.
Diffstat (limited to 'include/cru/ui')
-rw-r--r-- | include/cru/ui/ThemeManager.h | 1 | ||||
-rw-r--r-- | include/cru/ui/ThemeResourceDictionary.h | 1 | ||||
-rw-r--r-- | include/cru/ui/render/MeasureRequirement.h | 24 |
3 files changed, 19 insertions, 7 deletions
diff --git a/include/cru/ui/ThemeManager.h b/include/cru/ui/ThemeManager.h index d4e6a096..f3f01313 100644 --- a/include/cru/ui/ThemeManager.h +++ b/include/cru/ui/ThemeManager.h @@ -1,6 +1,7 @@ #pragma once #include "Base.h" #include "cru/base/Event.h" +#include "cru/base/Format.h" #include "cru/ui/ThemeResourceDictionary.h" #include <vector> diff --git a/include/cru/ui/ThemeResourceDictionary.h b/include/cru/ui/ThemeResourceDictionary.h index 597fe707..c3fcfde2 100644 --- a/include/cru/ui/ThemeResourceDictionary.h +++ b/include/cru/ui/ThemeResourceDictionary.h @@ -2,6 +2,7 @@ #include "Base.h" #include "cru/base/Base.h" +#include "cru/base/Format.h" #include "cru/xml/XmlNode.h" #include "mapper/MapperRegistry.h" #include "style/StyleRuleSet.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 <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), |