# HG changeset patch # User Paper # Date 1696322705 14400 # Node ID 64e5f427c6a24fdfc2684b315213f8b253089272 # Parent 27a19dd6cba19178e6bf592fee276bad3fd1ad14 services/anilist: remove unordered_map usage for enum classes for some reason in C++11 unordered_maps don't work on enumerations. so instead we'll just use a switch statement :P diff -r 27a19dd6cba1 -r 64e5f427c6a2 src/services/anilist.cpp --- a/src/services/anilist.cpp Tue Oct 03 03:38:25 2023 -0400 +++ b/src/services/anilist.cpp Tue Oct 03 04:45:05 2023 -0400 @@ -98,20 +98,22 @@ } std::string ListStatusToString(const Anime::Anime& anime) { - std::unordered_map map = { - {Anime::ListStatus::CURRENT, "CURRENT" }, - {Anime::ListStatus::PLANNING, "PLANNING" }, - {Anime::ListStatus::COMPLETED, "COMPLETED"}, - {Anime::ListStatus::DROPPED, "DROPPED" }, - {Anime::ListStatus::PAUSED, "PAUSED" } - }; - if (anime.GetUserIsRewatching()) return "REWATCHING"; - if (map.find(anime.GetUserStatus()) == map.end()) - return "CURRENT"; - return map[anime.GetUserStatus()]; + switch (anime.GetUserStatus()) { + case Anime::ListStatus::PLANNING: + return "PLANNING"; + case Anime::ListStatus::COMPLETED: + return "COMPLETED"; + case Anime::ListStatus::DROPPED: + return "DROPPED"; + case Anime::ListStatus::PAUSED: + return "PAUSED"; + default: + break; + } + return "CURRENT"; } Date ParseDate(const nlohmann::json& json) {