Mercurial > minori
view include/core/anime_db.h @ 176:121c2d5b321f
anime/db: finalize anime db cache
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Fri, 01 Dec 2023 13:12:26 -0500 |
parents | 9b10175be389 |
children | 122fad646f81 |
line wrap: on
line source
#ifndef __core__anime_db_h #define __core__anime_db_h #include "core/anime.h" #include "json/json_fwd.hpp" #include <string> #include <unordered_map> namespace Anime { class Database { public: std::unordered_map<int, Anime> items; int GetTotalAnimeAmount(); int GetTotalEpisodeAmount(); int GetTotalWatchedAmount(); int GetTotalPlannedAmount(); double GetAverageScore(); double GetScoreDeviation(); int GetListsAnimeAmount(ListStatus status); int GetAnimeFromTitle(const std::string& title); bool GetDatabaseAsJSON(nlohmann::json& json); bool SaveDatabaseToDisk(); bool ParseDatabaseJSON(const nlohmann::json& json); bool LoadDatabaseFromFile(); protected: bool ParseAnimeInfoJSON(const nlohmann::json& json); }; extern Database db; } // namespace Anime #endif // __core__anime_db_h