From 8ec40f9293364a33957aa5e95b280c15afa85e8a Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sun, 25 Feb 2024 13:39:49 +0100 Subject: [PATCH] Move TwitchEmoteOccurrence to TwitchCommon.hpp --- .../twitch/EventSubMessageBuilder.hpp | 7 ++++++- src/providers/twitch/TwitchCommon.hpp | 18 ++++++++++++++++++ src/providers/twitch/TwitchMessageBuilder.hpp | 14 +------------- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/providers/twitch/EventSubMessageBuilder.hpp b/src/providers/twitch/EventSubMessageBuilder.hpp index 61f07136e..74b95a502 100644 --- a/src/providers/twitch/EventSubMessageBuilder.hpp +++ b/src/providers/twitch/EventSubMessageBuilder.hpp @@ -3,7 +3,7 @@ #include "common/Aliases.hpp" #include "common/Outcome.hpp" #include "messages/SharedMessageBuilder.hpp" -#include "providers/twitch/TwitchMessageBuilder.hpp" // TODO: REMOVE +#include "providers/twitch/TwitchCommon.hpp" #include #include @@ -38,6 +38,11 @@ class EventSubMessageBuilder : MessageBuilder public: EventSubMessageBuilder() = delete; + EventSubMessageBuilder(const EventSubMessageBuilder &) = delete; + EventSubMessageBuilder &operator=(const EventSubMessageBuilder &) = delete; + + EventSubMessageBuilder(EventSubMessageBuilder &&) = delete; + EventSubMessageBuilder &operator=(EventSubMessageBuilder &&) = delete; /** * NOTE: The builder MUST NOT survive longer than the payload **/ diff --git a/src/providers/twitch/TwitchCommon.hpp b/src/providers/twitch/TwitchCommon.hpp index 19f538c2a..b14db8410 100644 --- a/src/providers/twitch/TwitchCommon.hpp +++ b/src/providers/twitch/TwitchCommon.hpp @@ -1,5 +1,7 @@ #pragma once +#include "common/Aliases.hpp" + #include #include @@ -7,6 +9,9 @@ namespace chatterino { +struct Emote; +using EmotePtr = std::shared_ptr; + #ifndef ATTR_UNUSED # ifdef Q_OS_WIN # define ATTR_UNUSED @@ -81,4 +86,17 @@ static const QStringList TWITCH_DEFAULT_COMMANDS{ static const QStringList TWITCH_WHISPER_COMMANDS{"/w", ".w"}; +struct TwitchEmoteOccurrence { + int start; + int end; + EmotePtr ptr; + EmoteName name; + + bool operator==(const TwitchEmoteOccurrence &other) const + { + return std::tie(this->start, this->end, this->ptr, this->name) == + std::tie(other.start, other.end, other.ptr, other.name); + } +}; + } // namespace chatterino diff --git a/src/providers/twitch/TwitchMessageBuilder.hpp b/src/providers/twitch/TwitchMessageBuilder.hpp index dd38fc790..48784e3ed 100644 --- a/src/providers/twitch/TwitchMessageBuilder.hpp +++ b/src/providers/twitch/TwitchMessageBuilder.hpp @@ -3,6 +3,7 @@ #include "common/Aliases.hpp" #include "common/Outcome.hpp" #include "messages/SharedMessageBuilder.hpp" +#include "providers/twitch/TwitchCommon.hpp" #include "pubsubmessages/LowTrustUsers.hpp" #include @@ -26,19 +27,6 @@ using HelixModerator = HelixVip; struct ChannelPointReward; struct DeleteAction; -struct TwitchEmoteOccurrence { - int start; - int end; - EmotePtr ptr; - EmoteName name; - - bool operator==(const TwitchEmoteOccurrence &other) const - { - return std::tie(this->start, this->end, this->ptr, this->name) == - std::tie(other.start, other.end, other.ptr, other.name); - } -}; - class TwitchMessageBuilder : public SharedMessageBuilder { public: