Mercurial > minori
diff src/gui/translate/anilist.cc @ 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 | 2115488eb302 |
children |
line wrap: on
line diff
--- a/src/gui/translate/anilist.cc Thu Jun 13 00:42:00 2024 -0400 +++ b/src/gui/translate/anilist.cc Thu Jun 13 01:49:18 2024 -0400 @@ -18,16 +18,16 @@ return map.at(status); } -Anime::SeriesSeason ToSeriesSeason(const std::string& season) { - static const std::unordered_map<std::string, Anime::SeriesSeason> map = { - {"WINTER", Anime::SeriesSeason::Winter}, - {"SPRING", Anime::SeriesSeason::Spring}, - {"SUMMER", Anime::SeriesSeason::Summer}, - {"FALL", Anime::SeriesSeason::Fall } +Anime::Season::Name ToSeriesSeason(const std::string& season) { + static const std::unordered_map<std::string, Anime::Season::Name> map = { + {"WINTER", Anime::Season::Name::Winter}, + {"SPRING", Anime::Season::Name::Spring}, + {"SUMMER", Anime::Season::Name::Summer}, + {"FALL", Anime::Season::Name::Autumn} }; if (map.find(season) == map.end()) - return Anime::SeriesSeason::Unknown; + return Anime::Season::Name::Unknown; return map.at(season); } @@ -47,13 +47,13 @@ return map.at(format); } -std::string ToString(Anime::SeriesSeason season) { +std::string ToString(Anime::Season::Name season) { switch (season) { default: - case Anime::SeriesSeason::Winter: return "WINTER"; - case Anime::SeriesSeason::Fall: return "FALL"; - case Anime::SeriesSeason::Summer: return "SUMMER"; - case Anime::SeriesSeason::Spring: return "SPRING"; + case Anime::Season::Name::Winter: return "WINTER"; + case Anime::Season::Name::Autumn: return "FALL"; + case Anime::Season::Name::Summer: return "SUMMER"; + case Anime::Season::Name::Spring: return "SPRING"; } }