db/simple/Song: remove static method NewFile()
This commit is contained in:
parent
6a13847287
commit
497d090814
@ -45,7 +45,7 @@ Song::LoadFile(Storage &storage, const char *path_utf8, Directory &parent)
|
|||||||
assert(!uri_has_scheme(path_utf8));
|
assert(!uri_has_scheme(path_utf8));
|
||||||
assert(strchr(path_utf8, '\n') == nullptr);
|
assert(strchr(path_utf8, '\n') == nullptr);
|
||||||
|
|
||||||
auto song = NewFile(path_utf8, parent);
|
auto song = std::make_unique<Song>(path_utf8, parent);
|
||||||
if (!song->UpdateFile(storage))
|
if (!song->UpdateFile(storage))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
@ -98,8 +98,7 @@ Song::LoadFromArchive(ArchiveFile &archive, const char *name_utf8,
|
|||||||
assert(!uri_has_scheme(name_utf8));
|
assert(!uri_has_scheme(name_utf8));
|
||||||
assert(strchr(name_utf8, '\n') == nullptr);
|
assert(strchr(name_utf8, '\n') == nullptr);
|
||||||
|
|
||||||
auto song = NewFile(name_utf8, parent);
|
auto song = std::make_unique<Song>(name_utf8, parent);
|
||||||
|
|
||||||
if (!song->UpdateFileInArchive(archive))
|
if (!song->UpdateFileInArchive(archive))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
|
@ -48,12 +48,6 @@ Song::NewFrom(DetachedSong &&other, Directory &parent) noexcept
|
|||||||
return song;
|
return song;
|
||||||
}
|
}
|
||||||
|
|
||||||
SongPtr
|
|
||||||
Song::NewFile(const char *path, Directory &parent) noexcept
|
|
||||||
{
|
|
||||||
return SongPtr(song_alloc(path, parent));
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
Song::GetURI() const noexcept
|
Song::GetURI() const noexcept
|
||||||
{
|
{
|
||||||
|
@ -101,9 +101,6 @@ struct Song {
|
|||||||
|
|
||||||
static SongPtr NewFrom(DetachedSong &&other, Directory &parent) noexcept;
|
static SongPtr NewFrom(DetachedSong &&other, Directory &parent) noexcept;
|
||||||
|
|
||||||
/** allocate a new song with a local file name */
|
|
||||||
static SongPtr NewFile(const char *path_utf8, Directory &parent) noexcept;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* allocate a new song structure with a local file name and attempt to
|
* allocate a new song structure with a local file name and attempt to
|
||||||
* load its metadata. If all decoder plugin fail to read its meta
|
* load its metadata. If all decoder plugin fail to read its meta
|
||||||
|
Loading…
Reference in New Issue
Block a user