comparison include/core/anime.h @ 369:47c9f8502269

*: clang-format all the things I've edited the formatting a bit. Now pointer asterisks (and reference ampersands) are on the variable instead of the type, as well as having newlines for function braces (but nothing else)
author Paper <paper@tflc.us>
date Fri, 25 Jul 2025 10:16:02 -0400
parents b5d6c27c308f
children
comparison
equal deleted inserted replaced
368:6d37a998cf91 369:47c9f8502269
4 #include "core/anime_season.h" 4 #include "core/anime_season.h"
5 #include "core/date.h" 5 #include "core/date.h"
6 6
7 #include <array> 7 #include <array>
8 #include <map> 8 #include <map>
9 #include <optional>
9 #include <vector> 10 #include <vector>
10 #include <optional>
11 11
12 namespace Anime { 12 namespace Anime {
13 13
14 enum class ListStatus { 14 enum class ListStatus {
15 NotInList = 0, 15 NotInList = 0,
16 Current, 16 Current,
17 Completed, 17 Completed,
18 Paused, 18 Paused,
19 Dropped, 19 Dropped,
20 Planning 20 Planning,
21 }; 21 };
22 22
23 constexpr std::array<ListStatus, 5> ListStatuses{ 23 constexpr std::array<ListStatus, 5> ListStatuses{
24 ListStatus::Current, ListStatus::Completed, ListStatus::Paused, 24 ListStatus::Current, ListStatus::Completed, ListStatus::Paused, ListStatus::Dropped, ListStatus::Planning,
25 ListStatus::Dropped, ListStatus::Planning
26 }; 25 };
27 26
28 enum class SeriesStatus { 27 enum class SeriesStatus {
29 Unknown = 0, 28 Unknown = 0,
30 Finished, 29 Finished,
31 Releasing, 30 Releasing,
32 NotYetReleased, 31 NotYetReleased,
33 Cancelled, 32 Cancelled,
34 Hiatus 33 Hiatus,
35 }; 34 };
36 35
37 constexpr std::array<SeriesStatus, 6> SeriesStatuses{ 36 constexpr std::array<SeriesStatus, 6> SeriesStatuses{
38 SeriesStatus::Unknown, 37 SeriesStatus::Unknown, SeriesStatus::Finished, SeriesStatus::Releasing,
39 SeriesStatus::Finished, 38 SeriesStatus::NotYetReleased, SeriesStatus::Cancelled, SeriesStatus::Hiatus,
40 SeriesStatus::Releasing,
41 SeriesStatus::NotYetReleased,
42 SeriesStatus::Cancelled,
43 SeriesStatus::Hiatus
44 }; 39 };
45 40
46 enum class SeriesFormat { 41 enum class SeriesFormat {
47 Unknown = 0, 42 Unknown = 0,
48 Tv, 43 Tv,
49 TvShort, 44 TvShort,
50 Movie, 45 Movie,
51 Special, 46 Special,
52 Ova, 47 Ova,
53 Ona, 48 Ona,
54 Music 49 Music,
55 }; 50 };
56 51
57 constexpr std::array<SeriesFormat, 8> SeriesFormats{ 52 constexpr std::array<SeriesFormat, 8> SeriesFormats{
58 SeriesFormat::Unknown, 53 SeriesFormat::Unknown, SeriesFormat::Tv, SeriesFormat::TvShort, SeriesFormat::Movie,
59 SeriesFormat::Tv, 54 SeriesFormat::Special, SeriesFormat::Ova, SeriesFormat::Ona, SeriesFormat::Music,
60 SeriesFormat::TvShort,
61 SeriesFormat::Movie,
62 SeriesFormat::Special,
63 SeriesFormat::Ova,
64 SeriesFormat::Ona,
65 SeriesFormat::Music
66 }; 55 };
67 56
68 enum class TitleLanguage { 57 enum class TitleLanguage {
69 Romaji, 58 Romaji,
70 Native, 59 Native,
71 English 60 English,
72 }; 61 };
73 62
74 constexpr std::array<TitleLanguage, 3> TitleLanguages{TitleLanguage::Romaji, TitleLanguage::Native, TitleLanguage::English}; 63 constexpr std::array<TitleLanguage, 3> TitleLanguages{
64 TitleLanguage::Romaji,
65 TitleLanguage::Native,
66 TitleLanguage::English,
67 };
75 68
76 enum class Service { 69 enum class Service {
77 None, 70 None,
78 AniList, 71 AniList,
79 MyAnimeList, 72 MyAnimeList,
80 Kitsu 73 Kitsu,
81 }; 74 };
82 75
83 /* this doesn't include MAL and Kitsu because they aren't really 76 /* this doesn't include MAL and Kitsu because they aren't really
84 * "valid" services yet. */ 77 * "valid" services yet. */
85 constexpr std::array<Service, 3> Services{ 78 constexpr std::array<Service, 3> Services{
86 Service::AniList, 79 Service::AniList,
87 Service::MyAnimeList, 80 Service::MyAnimeList,
88 Service::Kitsu 81 Service::Kitsu,
89 }; 82 };
90 83
91 enum class ScoreFormat { 84 enum class ScoreFormat {
92 Point100, // 0-100 85 Point100, // 0-100
93 Point10Decimal, // 0.0-10.0 86 Point10Decimal, // 0.0-10.0
94 Point10, // 0-10 87 Point10, // 0-10
95 Point5, // 0-5, should be represented in stars 88 Point5, // 0-5, should be represented in stars
96 Point3 // 1-3, should be represented in smileys 89 Point3, // 1-3, should be represented in smileys
97 }; 90 };
98 91
99 constexpr std::array<ScoreFormat, 5> ScoreFormats{ScoreFormat::Point100, ScoreFormat::Point10Decimal, 92 constexpr std::array<ScoreFormat, 5> ScoreFormats{
100 ScoreFormat::Point10, ScoreFormat::Point5, ScoreFormat::Point3}; 93 ScoreFormat::Point100, ScoreFormat::Point10Decimal, ScoreFormat::Point10, ScoreFormat::Point5, ScoreFormat::Point3,
94 };
101 95
102 struct ListInformation { 96 struct ListInformation {
103 std::string id; 97 std::string id;
104 int progress = 0; 98 int progress = 0;
105 int score = 0; // this will ALWAYS be in POINT_100 format internally 99 int score = 0; // this will ALWAYS be in POINT_100 format internally
145 unsigned int GetUserRewatchedTimes() const; 139 unsigned int GetUserRewatchedTimes() const;
146 bool GetUserIsRewatching() const; 140 bool GetUserIsRewatching() const;
147 uint64_t GetUserTimeUpdated() const; 141 uint64_t GetUserTimeUpdated() const;
148 std::string GetUserNotes() const; 142 std::string GetUserNotes() const;
149 143
150 void SetUserId(const std::string& id); 144 void SetUserId(const std::string &id);
151 void SetUserStatus(ListStatus status); 145 void SetUserStatus(ListStatus status);
152 void SetUserScore(int score); 146 void SetUserScore(int score);
153 void SetUserProgress(int progress); 147 void SetUserProgress(int progress);
154 void SetUserDateStarted(const Date& started); 148 void SetUserDateStarted(const Date &started);
155 void SetUserDateCompleted(const Date& completed); 149 void SetUserDateCompleted(const Date &completed);
156 void SetUserIsPrivate(bool is_private); 150 void SetUserIsPrivate(bool is_private);
157 void SetUserRewatchedTimes(int rewatched); 151 void SetUserRewatchedTimes(int rewatched);
158 void SetUserIsRewatching(bool rewatching); 152 void SetUserIsRewatching(bool rewatching);
159 void SetUserTimeUpdated(uint64_t updated); 153 void SetUserTimeUpdated(uint64_t updated);
160 void SetUserNotes(const std::string& notes); 154 void SetUserNotes(const std::string &notes);
161 155
162 /* Series data */ 156 /* Series data */
163 int GetId() const; 157 int GetId() const;
164 std::optional<std::string> GetServiceId(Service service) const; 158 std::optional<std::string> GetServiceId(Service service) const;
165 std::optional<std::string> GetTitle(TitleLanguage language) const; 159 std::optional<std::string> GetTitle(TitleLanguage language) const;
177 int GetDuration() const; 171 int GetDuration() const;
178 std::string GetPosterUrl() const; 172 std::string GetPosterUrl() const;
179 std::optional<std::string> GetServiceUrl(Service service) const; 173 std::optional<std::string> GetServiceUrl(Service service) const;
180 174
181 void SetId(int id); 175 void SetId(int id);
182 void SetServiceId(Service service, const std::string& id); 176 void SetServiceId(Service service, const std::string &id);
183 void SetTitle(TitleLanguage language, const std::string& title); 177 void SetTitle(TitleLanguage language, const std::string &title);
184 void SetTitleSynonyms(const std::vector<std::string>& synonyms); 178 void SetTitleSynonyms(const std::vector<std::string> &synonyms);
185 void AddTitleSynonym(const std::string& synonym); 179 void AddTitleSynonym(const std::string &synonym);
186 void SetEpisodes(int episodes); 180 void SetEpisodes(int episodes);
187 void SetAiringStatus(SeriesStatus status); 181 void SetAiringStatus(SeriesStatus status);
188 void SetStartedDate(const Date& date); 182 void SetStartedDate(const Date &date);
189 void SetCompletedDate(const Date& date); 183 void SetCompletedDate(const Date &date);
190 void SetGenres(const std::vector<std::string>& genres); 184 void SetGenres(const std::vector<std::string> &genres);
191 void SetProducers(const std::vector<std::string>& producers); 185 void SetProducers(const std::vector<std::string> &producers);
192 void SetFormat(SeriesFormat format); 186 void SetFormat(SeriesFormat format);
193 void SetAudienceScore(double audience_score); 187 void SetAudienceScore(double audience_score);
194 void SetSynopsis(std::string synopsis); 188 void SetSynopsis(std::string synopsis);
195 void SetDuration(int duration); 189 void SetDuration(int duration);
196 void SetPosterUrl(std::string poster); 190 void SetPosterUrl(std::string poster);