132struct fmt::formatter<std::filesystem::path> : fmt::formatter<std::string_view>
134 template <
typename FormatContext>
135 auto format (
const std::filesystem::path &p, FormatContext &ctx)
const
137 return fmt::formatter<std::string_view>::format (
138 utils::Utf8String::from_path (p).view (), ctx);
144struct fmt::formatter<juce::String> : fmt::formatter<std::string_view>
146 template <
typename FormatContext>
147 auto format (
const juce::String &s, FormatContext &ctx)
const
149 return fmt::formatter<std::string_view>::format (
150 utils::Utf8String::from_juce_string (s).view (), ctx);
155template <>
struct fmt::formatter<juce::File> : fmt::formatter<std::string_view>
157 template <
typename FormatContext>
158 auto format (
const juce::File &s, FormatContext &ctx)
const
160 return fmt::formatter<std::string_view>::format (
161 utils::Utf8String::from_juce_string (s.getFullPathName ()).view (), ctx);
166template <>
struct fmt::formatter<QString> : fmt::formatter<std::string_view>
168 template <
typename FormatContext>
169 auto format (
const QString &s, FormatContext &ctx)
const
171 return fmt::formatter<std::string_view>::format (
172 utils::Utf8String::from_qstring (s).view (), ctx);
178struct fmt::formatter<Ptr> : fmt::formatter<std::string_view>
180 template <
typename FormatContext>
181 auto format (
const Ptr &ptr, FormatContext &ctx)
const
185 return fmt::formatter<std::string_view>::format (
186 fmt::format (
"{}", *ptr), ctx);
189 return fmt::formatter<std::string_view>::format (
"(null)", ctx);
195struct fmt::formatter<std::optional<T>> : fmt::formatter<std::string_view>
197 template <
typename FormatContext>
198 auto format (
const std::optional<T> &opt, FormatContext &ctx)
const
200 if (opt.has_value ())
202 return fmt::formatter<std::string_view>::format (
203 fmt::format (
"{}", *opt), ctx);
205 return fmt::formatter<std::string_view>::format (
"(nullopt)", ctx);
223struct fmt::formatter<QPointer<T>> : fmt::formatter<std::string_view>
225 template <
typename FormatContext>
226 auto format (
const QPointer<T> &opt, FormatContext &ctx)
const
230 return fmt::formatter<std::string_view>::format (
231 fmt::format (
"{}", *opt), ctx);
233 return fmt::formatter<std::string_view>::format (
"(null)", ctx);
255template <>
struct fmt::formatter<QUuid> : fmt::formatter<std::string_view>
257 template <
typename FormatContext>
258 auto format (
const QUuid &uuid, FormatContext &ctx)
const
260 return fmt::formatter<QString>{}.format (
261 uuid.toString (QUuid::WithoutBraces), ctx);
267struct fmt::formatter<std::source_location> : fmt::formatter<std::string_view>
269 template <
typename FormatContext>
270 auto format (
const std::source_location &loc, FormatContext &ctx)
const
272 return fmt::formatter<std::string_view>::format (
274 "{}:{}:{}:{}", loc.file_name (), loc.function_name (), loc.line (),
298struct fmt::formatter<T> : fmt::formatter<std::string_view>
300 template <
typename FormatContext>
301 auto format (
const T &val, FormatContext &ctx)
const
303 return fmt::formatter<std::string_view>::format (
304 fmt::format (
"{}", ENUM_NAME (val)), ctx);
318struct fmt::formatter<
322 boost::describe::has_describe_bases<T>::value
323 && boost::describe::has_describe_members<T>::value && !std::is_union_v<T>>>
325 constexpr auto parse (format_parse_context &ctx)
327 const auto * it = ctx.begin ();
328 const auto * end = ctx.end ();
330 if (it != end && *it !=
'}')
332 throw std::format_error (
"invalid format");
338 auto format (T
const &t, format_context &ctx)
const
340 using namespace boost::describe;
342 using Bd = describe_bases<T, mod_any_access>;
343 using Md = describe_members<T, mod_any_access>;
345 auto out = ctx.out ();
351 boost::mp11::mp_for_each<Bd> ([&] (
auto D) {
359 out = fmt::format_to (out,
" {}", (
typename decltype (D)::type
const &) t);
362 boost::mp11::mp_for_each<Md> ([&] (
auto D) {
370 out = fmt::format_to (out,
" .{}={}", D.name, t.*D.pointer);