this commit is too big

This commit is contained in:
fourtf
2018-08-02 14:23:27 +02:00
parent 3b3c5d8d75
commit c2e2dfb577
186 changed files with 3626 additions and 2656 deletions
+22 -13
View File
@@ -1,27 +1,36 @@
#pragma once
#include "common/Emotemap.hpp"
#include "common/SimpleSignalVector.hpp"
#include "util/ConcurrentMap.hpp"
#include <memory>
#include <map>
#include "common/UniqueAccess.hpp"
#include "messages/Emote.hpp"
#include "messages/EmoteCache.hpp"
namespace chatterino {
class FFZEmotes
class FfzEmotes final : std::enable_shared_from_this<FfzEmotes>
{
public:
EmoteMap globalEmotes;
SimpleSignalVector<QString> globalEmoteCodes;
static constexpr const char *globalEmoteApiUrl = "https://api.frankerfacez.com/v1/set/global";
static constexpr const char *channelEmoteApiUrl = "https://api.betterttv.net/2/channels/";
EmoteMap channelEmotes;
std::map<QString, SimpleSignalVector<QString>> channelEmoteCodes;
public:
// FfzEmotes();
static std::shared_ptr<FfzEmotes> create();
AccessGuard<const EmoteCache<EmoteName>> accessGlobalEmotes() const;
boost::optional<EmotePtr> getGlobalEmote(const EmoteName &name);
boost::optional<EmotePtr> getEmote(const EmoteId &id);
void loadGlobalEmotes();
void loadChannelEmotes(const QString &channelName, std::weak_ptr<EmoteMap> channelEmoteMap);
void loadChannelEmotes(const QString &channelName, std::function<void(EmoteMap &&)> callback);
private:
ConcurrentMap<int, EmoteData> channelEmoteCache_;
protected:
Outcome parseGlobalEmotes(const QJsonObject &jsonRoot);
Outcome parseChannelEmotes(const QJsonObject &jsonRoot);
UniqueAccess<EmoteCache<EmoteName>> globalEmotes_;
UniqueAccess<WeakEmoteIdMap> channelEmoteCache_;
};
} // namespace chatterino