comparison include/core/anime_db.h @ 177:122fad646f81

anime/db: upgrade to c++17 style, make things easier to read
author Paper <mrpapersonic@gmail.com>
date Fri, 01 Dec 2023 13:32:29 -0500
parents 9b10175be389
children 862d0d8619f6
comparison
equal deleted inserted replaced
176:121c2d5b321f 177:122fad646f81
9 namespace Anime { 9 namespace Anime {
10 10
11 class Database { 11 class Database {
12 public: 12 public:
13 std::unordered_map<int, Anime> items; 13 std::unordered_map<int, Anime> items;
14 int GetTotalAnimeAmount(); 14 size_t GetTotalAnimeAmount();
15 int GetTotalEpisodeAmount(); 15 size_t GetTotalEpisodeAmount();
16 int GetTotalWatchedAmount(); 16 size_t GetTotalWatchedAmount();
17 int GetTotalPlannedAmount(); 17 size_t GetTotalPlannedAmount();
18 double GetAverageScore(); 18 double GetAverageScore();
19 double GetScoreDeviation(); 19 double GetScoreDeviation();
20 int GetListsAnimeAmount(ListStatus status); 20 size_t GetListsAnimeAmount(ListStatus status);
21 int GetAnimeFromTitle(const std::string& title); 21 int GetAnimeFromTitle(const std::string& title);
22 22
23 bool GetDatabaseAsJSON(nlohmann::json& json); 23 bool GetDatabaseAsJSON(nlohmann::json& json);
24 bool SaveDatabaseToDisk(); 24 bool SaveDatabaseToDisk();
25 25
26 bool ParseDatabaseJSON(const nlohmann::json& json); 26 bool ParseDatabaseJSON(const nlohmann::json& json);
27 bool LoadDatabaseFromFile(); 27 bool LoadDatabaseFromDisk();
28
29 protected:
30 bool ParseAnimeInfoJSON(const nlohmann::json& json);
31 }; 28 };
32 29
33 extern Database db; 30 extern Database db;
34 31
35 } // namespace Anime 32 } // namespace Anime