From 64465c1318e227ca625ee2047ec8b6a8f0c2faff Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 19 Jan 2014 19:57:27 +0100 Subject: Song: make the "parent" attribute mandatory The Song class is only used for database songs now. A Song without a Directory is not possible anymore. --- src/Song.hxx | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/Song.hxx') diff --git a/src/Song.hxx b/src/Song.hxx index 824fb429c..0b94fe6d0 100644 --- a/src/Song.hxx +++ b/src/Song.hxx @@ -54,7 +54,7 @@ struct Song { * the current database plugin does not manage the parent * directory this way. */ - Directory *parent; + Directory *const parent; time_t mtime; @@ -75,15 +75,15 @@ struct Song { */ char uri[sizeof(int)]; - Song(const char *_uri, size_t uri_length, Directory *parent); + Song(const char *_uri, size_t uri_length, Directory &parent); ~Song(); gcc_malloc - static Song *NewFrom(DetachedSong &&other, Directory *parent); + static Song *NewFrom(DetachedSong &&other, Directory &parent); /** allocate a new song with a local file name */ gcc_malloc - static Song *NewFile(const char *path_utf8, Directory *parent); + static Song *NewFile(const char *path_utf8, Directory &parent); /** * allocate a new song structure with a local file name and attempt to @@ -91,11 +91,7 @@ struct Song { * data, nullptr is returned. */ gcc_malloc - static Song *LoadFile(const char *path_utf8, Directory *parent); - - static Song *LoadFile(const char *path_utf8, Directory &parent) { - return LoadFile(path_utf8, &parent); - } + static Song *LoadFile(const char *path_utf8, Directory &parent); void Free(); -- cgit v1.2.3