Mercurial > minori
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 8:b1f73678ef61 | 9:5c0397762b53 |
|---|---|
| 1 #ifndef __core__anime_h | |
| 2 #define __core__anime_h | |
| 3 #include "core/date.h" | |
| 4 #include <array> | |
| 5 #include <map> | |
| 6 #include <vector> | |
| 7 | |
| 8 namespace Anime { | |
| 9 | |
| 10 enum class ListStatus { | |
| 11 NOT_IN_LIST, | |
| 12 CURRENT, | |
| 13 PLANNING, | |
| 14 COMPLETED, | |
| 15 DROPPED, | |
| 16 PAUSED | |
| 17 }; | |
| 18 | |
| 19 constexpr std::array<ListStatus, 5> ListStatuses{ListStatus::CURRENT, ListStatus::PLANNING, ListStatus::COMPLETED, | |
| 20 ListStatus::DROPPED, ListStatus::PAUSED}; | |
| 21 | |
| 22 enum class SeriesStatus { | |
| 23 UNKNOWN, | |
| 24 FINISHED, | |
| 25 RELEASING, | |
| 26 NOT_YET_RELEASED, | |
| 27 CANCELLED, | |
| 28 HIATUS | |
| 29 }; | |
| 30 | |
| 31 enum class SeriesFormat { | |
| 32 UNKNOWN, | |
| 33 TV, | |
| 34 TV_SHORT, | |
| 35 MOVIE, | |
| 36 SPECIAL, | |
| 37 OVA, | |
| 38 ONA, | |
| 39 MUSIC, | |
| 40 MANGA, | |
| 41 NOVEL, | |
| 42 ONE_SHOT | |
| 43 }; | |
| 44 | |
| 45 enum class SeriesSeason { | |
| 46 UNKNOWN, | |
| 47 WINTER, | |
| 48 SPRING, | |
| 49 SUMMER, | |
| 50 FALL | |
| 51 }; | |
| 52 | |
| 53 enum class TitleLanguage { | |
| 54 ROMAJI, | |
| 55 NATIVE, | |
| 56 ENGLISH | |
| 57 }; | |
| 58 | |
| 59 enum class Services { | |
| 60 NONE, | |
| 61 ANILIST, | |
| 62 NB_SERVICES | |
| 63 }; | |
| 64 | |
| 65 struct ListInformation { | |
| 66 int id = 0; | |
| 67 int progress = 0; | |
| 68 int score = 0; | |
| 69 ListStatus status = ListStatus::NOT_IN_LIST; | |
| 70 Date started; | |
| 71 Date completed; | |
| 72 bool is_private = false; | |
| 73 unsigned int rewatched_times = 0; | |
| 74 bool rewatching = false; | |
| 75 uint64_t updated = 0; | |
| 76 std::string notes; | |
| 77 }; | |
| 78 | |
| 79 struct SeriesInformation { | |
| 80 int id; | |
| 81 struct { | |
| 82 std::string romaji; | |
| 83 std::string english; | |
| 84 std::string native; | |
| 85 } title; | |
| 86 std::vector<std::string> synonyms; | |
| 87 int episodes = 0; | |
| 88 SeriesStatus status = SeriesStatus::UNKNOWN; | |
| 89 Date air_date; | |
| 90 std::vector<std::string> genres; | |
| 91 std::vector<std::string> producers; | |
| 92 SeriesFormat format = SeriesFormat::UNKNOWN; | |
| 93 SeriesSeason season = SeriesSeason::UNKNOWN; | |
| 94 int audience_score = 0; | |
| 95 std::string synopsis; | |
| 96 int duration = 0; | |
| 97 }; | |
| 98 | |
| 99 class Anime { | |
| 100 public: | |
| 101 /* User list data */ | |
| 102 ListStatus GetUserStatus() const; | |
| 103 int GetUserProgress() const; | |
| 104 int GetUserScore() const; | |
| 105 Date GetUserDateStarted() const; | |
| 106 Date GetUserDateCompleted() const; | |
| 107 bool GetUserIsPrivate() const; | |
| 108 unsigned int GetUserRewatchedTimes() const; | |
| 109 bool GetUserIsRewatching() const; | |
| 110 uint64_t GetUserTimeUpdated() const; | |
| 111 std::string GetUserNotes() const; | |
| 112 | |
| 113 void SetUserStatus(ListStatus status); | |
| 114 void SetUserProgress(int progress); | |
| 115 void SetUserDateStarted(Date const& started); | |
| 116 void SetUserDateCompleted(Date const& completed); | |
| 117 void SetUserIsPrivate(bool is_private); | |
| 118 void SetUserRewatchedTimes(int rewatched); | |
| 119 void SetUserIsRewatching(bool rewatching); | |
| 120 void SetUserTimeUpdated(uint64_t updated); | |
| 121 void SetUserNotes(std::string const& notes); | |
| 122 | |
| 123 /* Series data */ | |
| 124 int GetId() const; | |
| 125 std::string GetRomajiTitle() const; | |
| 126 std::string GetEnglishTitle() const; | |
| 127 std::string GetNativeTitle() const; | |
| 128 std::vector<std::string> GetTitleSynonyms() const; | |
| 129 int GetEpisodes() const; | |
| 130 SeriesStatus GetAiringStatus() const; | |
| 131 Date GetAirDate() const; | |
| 132 std::vector<std::string> GetGenres() const; | |
| 133 std::vector<std::string> GetProducers() const; | |
| 134 SeriesFormat GetFormat() const; | |
| 135 SeriesSeason GetSeason() const; | |
| 136 int GetAudienceScore() const; /* should be double once MAL and Kitsu are implemented */ | |
| 137 std::string GetSynopsis() const; | |
| 138 int GetDuration() const; | |
| 139 | |
| 140 void SetId(int id); | |
| 141 void SetRomajiTitle(std::string const& title); | |
| 142 void SetEnglishTitle(std::string const& title); | |
| 143 void SetNativeTitle(std::string const& title); | |
| 144 void SetTitleSynonyms(std::vector<std::string> const& synonyms); | |
| 145 void AddTitleSynonym(std::string const& synonym); | |
| 146 void SetEpisodes(int episodes); | |
| 147 void SetAiringStatus(SeriesStatus status); | |
| 148 void SetAirDate(Date const& date); | |
| 149 void SetGenres(std::vector<std::string> const& genres); | |
| 150 void SetProducers(std::vector<std::string> const& producers); | |
| 151 void SetFormat(SeriesFormat format); | |
| 152 void SetSeason(SeriesSeason season); | |
| 153 void SetAudienceScore(int audience_score); | |
| 154 void SetSynopsis(std::string synopsis); | |
| 155 void SetDuration(int duration); | |
| 156 | |
| 157 std::string GetUserPreferredTitle() const; | |
| 158 | |
| 159 /* User stuff */ | |
| 160 void AddToUserList(); | |
| 161 bool IsInUserList() const; | |
| 162 void RemoveFromUserList(); | |
| 163 | |
| 164 private: | |
| 165 SeriesInformation info_; | |
| 166 std::unique_ptr<struct ListInformation> list_info_; | |
| 167 }; | |
| 168 | |
| 169 } // namespace Anime | |
| 170 | |
| 171 #endif // __core__anime_h |
