diff include/core/anime.h @ 284:e66ffc338d82

anime: refactor title structure to a map
author Paper <paper@paper.us.eu.org>
date Wed, 08 May 2024 16:21:05 -0400
parents 657fda1b9cac
children 53e3c015a973
line wrap: on
line diff
--- a/include/core/anime.h	Wed May 08 16:20:37 2024 -0400
+++ b/include/core/anime.h	Wed May 08 16:21:05 2024 -0400
@@ -118,11 +118,7 @@
 
 struct SeriesInformation {
 	int id;
-	struct {
-		std::string romaji;
-		std::string english;
-		std::string native;
-	} title;
+	std::map<TitleLanguage, std::string> titles;
 	std::vector<std::string> synonyms;
 	int episodes = 0;
 	SeriesStatus status = SeriesStatus::Unknown;
@@ -164,9 +160,7 @@
 
 	/* Series data */
 	int GetId() const;
-	std::string GetRomajiTitle() const;
-	std::string GetEnglishTitle() const;
-	std::string GetNativeTitle() const;
+	std::optional<std::string> GetTitle(TitleLanguage language) const;
 	std::vector<std::string> GetTitleSynonyms() const;
 	int GetEpisodes() const;
 	SeriesStatus GetAiringStatus() const;
@@ -182,9 +176,7 @@
 	std::string GetServiceUrl() const;
 
 	void SetId(int id);
-	void SetRomajiTitle(std::string const& title);
-	void SetEnglishTitle(std::string const& title);
-	void SetNativeTitle(std::string const& title);
+	void SetTitle(TitleLanguage language, const std::string& title);
 	void SetTitleSynonyms(std::vector<std::string> const& synonyms);
 	void AddTitleSynonym(std::string const& synonym);
 	void SetEpisodes(int episodes);