comparison 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
comparison
equal deleted inserted replaced
326:10096c5489e3 327:b5d6c27c308f
1 #ifndef MINORI_CORE_ANIME_SEASON_H_ 1 #ifndef MINORI_CORE_ANIME_SEASON_H_
2 #define MINORI_CORE_ANIME_SEASON_H_ 2 #define MINORI_CORE_ANIME_SEASON_H_
3 3
4 #include "core/anime.h" /* Anime::SeriesSeason */
5 #include "core/date.h" /* Date::Month */ 4 #include "core/date.h" /* Date::Month */
5
6 #include <array>
6 7
7 namespace Anime { 8 namespace Anime {
8 9
9 SeriesSeason GetSeasonForMonth(Date::Month month); 10 class Season final {
11 public:
12 enum class Name {
13 Unknown,
14 Winter,
15 Spring,
16 Summer,
17 Autumn,
18 };
10 19
11 } 20 static constexpr std::array<Name, 4> Names{
21 Name::Winter,
22 Name::Spring,
23 Name::Summer,
24 Name::Autumn
25 };
26
27 Season() = default;
28 Season(Name s, Date::Year y);
29 explicit Season(const Date& date);
30
31 bool operator==(const Season& o) const;
32 bool operator!=(const Season& o) const;
33
34 bool operator<(const Season& o) const;
35 bool operator>(const Season& o) const;
36 bool operator<=(const Season& o) const;
37 bool operator>=(const Season& o) const;
38
39 Name season = Name::Unknown;
40 Date::Year year = 0;
41 };
42
43 } // namespace Anime
12 44
13 #endif // MINORI_CORE_ANIME_SEASON_H_ 45 #endif // MINORI_CORE_ANIME_SEASON_H_