db/Interface: migrate visitor methods from class Error to C++ exceptions

This commit is contained in:
Max Kellermann
2016-10-29 10:21:57 +02:00
parent 9a9da7b077
commit fac8edd47a
27 changed files with 190 additions and 331 deletions

View File

@@ -78,10 +78,10 @@ StatsVisitSong(DatabaseStats &stats, StringSet &artists, StringSet &albums,
return true;
}
bool
GetStats(const Database &db, const DatabaseSelection &selection,
DatabaseStats &stats, Error &error)
DatabaseStats
GetStats(const Database &db, const DatabaseSelection &selection)
{
DatabaseStats stats;
stats.Clear();
StringSet artists, albums;
@@ -89,10 +89,9 @@ GetStats(const Database &db, const DatabaseSelection &selection,
const auto f = std::bind(StatsVisitSong,
std::ref(stats), std::ref(artists),
std::ref(albums), _1);
if (!db.Visit(selection, f, error))
return false;
db.Visit(selection, f);
stats.artist_count = artists.size();
stats.album_count = albums.size();
return true;
return stats;
}