diff src/library/library.cc @ 369:47c9f8502269

*: clang-format all the things I've edited the formatting a bit. Now pointer asterisks (and reference ampersands) are on the variable instead of the type, as well as having newlines for function braces (but nothing else)
author Paper <paper@tflc.us>
date Fri, 25 Jul 2025 10:16:02 -0400
parents 886f66775f31
children
line wrap: on
line diff
--- a/src/library/library.cc	Fri Jul 25 10:05:23 2025 -0400
+++ b/src/library/library.cc	Fri Jul 25 10:16:02 2025 -0400
@@ -13,7 +13,8 @@
 
 namespace Library {
 
-std::optional<std::filesystem::path> Database::GetAnimeFolder(int id) {
+std::optional<std::filesystem::path> Database::GetAnimeFolder(int id)
+{
 	// this function sucks, but it's the most I can really do for now.
 	//
 	// in the future the Refresh() function should look for directories
@@ -22,11 +23,11 @@
 	// episodes are contained in them. whichever directory has more episodes
 	// wins, or the first found if there is an equal amount.
 
-	for (const auto& [anime_id, episodes] : items) {
+	for (const auto &[anime_id, episodes] : items) {
 		if (id != anime_id)
 			continue;
 
-		for (const auto& [episode, path] : episodes) {
+		for (const auto &[episode, path] : episodes) {
 			return path.parent_path();
 			break;
 		}
@@ -37,11 +38,12 @@
 	return std::nullopt;
 }
 
-void Database::Refresh(std::optional<int> find_id) {
+void Database::Refresh(std::optional<int> find_id)
+{
 	items.clear();
 
-	for (const auto& folder : session.config.library.paths) {
-		for (const auto& entry : std::filesystem::recursive_directory_iterator(folder)) {
+	for (const auto &folder : session.config.library.paths) {
+		for (const auto &entry : std::filesystem::recursive_directory_iterator(folder)) {
 			const std::filesystem::path path = entry.path();
 			if (!std::filesystem::is_regular_file(path))
 				continue;
@@ -51,7 +53,7 @@
 			anitomy::Anitomy anitomy;
 			anitomy.Parse(basename);
 
-			const auto& elements = anitomy.elements();
+			const auto &elements = anitomy.elements();
 
 			const std::string title = Strings::ToUtf8String(elements.get(anitomy::kElementAnimeTitle));
 
@@ -59,7 +61,8 @@
 			if (id <= 0 || (find_id && find_id.value() != id))
 				continue;
 
-			const int episode = Strings::ToInt<int>(Strings::ToUtf8String(elements.get(anitomy::kElementEpisodeNumber)));
+			const int episode =
+			    Strings::ToInt<int>(Strings::ToUtf8String(elements.get(anitomy::kElementEpisodeNumber)));
 
 			// we have an ID now!
 			items[id][episode] = path;
@@ -67,11 +70,13 @@
 	}
 }
 
-void Database::Refresh() {
+void Database::Refresh()
+{
 	Refresh(std::nullopt);
 }
 
-void Database::Refresh(int id) {
+void Database::Refresh(int id)
+{
 	Refresh(std::optional<int>(id));
 }