db/simple/ExportedSong: new class
This commit is contained in:
@@ -238,20 +238,20 @@ SimpleDatabase::GetSong(std::string_view uri) const
|
||||
throw DatabaseError(DatabaseErrorCode::NOT_FOUND,
|
||||
"No such song");
|
||||
|
||||
light_song.Construct(song->Export());
|
||||
exported_song.Construct(song->Export());
|
||||
|
||||
#ifndef NDEBUG
|
||||
++borrowed_song_count;
|
||||
#endif
|
||||
|
||||
return &light_song.Get();
|
||||
return &exported_song.Get();
|
||||
}
|
||||
|
||||
void
|
||||
SimpleDatabase::ReturnSong([[maybe_unused]] const LightSong *song) const noexcept
|
||||
{
|
||||
assert(song != nullptr);
|
||||
assert(song == prefixed_light_song || song == &light_song.Get());
|
||||
assert(song == prefixed_light_song || song == &exported_song.Get());
|
||||
|
||||
if (prefixed_light_song != nullptr) {
|
||||
delete prefixed_light_song;
|
||||
@@ -262,7 +262,7 @@ SimpleDatabase::ReturnSong([[maybe_unused]] const LightSong *song) const noexcep
|
||||
--borrowed_song_count;
|
||||
#endif
|
||||
|
||||
light_song.Destruct();
|
||||
exported_song.Destruct();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -316,7 +316,7 @@ SimpleDatabase::Visit(const DatabaseSelection &selection,
|
||||
if (visit_song) {
|
||||
Song *song = r.directory->FindSong(r.rest);
|
||||
if (song != nullptr) {
|
||||
const LightSong song2 = song->Export();
|
||||
const auto song2 = song->Export();
|
||||
if (selection.Match(song2))
|
||||
visit_song(song2);
|
||||
|
||||
|
Reference in New Issue
Block a user