chore(eventsub): add operator== and indicator for shared chat (#5974)
This commit is contained in:
@@ -389,11 +389,11 @@ struct Event {
|
||||
String broadcasterUserName;
|
||||
|
||||
/// For Shared Chat events, the user ID (e.g. 117166826) of the user who's channel the event took place in
|
||||
std::optional<std::string> sourceBroadcasterUserID;
|
||||
std::optional<String> sourceBroadcasterUserID;
|
||||
/// For Shared Chat events, the user Login (e.g. testaccount_420) of the user who's channel the event took place in
|
||||
std::optional<std::string> sourceBroadcasterUserLogin;
|
||||
std::optional<String> sourceBroadcasterUserLogin;
|
||||
/// For Shared Chat events, the user Name (e.g. 테스트계정420) of the user who's channel the event took place in
|
||||
std::optional<std::string> sourceBroadcasterUserName;
|
||||
std::optional<String> sourceBroadcasterUserName;
|
||||
|
||||
/// User ID (e.g. 117166826) of the user who took the action
|
||||
String moderatorUserID;
|
||||
@@ -439,6 +439,8 @@ struct Event {
|
||||
SharedChatDelete, //
|
||||
std::string>
|
||||
action;
|
||||
|
||||
bool isFromSharedChat() const noexcept;
|
||||
};
|
||||
|
||||
struct Payload {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user