Move twitch emote-related stuff to TwitchEmotes class

This commit is contained in:
Rasmus Karlsson
2018-06-05 17:13:29 +02:00
committed by fourtf
parent 3a8ceede4e
commit e12d386a5a
8 changed files with 177 additions and 136 deletions
+51
View File
@@ -0,0 +1,51 @@
#pragma once
#include "providers/twitch/emotevalue.hpp"
#include "providers/twitch/twitchaccount.hpp"
#include "providers/twitch/twitchemotes.hpp"
#include "util/concurrentmap.hpp"
#include "util/emotemap.hpp"
#include <map>
namespace chatterino {
namespace providers {
namespace twitch {
class TwitchEmotes
{
public:
util::EmoteData getEmoteById(long int id, const QString &emoteName);
/// Twitch emotes
void refresh(const std::shared_ptr<providers::twitch::TwitchAccount> &user);
struct TwitchAccountEmoteData {
struct TwitchEmote {
std::string id;
std::string code;
};
// emote set
std::map<std::string, std::vector<TwitchEmote>> emoteSets;
std::vector<std::string> emoteCodes;
util::EmoteMap emotes;
bool filled = false;
};
std::map<std::string, TwitchAccountEmoteData> emotes;
private:
// emote code
util::ConcurrentMap<QString, providers::twitch::EmoteValue *> _twitchEmotes;
// emote id
util::ConcurrentMap<long, util::EmoteData> _twitchEmoteFromCache;
};
} // namespace twitch
} // namespace providers
} // namespace chatterino