mirror-chatterino2/src/providers/chatterino/ChatterinoBadges.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

36 lines
685 B
C++
Raw Normal View History

2018-08-02 14:23:27 +02:00
#pragma once
#include "common/Aliases.hpp"
#include "common/Singleton.hpp"
#include "util/QStringHash.hpp"
#include <memory>
#include <optional>
2021-05-01 13:38:58 +02:00
#include <shared_mutex>
#include <unordered_map>
#include <vector>
2018-08-02 14:23:27 +02:00
namespace chatterino {
struct Emote;
using EmotePtr = std::shared_ptr<const Emote>;
class ChatterinoBadges : public Singleton
2018-08-02 14:23:27 +02:00
{
public:
void initialize(Settings &settings, Paths &paths) override;
2018-08-02 14:23:27 +02:00
ChatterinoBadges();
std::optional<EmotePtr> getBadge(const UserId &id);
2018-08-02 14:23:27 +02:00
private:
void loadChatterinoBadges();
2021-05-01 13:38:58 +02:00
std::shared_mutex mutex_;
std::unordered_map<QString, int> badgeMap;
std::vector<EmotePtr> emotes;
2018-08-02 14:23:27 +02:00
};
} // namespace chatterino