13#include <fmt/format.h>
17struct fmt::formatter<QPointer<T>> : fmt::formatter<std::string_view>
19 auto format (
const QPointer<T> &opt, fmt::format_context &ctx)
const
20 -> format_context::iterator
24 return fmt::formatter<std::string_view>::format (
25 fmt::format (
"{}", *opt), ctx);
27 return fmt::formatter<std::string_view>::format (
"(null)", ctx);
33struct fmt::formatter<zrythm::utils::QObjectUniquePtr<T>>
34 : fmt::formatter<std::string_view>
38 fmt::format_context &ctx)
const -> format_context::iterator
42 return fmt::formatter<std::string_view>::format (
43 fmt::format (
"{}", *opt), ctx);
45 return fmt::formatter<std::string_view>::format (
"(null)", ctx);
50template <>
struct fmt::formatter<QString> : fmt::formatter<std::string_view>
52 auto format (
const QString &s, fmt::format_context &ctx)
const
53 -> format_context::iterator
55 return fmt::formatter<std::string_view>::format (s.toUtf8 (), ctx);
58static_assert (fmt::formattable<QString>);
62struct fmt::formatter<QStringList> : fmt::formatter<std::string_view>
64 auto format (
const QStringList &s, fmt::format_context &ctx)
const
65 -> format_context::iterator
67 return fmt::formatter<std::string_view>::format (
68 s.join (QString::fromUtf8 (
", ")).toUtf8 (), ctx);
71static_assert (fmt::formattable<QStringList>);
73template <
typename... Args>
75format_qstr (
const QString &format, Args &&... args)
77 return QString::fromUtf8 (
79 std::string_view (format.toUtf8 ()), fmt::make_format_args (args...)));
83template <>
struct fmt::formatter<QVariant> : fmt::formatter<std::string_view>
85 auto format (
const QVariant &v, fmt::format_context &ctx)
const
86 -> format_context::iterator
88 return fmt::formatter<std::string_view>::format (
89 v.toString ().toUtf8 (), ctx);
92static_assert (fmt::formattable<QVariant>);
96format_as (
const QUuid &uuid)
98 return uuid.toString (QUuid::WithoutBraces);
100static_assert (fmt::formattable<QUuid>);
A unique pointer for QObject objects that also works with QObject-based ownership.