annotate src/include/anime.h @ 8:b1f73678ef61

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