mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-30 01:29:42 -06:00
fmt 10.0.0-10.1.1 compile fixes
Implicit conversion operators and enums was removed for parity with std::format (fce74caa15
).
This commit is contained in:
@ -3,8 +3,6 @@
|
||||
|
||||
#include "HRWrap.h"
|
||||
|
||||
#include <winrt/base.h>
|
||||
|
||||
namespace Common
|
||||
{
|
||||
std::string GetHResultMessage(HRESULT hr)
|
||||
@ -12,4 +10,8 @@ std::string GetHResultMessage(HRESULT hr)
|
||||
auto err = winrt::hresult_error(hr);
|
||||
return winrt::to_string(err.message());
|
||||
}
|
||||
std::string GetHResultMessage(const winrt::hresult& hr)
|
||||
{
|
||||
return GetHResultMessage(hr.value);
|
||||
}
|
||||
} // namespace Common
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <fmt/format.h>
|
||||
#include <string>
|
||||
#include <winerror.h>
|
||||
#include <winrt/base.h>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
|
||||
@ -33,3 +34,14 @@ struct fmt::formatter<Common::HRWrap>
|
||||
static_cast<u32>(hr.m_hr));
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct fmt::formatter<winrt::hresult>
|
||||
{
|
||||
constexpr auto parse(fmt::format_parse_context& ctx) { return ctx.begin(); }
|
||||
template <typename FormatContext>
|
||||
auto format(const winrt::hresult& hr, FormatContext& ctx) const
|
||||
{
|
||||
return fmt::format_to(ctx.out(), "{} ({:#010x})", Common::GetHResultMessage(hr), hr.value);
|
||||
}
|
||||
};
|
||||
|
@ -16,6 +16,8 @@
|
||||
#include <endian.h>
|
||||
#endif
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
|
||||
namespace Common
|
||||
@ -183,3 +185,15 @@ private:
|
||||
value_type raw;
|
||||
};
|
||||
} // Namespace Common
|
||||
|
||||
template <typename value_type>
|
||||
struct fmt::formatter<Common::BigEndianValue<value_type>>
|
||||
{
|
||||
fmt::formatter<value_type> m_formatter;
|
||||
constexpr auto parse(format_parse_context& ctx) { return m_formatter.parse(ctx); }
|
||||
template <typename FormatContext>
|
||||
auto format(const Common::BigEndianValue<value_type>& value, FormatContext& ctx) const
|
||||
{
|
||||
return m_formatter.format(value.operator value_type(), ctx);
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user