Formatter for Base/UUID and Math/Range
This commit is contained in:
@@ -15,6 +15,8 @@
|
||||
#endif
|
||||
#include "Math/ByteSize.hpp"
|
||||
#include "Math/Math.hpp"
|
||||
#include "Math/Range.hpp"
|
||||
#include "Base/UUID.hpp"
|
||||
#include <filesystem>
|
||||
|
||||
template<> struct fmt::formatter<OpenVulkano::ByteSize>
|
||||
@@ -158,3 +160,35 @@ struct fmt::formatter<glm::qua<T, Q>>
|
||||
return fmt::format_to(ctx.out(), "({}, {}, {}, {})", q.w, q.x, q.y, q.z);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct fmt::formatter<OpenVulkano::Math::Range<T>> : fmt::formatter<std::string>
|
||||
{
|
||||
template<typename ParseContext>
|
||||
constexpr auto parse(ParseContext& ctx)
|
||||
{
|
||||
return ctx.begin();
|
||||
}
|
||||
|
||||
template<typename FormatContext>
|
||||
auto format(const OpenVulkano::Math::Range<T>& range, FormatContext& ctx) const
|
||||
{
|
||||
return fmt::format_to(ctx.out(), "[{}, {}]", range.min, range.max);
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct fmt::formatter<OpenVulkano::UUID> : fmt::formatter<std::string>
|
||||
{
|
||||
template<typename ParseContext>
|
||||
constexpr auto parse(ParseContext& ctx)
|
||||
{
|
||||
return ctx.begin();
|
||||
}
|
||||
|
||||
template<typename FormatContext>
|
||||
auto format(const OpenVulkano::UUID& uuid, FormatContext& ctx) const
|
||||
{
|
||||
return fmt::format_to(ctx.out(), "{}", uuid.string());
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user