annotate include/core/anime_season.h @ 327:b5d6c27c308f

anime: refactor Anime::SeriesSeason to Season class ToLocalString has also been altered to take in both season and year because lots of locales actually treat formatting seasons differently! most notably is Russian which adds a suffix at the end to notate seasons(??)
author Paper <paper@paper.us.eu.org>
date Thu, 13 Jun 2024 01:49:18 -0400
parents 10096c5489e3
children 6b0768158dcd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
281
3ede7be4f449 anime_season: forgot these
Paper <paper@paper.us.eu.org>
parents:
diff changeset
1 #ifndef MINORI_CORE_ANIME_SEASON_H_
3ede7be4f449 anime_season: forgot these
Paper <paper@paper.us.eu.org>
parents:
diff changeset
2 #define MINORI_CORE_ANIME_SEASON_H_
3ede7be4f449 anime_season: forgot these
Paper <paper@paper.us.eu.org>
parents:
diff changeset
3
3ede7be4f449 anime_season: forgot these
Paper <paper@paper.us.eu.org>
parents:
diff changeset
4 #include "core/date.h" /* Date::Month */
3ede7be4f449 anime_season: forgot these
Paper <paper@paper.us.eu.org>
parents:
diff changeset
5
327
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 326
diff changeset
6 #include <array>
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 326
diff changeset
7
281
3ede7be4f449 anime_season: forgot these
Paper <paper@paper.us.eu.org>
parents:
diff changeset
8 namespace Anime {
3ede7be4f449 anime_season: forgot these
Paper <paper@paper.us.eu.org>
parents:
diff changeset
9
327
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 326
diff changeset
10 class Season final {
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 326
diff changeset
11 public:
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 326
diff changeset
12 enum class Name {
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 326
diff changeset
13 Unknown,
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 326
diff changeset
14 Winter,
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 326
diff changeset
15 Spring,
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 326
diff changeset
16 Summer,
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 326
diff changeset
17 Autumn,
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 326
diff changeset
18 };
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 326
diff changeset
19
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 326
diff changeset
20 static constexpr std::array<Name, 4> Names{
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 326
diff changeset
21 Name::Winter,
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 326
diff changeset
22 Name::Spring,
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 326
diff changeset
23 Name::Summer,
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 326
diff changeset
24 Name::Autumn
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 326
diff changeset
25 };
281
3ede7be4f449 anime_season: forgot these
Paper <paper@paper.us.eu.org>
parents:
diff changeset
26
327
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 326
diff changeset
27 Season() = default;
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 326
diff changeset
28 Season(Name s, Date::Year y);
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 326
diff changeset
29 explicit Season(const Date& date);
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 326
diff changeset
30
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 326
diff changeset
31 bool operator==(const Season& o) const;
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 326
diff changeset
32 bool operator!=(const Season& o) const;
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 326
diff changeset
33
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 326
diff changeset
34 bool operator<(const Season& o) const;
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 326
diff changeset
35 bool operator>(const Season& o) const;
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 326
diff changeset
36 bool operator<=(const Season& o) const;
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 326
diff changeset
37 bool operator>=(const Season& o) const;
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 326
diff changeset
38
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 326
diff changeset
39 Name season = Name::Unknown;
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 326
diff changeset
40 Date::Year year = 0;
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 326
diff changeset
41 };
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 326
diff changeset
42
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 326
diff changeset
43 } // namespace Anime
281
3ede7be4f449 anime_season: forgot these
Paper <paper@paper.us.eu.org>
parents:
diff changeset
44
3ede7be4f449 anime_season: forgot these
Paper <paper@paper.us.eu.org>
parents:
diff changeset
45 #endif // MINORI_CORE_ANIME_SEASON_H_