chore(eventsub): add operator== and indicator for shared chat (#5974)

This commit is contained in:
nerix
2025-02-22 20:55:20 +01:00
committed by GitHub
parent f540be3446
commit 7fee3f7e37
7 changed files with 98 additions and 10 deletions
@@ -152,6 +152,24 @@ struct String {
return (this->flags & (ALLOC_BIT | QT_BIT)) == 0;
}
// note: because we're using C++ 20, the reversed operator
// (e.g. QAnyStringView == String) is automatically "synthesized".
bool operator==(const QAnyStringView &other) const noexcept
{
return this->view() == other;
}
bool operator==(const String &other) const noexcept
{
return this->view() == other.view();
}
template <typename = void> // weak overload
bool operator==(const std::string_view &other) const noexcept
{
return this->view() == other;
}
private:
static constexpr size_t QT_BIT = 1ULL << (sizeof(size_t) * 8 - 1);
static constexpr size_t ALLOC_BIT = 1ULL << (sizeof(size_t) * 8 - 2);