ESFormats: Make Content easier to compare
This commit is contained in:
parent
1a4883ac5a
commit
2974c56e50
|
@ -67,6 +67,17 @@ bool Content::IsOptional() const
|
|||
return (type & 0x4000) != 0;
|
||||
}
|
||||
|
||||
bool operator==(const Content& lhs, const Content& rhs)
|
||||
{
|
||||
auto fields = [](const Content& c) { return std::tie(c.id, c.index, c.type, c.size, c.sha1); };
|
||||
return fields(lhs) == fields(rhs);
|
||||
}
|
||||
|
||||
bool operator!=(const Content& lhs, const Content& rhs)
|
||||
{
|
||||
return !operator==(lhs, rhs);
|
||||
}
|
||||
|
||||
SignedBlobReader::SignedBlobReader(const std::vector<u8>& bytes) : m_bytes(bytes)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -93,6 +93,8 @@ struct Content
|
|||
std::array<u8, 20> sha1;
|
||||
};
|
||||
static_assert(sizeof(Content) == 36, "Content has the wrong size");
|
||||
bool operator==(const Content&, const Content&);
|
||||
bool operator!=(const Content&, const Content&);
|
||||
|
||||
struct TimeLimit
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue