Make TwitchEmotes class conform to QString standard

Make twitch emotes only be identified by a string ID, instead of sometimes by a string and sometimes by an int

Make the EmoteSet a struct instead of just a vector of emotes. This will be handy when we later fill in the emote sets name and other info (i.e. whether it's a subscription benifit or not)
This commit is contained in:
Rasmus Karlsson
2018-06-07 13:01:06 +02:00
parent 3bc7e2da8a
commit 93fe7adce7
4 changed files with 54 additions and 40 deletions
+24 -10
View File
@@ -15,27 +15,41 @@ namespace twitch {
class TwitchEmotes
{
public:
util::EmoteData getEmoteById(long int id, const QString &emoteName);
util::EmoteData getEmoteById(const QString &id, const QString &emoteName);
/// Twitch emotes
void refresh(const std::shared_ptr<providers::twitch::TwitchAccount> &user);
struct TwitchEmote {
TwitchEmote(const QString &_id, const QString &_code)
: id(_id)
, code(_code)
{
}
// i.e. "403921"
QString id;
// i.e. "forsenE"
QString code;
};
struct EmoteSet {
QString key;
std::vector<TwitchEmote> emotes;
};
struct TwitchAccountEmoteData {
struct TwitchEmote {
std::string id;
std::string code;
};
std::vector<EmoteSet> emoteSets;
// emote set
std::map<std::string, std::vector<TwitchEmote>> emoteSets;
std::vector<std::string> emoteCodes;
std::vector<QString> emoteCodes;
util::EmoteMap emotes;
bool filled = false;
};
// Key is the user ID
std::map<QString, TwitchAccountEmoteData> emotes;
private:
@@ -43,7 +57,7 @@ private:
util::ConcurrentMap<QString, providers::twitch::EmoteValue *> _twitchEmotes;
// emote id
util::ConcurrentMap<long, util::EmoteData> _twitchEmoteFromCache;
util::ConcurrentMap<QString, util::EmoteData> _twitchEmoteFromCache;
};
} // namespace twitch