refactor: rename Badge to TwitchBadge (#6706)
this change is made to clarify that the previously-called Badge object is actually specialized for Twitch badges
This commit is contained in:
@@ -12,7 +12,7 @@ const QSet<QString> channelAuthority{"lead_moderator", "moderator", "vip",
|
||||
"broadcaster"};
|
||||
const QSet<QString> subBadges{"subscriber", "founder"};
|
||||
|
||||
Badge::Badge(QString key, QString value)
|
||||
TwitchBadge::TwitchBadge(QString key, QString value)
|
||||
: key_(std::move(key))
|
||||
, value_(std::move(value))
|
||||
{
|
||||
@@ -34,7 +34,7 @@ Badge::Badge(QString key, QString value)
|
||||
}
|
||||
}
|
||||
|
||||
bool Badge::operator==(const Badge &other) const
|
||||
bool TwitchBadge::operator==(const TwitchBadge &other) const
|
||||
{
|
||||
return this->key_ == other.key_ && this->value_ == other.value_;
|
||||
}
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
class Badge
|
||||
class TwitchBadge
|
||||
{
|
||||
public:
|
||||
Badge(QString key, QString value);
|
||||
TwitchBadge(QString key, QString value);
|
||||
|
||||
bool operator==(const Badge &other) const;
|
||||
bool operator==(const TwitchBadge &other) const;
|
||||
|
||||
// Class members are fetched from both "badges" and "badge-info" tags
|
||||
// E.g.: "badges": "subscriber/18", "badge-info": "subscriber/22"
|
||||
|
||||
@@ -106,10 +106,10 @@ std::unordered_map<QString, QString> parseBadgeInfoTag(const QVariantMap &tags)
|
||||
return infoMap;
|
||||
}
|
||||
|
||||
std::vector<Badge> parseBadgeTag(const QVariantMap &tags,
|
||||
const QString &tagName)
|
||||
std::vector<TwitchBadge> parseBadgeTag(const QVariantMap &tags,
|
||||
const QString &tagName)
|
||||
{
|
||||
std::vector<Badge> b;
|
||||
std::vector<TwitchBadge> b;
|
||||
|
||||
auto badgesIt = tags.constFind(tagName);
|
||||
if (badgesIt == tags.end())
|
||||
@@ -127,7 +127,7 @@ std::vector<Badge> parseBadgeTag(const QVariantMap &tags,
|
||||
}
|
||||
|
||||
auto pair = slashKeyValue(badge);
|
||||
b.emplace_back(Badge{pair.first, pair.second});
|
||||
b.emplace_back(TwitchBadge{pair.first, pair.second});
|
||||
}
|
||||
|
||||
return b;
|
||||
|
||||
@@ -47,8 +47,8 @@ std::unordered_map<QString, QString> parseBadgeInfoTag(const QVariantMap &tags);
|
||||
/// @param tags The tags of the IRC message
|
||||
/// @param tagName The name of the tag to read badges from
|
||||
/// @returns A list of badges (name and version)
|
||||
std::vector<Badge> parseBadgeTag(const QVariantMap &tags,
|
||||
const QString &tagName = "badges");
|
||||
std::vector<TwitchBadge> parseBadgeTag(const QVariantMap &tags,
|
||||
const QString &tagName = "badges");
|
||||
|
||||
/// @brief Parses Twitch emotes in an IRC message
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user