Mercurial > minori
annotate src/include/anime.h @ 7:07a9095eaeed
Update
Refactored some code, moved some around
| author | Paper <mrpapersonic@gmail.com> |
|---|---|
| date | Thu, 24 Aug 2023 23:11:38 -0400 |
| parents | 1d82f6e04d7d |
| children |
| rev | line source |
|---|---|
| 2 | 1 #ifndef __anime_h |
| 2 #define __anime_h | |
| 3 #include <vector> | |
| 4 #include <map> | |
| 5 #include "date.h" | |
| 6 #include "window.h" | |
|
6
1d82f6e04d7d
Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
4
diff
changeset
|
7 #include "progress.h" |
| 2 | 8 |
| 9 enum AnimeWatchingStatus { | |
| 10 CURRENT, | |
| 11 PLANNING, | |
| 12 COMPLETED, | |
| 13 DROPPED, | |
| 14 PAUSED, | |
| 15 REPEATING | |
| 16 }; | |
| 17 | |
| 18 enum AnimeAiringStatus { | |
| 19 FINISHED, | |
| 20 RELEASING, | |
| 21 NOT_YET_RELEASED, | |
| 22 CANCELLED, | |
| 23 HIATUS | |
| 24 }; | |
| 25 | |
| 26 enum AnimeFormat { | |
| 27 TV, | |
| 28 TV_SHORT, | |
| 29 MOVIE, | |
| 30 SPECIAL, | |
| 31 OVA, | |
| 32 ONA, | |
| 33 MUSIC, | |
| 34 MANGA, | |
| 35 NOVEL, | |
| 36 ONE_SHOT | |
| 37 }; | |
| 38 | |
| 39 enum AnimeSeason { | |
| 40 UNKNOWN, | |
| 41 WINTER, | |
| 42 SPRING, | |
| 43 SUMMER, | |
| 44 FALL | |
| 45 }; | |
| 46 | |
| 47 class Anime { | |
| 48 public: | |
| 49 Anime(); | |
| 50 Anime(const Anime& a); | |
| 51 /* List-specific data */ | |
| 52 enum AnimeWatchingStatus status; | |
| 53 int progress; | |
| 54 int score; | |
| 55 Date started; | |
| 56 Date completed; | |
| 57 int updated; /* this should be 64-bit */ | |
|
6
1d82f6e04d7d
Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
4
diff
changeset
|
58 std::string notes; |
| 2 | 59 |
| 60 /* Useful information */ | |
| 61 int id; | |
| 62 struct { | |
|
6
1d82f6e04d7d
Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
4
diff
changeset
|
63 std::string romaji; |
|
1d82f6e04d7d
Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
4
diff
changeset
|
64 std::string english; |
|
1d82f6e04d7d
Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
4
diff
changeset
|
65 std::string native; |
| 2 | 66 } title; |
| 7 | 67 std::vector<std::string> synonyms; |
| 2 | 68 int episodes; |
| 69 enum AnimeAiringStatus airing; | |
| 70 Date air_date; | |
| 71 std::vector<std::string> genres; | |
| 72 std::vector<std::string> producers; | |
| 73 enum AnimeFormat type; | |
| 74 enum AnimeSeason season; | |
| 75 int audience_score; | |
|
6
1d82f6e04d7d
Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
4
diff
changeset
|
76 std::string synopsis; |
| 2 | 77 int duration; |
|
6
1d82f6e04d7d
Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
4
diff
changeset
|
78 |
|
1d82f6e04d7d
Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
4
diff
changeset
|
79 std::string GetUserPreferredTitle(); |
| 7 | 80 std::vector<std::string> GetTitleSynonyms(); |
| 2 | 81 }; |
| 82 | |
| 83 /* This is a simple wrapper on a vector that provides | |
| 84 methods to make it easier to search the list. */ | |
| 85 class AnimeList { | |
| 86 public: | |
| 87 AnimeList(); | |
| 88 AnimeList(const AnimeList& l); | |
| 7 | 89 AnimeList& operator=(const AnimeList& l); |
| 2 | 90 ~AnimeList(); |
| 91 void Add(Anime& anime); | |
| 92 void Insert(size_t pos, Anime& anime); | |
| 93 void Delete(size_t index); | |
| 94 void Clear(); | |
| 95 std::vector<Anime>::iterator begin() noexcept; | |
| 96 std::vector<Anime>::iterator end() noexcept; | |
| 97 std::vector<Anime>::const_iterator cbegin() noexcept; | |
| 98 std::vector<Anime>::const_iterator cend() noexcept; | |
| 99 size_t Size() const; | |
| 100 Anime* AnimeById(int id); | |
| 101 int GetAnimeIndex(Anime& anime) const; | |
| 102 bool AnimeInList(int id); | |
| 103 Anime& operator[](size_t index); | |
| 104 const Anime& operator[](size_t index) const; | |
|
6
1d82f6e04d7d
Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
4
diff
changeset
|
105 std::string name; |
| 2 | 106 |
|
6
1d82f6e04d7d
Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
4
diff
changeset
|
107 protected: |
| 2 | 108 std::vector<Anime> anime_list; |
| 109 std::map<int, Anime*> anime_id_to_anime; | |
| 110 }; | |
| 111 | |
| 112 extern std::map<enum AnimeSeason, std::string> AnimeSeasonToStringMap; | |
| 113 extern std::map<enum AnimeFormat, std::string> AnimeFormatToStringMap; | |
| 114 extern std::map<enum AnimeWatchingStatus, std::string> AnimeWatchingToStringMap; | |
| 115 extern std::map<enum AnimeAiringStatus, std::string> AnimeAiringToStringMap; | |
| 1 | 116 #endif // __anime_h |
