Chatterino
SeventvBadges.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "common/Aliases.hpp"
4 #include "util/QStringHash.hpp"
5 
6 #include <boost/optional.hpp>
7 #include <common/Singleton.hpp>
8 
9 #include <memory>
10 #include <shared_mutex>
11 #include <unordered_map>
12 
13 namespace chatterino {
14 
15 struct Emote;
16 using EmotePtr = std::shared_ptr<const Emote>;
17 
18 class SeventvBadges : public Singleton
19 {
20 public:
21  void initialize(Settings &settings, Paths &paths) override;
22 
23  boost::optional<EmotePtr> getBadge(const UserId &id);
24 
25 private:
26  void loadSeventvBadges();
27 
28  // Mutex for both `badgeMap_` and `emotes_`
29  std::shared_mutex mutex_;
30 
31  std::unordered_map<QString, int> badgeMap_;
32  std::vector<EmotePtr> emotes_;
33 };
34 
35 } // namespace chatterino
Definition: Singleton.hpp:10
void initialize(Settings &settings, Paths &paths) override
Definition: SeventvBadges.cpp:14
Definition: Application.cpp:48
std::shared_ptr< const Emote > EmotePtr
Definition: Emote.hpp:38
Settings which are availlable for reading and writing on the gui thread.
Definition: Settings.hpp:78
Definition: Paths.hpp:8
boost::optional< EmotePtr > getBadge(const UserId &id)
Definition: SeventvBadges.cpp:19
Definition: SeventvBadges.hpp:18