11#include <fmt/format.h>
15struct fmt::formatter<
ice::StringID_Hash>
17 template<
typename ParseContext>
18 constexpr auto parse(ParseContext& ctx)
23 template<
typename FormatContext>
28 return fmt::format_to(ctx.out(),
"[sid_hash:<invalid>]");
32 return fmt::format_to(ctx.out(),
"[sid_hash:{:16x}]", value.value);
37template<
bool DebugImpl>
38struct fmt::formatter<
ice::BaseStringID<DebugImpl>>
40 template<
typename ParseContext>
41 constexpr auto parse(ParseContext& ctx)
46 template<
typename FormatContext>
51 return fmt::format_to(ctx.out(),
"[sid:<invalid>]");
55 if constexpr (DebugImpl ==
false)
68struct fmt::formatter<
ice::ncount>
70 template<
typename ParseContext>
71 constexpr auto parse(ParseContext& ctx)
76 template<
typename FormatContext>
79 return fmt::format_to(ctx.out(),
"{}", value.native());
84struct fmt::formatter<
ice::usize>
88 template<
typename ParseContext>
89 constexpr auto parse(ParseContext& ctx)
91 auto it = ctx.begin(), end = ctx.end();
93 if (it != end && (*it ==
'i' || *it ==
'b' || *it ==
'p' || *it ==
'P'))
presentation = *it++;
96 if (it != end && *it !=
'}')
throw fmt::format_error(
"invalid format");
102 template<
typename FormatContext>
110 return fmt::format_to(ctx.out(),
"{}", value.value);
118 return fmt::format_to(ctx.out(),
"{} B", value.value);
122 return fmt::format_to(ctx.out(),
"{}B", value.value);
125 else if (value < 1_MiB)
129 return fmt::format_to(ctx.out(),
"{} KiB {} B", (value.value / 1024), value.value % 1024);
133 return fmt::format_to(ctx.out(),
"{}KiB {}B", (value.value / 1024), value.value % 1024);
140 return fmt::format_to(
142 "{} MiB {} KiB {} B",
143 (value.value / (1024 * 1024)), (value.value / 1024) % 1024, value.value % 1024
148 return fmt::format_to(
151 (value.value / (1024 * 1024)), (value.value / 1024) % 1024, value.value % 1024
157 return fmt::format_to(ctx.out(),
"{}B", value.value);
163struct fmt::formatter<
ice::
isize> : fmt::formatter<ice::usize>
165 template<
typename FormatContext>
168 auto output = ctx.out();
171 output = fmt::format_to(ctx.out(),
"-");
174 return fmt::formatter<ice::usize>::format(value.to_usize(), ctx);
181 template<
typename ParseContext>
182 constexpr auto parse(ParseContext& ctx)
187 template<
typename FormatContext>
190 fmt::string_view
const type = value.type() ==
'E' ?
"Error" :
"Success";
191 return fmt::format_to(ctx.out(),
"{}({}, '{}')", type, value.category(), value.description());
195template<ice::TimeType T>
196struct fmt::formatter<T>
207 template<
typename ParseContext>
208 constexpr auto parse(ParseContext& ctx)
210 auto it = ctx.begin(), end = ctx.end();
213 if (it != end && it[0] ==
'.')
219 if (it != end && (*it ==
'd' || *it ==
's' || *it ==
'm' || *it ==
'u' || *it ==
'n'))
presentation = *it++;
223 if (it != end && *it !=
'}')
throw fmt::format_error(
"invalid format");
229 template<
typename FormatContext>
233 if (final_presentation ==
'd')
240 switch(final_presentation)
243 case 'm':
return fmt::format_to(ctx.out(),
"{}ms",
ice::Tms(value).
value);
244 case 'u':
return fmt::format_to(ctx.out(),
"{}us",
ice::Tus(value).
value);
246 default:
return fmt::format_to(ctx.out(),
"{}ns",
ice::Tns(value).
value);
251 switch(final_presentation)
Definition clock_types.hxx:115
SPDX-License-Identifier: MIT.
Definition array.hxx:12
std::conditional_t< ice::build::Constant_StringID_DebugInfoEnabled, StringID const &, StringID > StringID_Arg
Argument type used to pass ice::StringID values to functions.
Definition stringid.hxx:23
constexpr auto stringid_hash(ice::BaseStringID< HasDebugInfo > val) noexcept -> ice::detail::stringid_type_v3::StringID_Hash
Definition stringid.hxx:183
constexpr auto stringid_hint(ice::BaseStringID< false > val) noexcept -> std::string_view
Definition stringid.hxx:155
std::uint8_t u8
Definition types.hxx:24
static constexpr ice::StringID StringID_Invalid
Definition stringid.hxx:90
Represents time interval of milliseconds.
Definition clock_types.hxx:38
ValueType value
Definition clock_types.hxx:42
Represents time interval of nanoseconds.
Definition clock_types.hxx:73
ValueType value
Definition clock_types.hxx:77
Represents time interval of seconds.
Definition clock_types.hxx:21
ValueType value
Definition clock_types.hxx:25
Represents time interval of microseconds.
Definition clock_types.hxx:56
ValueType value
Definition clock_types.hxx:60
Internal hash type representing the hashed string value.
Definition stringid.hxx:34
Represents a signed size value on the given platform.
Definition mem_size_types.hxx:14
Represents a unsigned size value on the given platform.
Definition mem_size_types.hxx:26