2018-08-02 14:23:27 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "messages/Image.hpp"
|
|
|
|
#include "messages/ImageSet.hpp"
|
|
|
|
|
|
|
|
#include <functional>
|
|
|
|
#include <memory>
|
|
|
|
#include <unordered_map>
|
|
|
|
|
|
|
|
namespace chatterino {
|
|
|
|
|
|
|
|
struct Emote {
|
|
|
|
EmoteName name;
|
|
|
|
ImageSet images;
|
|
|
|
Tooltip tooltip;
|
|
|
|
Url homePage;
|
|
|
|
|
|
|
|
// FOURTF: no solution yet, to be refactored later
|
|
|
|
const QString &getCopyString() const
|
|
|
|
{
|
|
|
|
return name.string;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
bool operator==(const Emote &a, const Emote &b);
|
|
|
|
bool operator!=(const Emote &a, const Emote &b);
|
|
|
|
|
|
|
|
using EmotePtr = std::shared_ptr<const Emote>;
|
|
|
|
|
|
|
|
class EmoteMap : public std::unordered_map<EmoteName, EmotePtr>
|
|
|
|
{
|
|
|
|
};
|
|
|
|
using EmoteIdMap = std::unordered_map<EmoteId, EmotePtr>;
|
|
|
|
using WeakEmoteMap = std::unordered_map<EmoteName, std::weak_ptr<const Emote>>;
|
|
|
|
using WeakEmoteIdMap = std::unordered_map<EmoteId, std::weak_ptr<const Emote>>;
|
|
|
|
|
2018-08-11 14:20:53 +02:00
|
|
|
EmotePtr cachedOrMakeEmotePtr(Emote &&emote, const EmoteMap &cache);
|
2018-08-11 17:15:17 +02:00
|
|
|
EmotePtr cachedOrMakeEmotePtr(
|
|
|
|
Emote &&emote,
|
|
|
|
std::unordered_map<EmoteId, std::weak_ptr<const Emote>> &cache,
|
|
|
|
std::mutex &mutex, const EmoteId &id);
|
2018-08-11 14:20:53 +02:00
|
|
|
|
2018-08-02 14:23:27 +02:00
|
|
|
} // namespace chatterino
|