Mercurial > minori
diff include/core/anime.h @ 9:5c0397762b53
INCOMPLETE: megacommit :)
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Sun, 10 Sep 2023 03:59:16 -0400 |
parents | |
children | 4b198a111713 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/core/anime.h Sun Sep 10 03:59:16 2023 -0400 @@ -0,0 +1,171 @@ +#ifndef __core__anime_h +#define __core__anime_h +#include "core/date.h" +#include <array> +#include <map> +#include <vector> + +namespace Anime { + +enum class ListStatus { + NOT_IN_LIST, + CURRENT, + PLANNING, + COMPLETED, + DROPPED, + PAUSED +}; + +constexpr std::array<ListStatus, 5> ListStatuses{ListStatus::CURRENT, ListStatus::PLANNING, ListStatus::COMPLETED, + ListStatus::DROPPED, ListStatus::PAUSED}; + +enum class SeriesStatus { + UNKNOWN, + FINISHED, + RELEASING, + NOT_YET_RELEASED, + CANCELLED, + HIATUS +}; + +enum class SeriesFormat { + UNKNOWN, + TV, + TV_SHORT, + MOVIE, + SPECIAL, + OVA, + ONA, + MUSIC, + MANGA, + NOVEL, + ONE_SHOT +}; + +enum class SeriesSeason { + UNKNOWN, + WINTER, + SPRING, + SUMMER, + FALL +}; + +enum class TitleLanguage { + ROMAJI, + NATIVE, + ENGLISH +}; + +enum class Services { + NONE, + ANILIST, + NB_SERVICES +}; + +struct ListInformation { + int id = 0; + int progress = 0; + int score = 0; + ListStatus status = ListStatus::NOT_IN_LIST; + Date started; + Date completed; + bool is_private = false; + unsigned int rewatched_times = 0; + bool rewatching = false; + uint64_t updated = 0; + std::string notes; +}; + +struct SeriesInformation { + int id; + struct { + std::string romaji; + std::string english; + std::string native; + } title; + std::vector<std::string> synonyms; + int episodes = 0; + SeriesStatus status = SeriesStatus::UNKNOWN; + Date air_date; + std::vector<std::string> genres; + std::vector<std::string> producers; + SeriesFormat format = SeriesFormat::UNKNOWN; + SeriesSeason season = SeriesSeason::UNKNOWN; + int audience_score = 0; + std::string synopsis; + int duration = 0; +}; + +class Anime { + public: + /* User list data */ + ListStatus GetUserStatus() const; + int GetUserProgress() const; + int GetUserScore() const; + Date GetUserDateStarted() const; + Date GetUserDateCompleted() const; + bool GetUserIsPrivate() const; + unsigned int GetUserRewatchedTimes() const; + bool GetUserIsRewatching() const; + uint64_t GetUserTimeUpdated() const; + std::string GetUserNotes() const; + + void SetUserStatus(ListStatus status); + void SetUserProgress(int progress); + void SetUserDateStarted(Date const& started); + void SetUserDateCompleted(Date const& completed); + void SetUserIsPrivate(bool is_private); + void SetUserRewatchedTimes(int rewatched); + void SetUserIsRewatching(bool rewatching); + void SetUserTimeUpdated(uint64_t updated); + void SetUserNotes(std::string const& notes); + + /* Series data */ + int GetId() const; + std::string GetRomajiTitle() const; + std::string GetEnglishTitle() const; + std::string GetNativeTitle() const; + std::vector<std::string> GetTitleSynonyms() const; + int GetEpisodes() const; + SeriesStatus GetAiringStatus() const; + Date GetAirDate() const; + std::vector<std::string> GetGenres() const; + std::vector<std::string> GetProducers() const; + SeriesFormat GetFormat() const; + SeriesSeason GetSeason() const; + int GetAudienceScore() const; /* should be double once MAL and Kitsu are implemented */ + std::string GetSynopsis() const; + int GetDuration() const; + + void SetId(int id); + void SetRomajiTitle(std::string const& title); + void SetEnglishTitle(std::string const& title); + void SetNativeTitle(std::string const& title); + void SetTitleSynonyms(std::vector<std::string> const& synonyms); + void AddTitleSynonym(std::string const& synonym); + void SetEpisodes(int episodes); + void SetAiringStatus(SeriesStatus status); + void SetAirDate(Date const& date); + void SetGenres(std::vector<std::string> const& genres); + void SetProducers(std::vector<std::string> const& producers); + void SetFormat(SeriesFormat format); + void SetSeason(SeriesSeason season); + void SetAudienceScore(int audience_score); + void SetSynopsis(std::string synopsis); + void SetDuration(int duration); + + std::string GetUserPreferredTitle() const; + + /* User stuff */ + void AddToUserList(); + bool IsInUserList() const; + void RemoveFromUserList(); + + private: + SeriesInformation info_; + std::unique_ptr<struct ListInformation> list_info_; +}; + +} // namespace Anime + +#endif // __core__anime_h \ No newline at end of file