diff src/gui/translate/anilist.cc @ 279:657fda1b9cac

*: clean up enums
author Paper <paper@paper.us.eu.org>
date Fri, 19 Apr 2024 13:24:06 -0400
parents 9613d72b097e
children b1f625b0227c
line wrap: on
line diff
--- a/src/gui/translate/anilist.cc	Thu Apr 18 17:24:42 2024 -0400
+++ b/src/gui/translate/anilist.cc	Fri Apr 19 13:24:06 2024 -0400
@@ -4,49 +4,46 @@
 namespace Translate {
 namespace AniList {
 
-Anime::SeriesStatus ToSeriesStatus(std::string status) {
+Anime::SeriesStatus ToSeriesStatus(const std::string& status) {
 	static const std::unordered_map<std::string, Anime::SeriesStatus> map = {
-	    {"FINISHED",         Anime::SeriesStatus::FINISHED        },
-	    {"RELEASING",        Anime::SeriesStatus::RELEASING       },
-	    {"NOT_YET_RELEASED", Anime::SeriesStatus::NOT_YET_RELEASED},
-	    {"CANCELLED",        Anime::SeriesStatus::CANCELLED       },
-	    {"HIATUS",           Anime::SeriesStatus::HIATUS          }
+	    {"FINISHED",         Anime::SeriesStatus::Finished        },
+	    {"RELEASING",        Anime::SeriesStatus::Releasing       },
+	    {"NOT_YET_RELEASED", Anime::SeriesStatus::NotYetReleased},
+	    {"CANCELLED",        Anime::SeriesStatus::Cancelled       },
+	    {"HIATUS",           Anime::SeriesStatus::Hiatus          }
     };
 
 	if (map.find(status) == map.end())
-		return Anime::SeriesStatus::UNKNOWN;
+		return Anime::SeriesStatus::Unknown;
 	return map.at(status);
 }
 
-Anime::SeriesSeason ToSeriesSeason(std::string season) {
+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  }
+	    {"WINTER", Anime::SeriesSeason::Winter},
+	    {"SPRING", Anime::SeriesSeason::Spring},
+	    {"SUMMER", Anime::SeriesSeason::Summer},
+	    {"FALL",   Anime::SeriesSeason::Fall  }
     };
 
 	if (map.find(season) == map.end())
-		return Anime::SeriesSeason::UNKNOWN;
+		return Anime::SeriesSeason::Unknown;
 	return map.at(season);
 }
 
-Anime::SeriesFormat ToSeriesFormat(std::string format) {
+Anime::SeriesFormat ToSeriesFormat(const std::string& format) {
 	static const std::unordered_map<std::string, enum Anime::SeriesFormat> map = {
-	    {"TV",       Anime::SeriesFormat::TV      },
-        {"TV_SHORT", Anime::SeriesFormat::TV_SHORT},
-	    {"MOVIE",    Anime::SeriesFormat::MOVIE   },
-        {"SPECIAL",  Anime::SeriesFormat::SPECIAL },
-	    {"OVA",      Anime::SeriesFormat::OVA     },
-        {"ONA",      Anime::SeriesFormat::ONA     },
-	    {"MUSIC",    Anime::SeriesFormat::MUSIC   },
-        {"MANGA",    Anime::SeriesFormat::MANGA   },
-	    {"NOVEL",    Anime::SeriesFormat::NOVEL   },
-        {"ONE_SHOT", Anime::SeriesFormat::ONE_SHOT}
+	    {"TV",       Anime::SeriesFormat::Tv      },
+        {"TV_SHORT", Anime::SeriesFormat::TvShort},
+	    {"MOVIE",    Anime::SeriesFormat::Movie   },
+        {"SPECIAL",  Anime::SeriesFormat::Special },
+	    {"OVA",      Anime::SeriesFormat::Ova     },
+        {"ONA",      Anime::SeriesFormat::Ona     },
+	    {"MUSIC",    Anime::SeriesFormat::Music   }
     };
 
 	if (map.find(format) == map.end())
-		return Anime::SeriesFormat::UNKNOWN;
+		return Anime::SeriesFormat::Unknown;
 	return map.at(format);
 }