comparison include/core/anime_db.h @ 202:71832ffe425a

animia: re-add kvm fd source this is all being merged from my wildly out-of-date laptop. SORRY! in other news, I edited the CI file to install the wayland client as well, so the linux CI build might finally get wayland stuff.
author Paper <paper@paper.us.eu.org>
date Tue, 02 Jan 2024 06:05:06 -0500
parents 122fad646f81
children 862d0d8619f6
comparison
equal deleted inserted replaced
201:8f6f8dd2eb23 202:71832ffe425a
1 #ifndef __core__anime_db_h 1 #ifndef __core__anime_db_h
2 #define __core__anime_db_h 2 #define __core__anime_db_h
3 3
4 #include "core/anime.h" 4 #include "core/anime.h"
5 #include "json/json_fwd.hpp"
5 #include <string> 6 #include <string>
6 #include <unordered_map> 7 #include <unordered_map>
7 8
8 namespace Anime { 9 namespace Anime {
9 10
10 class Database { 11 class Database {
11 public: 12 public:
12 std::unordered_map<int, Anime> items; 13 std::unordered_map<int, Anime> items;
13 int GetTotalAnimeAmount(); 14 size_t GetTotalAnimeAmount();
14 int GetTotalEpisodeAmount(); 15 size_t GetTotalEpisodeAmount();
15 int GetTotalWatchedAmount(); 16 size_t GetTotalWatchedAmount();
16 int GetTotalPlannedAmount(); 17 size_t GetTotalPlannedAmount();
17 double GetAverageScore(); 18 double GetAverageScore();
18 double GetScoreDeviation(); 19 double GetScoreDeviation();
19 int GetListsAnimeAmount(ListStatus status); 20 size_t GetListsAnimeAmount(ListStatus status);
20 int GetAnimeFromTitle(const std::string& title); 21 int GetAnimeFromTitle(const std::string& title);
22
23 bool GetDatabaseAsJSON(nlohmann::json& json);
24 bool SaveDatabaseToDisk();
25
26 bool ParseDatabaseJSON(const nlohmann::json& json);
27 bool LoadDatabaseFromDisk();
21 }; 28 };
22 29
23 extern Database db; 30 extern Database db;
24 31
25 } // namespace Anime 32 } // namespace Anime