Mercurial > minori
comparison include/core/anime.h @ 279:657fda1b9cac
*: clean up enums
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Fri, 19 Apr 2024 13:24:06 -0400 |
parents | 9a04802848c0 |
children | e66ffc338d82 |
comparison
equal
deleted
inserted
replaced
274:f6a756c19bfb | 279:657fda1b9cac |
---|---|
8 #include <optional> | 8 #include <optional> |
9 | 9 |
10 namespace Anime { | 10 namespace Anime { |
11 | 11 |
12 enum class ListStatus { | 12 enum class ListStatus { |
13 NOT_IN_LIST, | 13 NotInList = 0, |
14 CURRENT, | 14 Current, |
15 COMPLETED, | 15 Completed, |
16 PAUSED, | 16 Paused, |
17 DROPPED, | 17 Dropped, |
18 PLANNING | 18 Planning |
19 }; | 19 }; |
20 | 20 |
21 constexpr std::array<ListStatus, 5> ListStatuses{ListStatus::CURRENT, ListStatus::COMPLETED, ListStatus::PAUSED, | 21 constexpr std::array<ListStatus, 5> ListStatuses{ |
22 ListStatus::DROPPED, ListStatus::PLANNING}; | 22 ListStatus::Current, ListStatus::Completed, ListStatus::Paused, |
23 ListStatus::Dropped, ListStatus::Planning | |
24 }; | |
23 | 25 |
24 enum class SeriesStatus { | 26 enum class SeriesStatus { |
25 UNKNOWN, | 27 Unknown = 0, |
26 FINISHED, | 28 Finished, |
27 RELEASING, | 29 Releasing, |
28 NOT_YET_RELEASED, | 30 NotYetReleased, |
29 CANCELLED, | 31 Cancelled, |
30 HIATUS | 32 Hiatus |
33 }; | |
34 | |
35 constexpr std::array<SeriesStatus, 6> SeriesStatuses{ | |
36 SeriesStatus::Unknown, | |
37 SeriesStatus::Finished, | |
38 SeriesStatus::Releasing, | |
39 SeriesStatus::NotYetReleased, | |
40 SeriesStatus::Cancelled, | |
41 SeriesStatus::Hiatus | |
31 }; | 42 }; |
32 | 43 |
33 enum class SeriesFormat { | 44 enum class SeriesFormat { |
34 UNKNOWN, | 45 Unknown = 0, |
35 TV, | 46 Tv, |
36 TV_SHORT, | 47 TvShort, |
37 MOVIE, | 48 Movie, |
38 SPECIAL, | 49 Special, |
39 OVA, | 50 Ova, |
40 ONA, | 51 Ona, |
41 MUSIC, | 52 Music |
42 MANGA, | 53 }; |
43 NOVEL, | 54 |
44 ONE_SHOT | 55 constexpr std::array<SeriesFormat, 8> SeriesFormats{ |
56 SeriesFormat::Unknown, | |
57 SeriesFormat::Tv, | |
58 SeriesFormat::TvShort, | |
59 SeriesFormat::Movie, | |
60 SeriesFormat::Special, | |
61 SeriesFormat::Ova, | |
62 SeriesFormat::Ona, | |
63 SeriesFormat::Music | |
45 }; | 64 }; |
46 | 65 |
47 enum class SeriesSeason { | 66 enum class SeriesSeason { |
48 UNKNOWN, | 67 Unknown = 0, |
49 WINTER, | 68 Winter, |
50 SPRING, | 69 Spring, |
51 SUMMER, | 70 Summer, |
52 FALL | 71 Fall |
53 }; | 72 }; |
54 | 73 |
55 constexpr std::array<SeriesSeason, 4> SeriesSeasons{ | 74 constexpr std::array<SeriesSeason, 4> SeriesSeasons{ |
56 SeriesSeason::WINTER, SeriesSeason::SPRING, | 75 SeriesSeason::Winter, SeriesSeason::Spring, |
57 SeriesSeason::SUMMER, SeriesSeason::FALL | 76 SeriesSeason::Summer, SeriesSeason::Fall |
58 }; | 77 }; |
59 | 78 |
60 enum class TitleLanguage { | 79 enum class TitleLanguage { |
61 ROMAJI, | 80 Romaji, |
62 NATIVE, | 81 Native, |
63 ENGLISH | 82 English |
64 }; | 83 }; |
65 | 84 |
66 enum class Services { | 85 constexpr std::array<TitleLanguage, 3> TitleLanguages{TitleLanguage::Romaji, TitleLanguage::Native, TitleLanguage::English}; |
67 NONE, | 86 |
68 ANILIST, | 87 enum class Service { |
69 NB_SERVICES | 88 None, |
70 }; | 89 AniList |
90 }; | |
91 | |
92 constexpr std::array<Service, 1> Services{Service::AniList}; | |
71 | 93 |
72 enum class ScoreFormat { | 94 enum class ScoreFormat { |
73 POINT_100, // 0-100 | 95 Point100, // 0-100 |
74 POINT_10_DECIMAL, // 0.0-10.0 | 96 Point10Decimal, // 0.0-10.0 |
75 POINT_10, // 0-10 | 97 Point10, // 0-10 |
76 POINT_5, // 0-5, should be represented in stars | 98 Point5, // 0-5, should be represented in stars |
77 POINT_3 // 1-3, should be represented in smileys | 99 Point3 // 1-3, should be represented in smileys |
78 }; | 100 }; |
79 | 101 |
80 constexpr std::array<ScoreFormat, 5> ScoreFormats{ScoreFormat::POINT_100, ScoreFormat::POINT_10_DECIMAL, | 102 constexpr std::array<ScoreFormat, 5> ScoreFormats{ScoreFormat::Point100, ScoreFormat::Point10Decimal, |
81 ScoreFormat::POINT_10, ScoreFormat::POINT_5, ScoreFormat::POINT_3}; | 103 ScoreFormat::Point10, ScoreFormat::Point5, ScoreFormat::Point3}; |
82 | 104 |
83 struct ListInformation { | 105 struct ListInformation { |
84 int id = 0; | 106 int id = 0; |
85 int progress = 0; | 107 int progress = 0; |
86 int score = 0; // note that this will ALWAYS be in POINT_100 format and must be converted | 108 int score = 0; // this will ALWAYS be in POINT_100 format internally |
87 ListStatus status = ListStatus::NOT_IN_LIST; | 109 ListStatus status = ListStatus::NotInList; |
88 Date started; | 110 Date started; |
89 Date completed; | 111 Date completed; |
90 bool is_private = false; | 112 bool is_private = false; |
91 unsigned int rewatched_times = 0; | 113 unsigned int rewatched_times = 0; |
92 bool rewatching = false; | 114 bool rewatching = false; |
101 std::string english; | 123 std::string english; |
102 std::string native; | 124 std::string native; |
103 } title; | 125 } title; |
104 std::vector<std::string> synonyms; | 126 std::vector<std::string> synonyms; |
105 int episodes = 0; | 127 int episodes = 0; |
106 SeriesStatus status = SeriesStatus::UNKNOWN; | 128 SeriesStatus status = SeriesStatus::Unknown; |
107 Date air_date; | 129 Date air_date; |
108 std::vector<std::string> genres; | 130 std::vector<std::string> genres; |
109 std::vector<std::string> producers; | 131 std::vector<std::string> producers; |
110 SeriesFormat format = SeriesFormat::UNKNOWN; | 132 SeriesFormat format = SeriesFormat::Unknown; |
111 SeriesSeason season = SeriesSeason::UNKNOWN; | |
112 int audience_score = 0; | 133 int audience_score = 0; |
113 std::string synopsis; | 134 std::string synopsis; |
114 int duration = 0; | 135 int duration = 0; |
115 std::string poster_url; | 136 std::string poster_url; |
116 }; | 137 }; |
170 void SetAiringStatus(SeriesStatus status); | 191 void SetAiringStatus(SeriesStatus status); |
171 void SetAirDate(Date const& date); | 192 void SetAirDate(Date const& date); |
172 void SetGenres(std::vector<std::string> const& genres); | 193 void SetGenres(std::vector<std::string> const& genres); |
173 void SetProducers(std::vector<std::string> const& producers); | 194 void SetProducers(std::vector<std::string> const& producers); |
174 void SetFormat(SeriesFormat format); | 195 void SetFormat(SeriesFormat format); |
175 void SetSeason(SeriesSeason season); | |
176 void SetAudienceScore(int audience_score); | 196 void SetAudienceScore(int audience_score); |
177 void SetSynopsis(std::string synopsis); | 197 void SetSynopsis(std::string synopsis); |
178 void SetDuration(int duration); | 198 void SetDuration(int duration); |
179 void SetPosterUrl(std::string poster); | 199 void SetPosterUrl(std::string poster); |
180 | 200 |