diff options
author | Max Kellermann <max@musicpd.org> | 2018-07-06 16:56:12 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-07-06 16:56:12 +0200 |
commit | 45139f94bbb0c7a52d0b22f4a73128f6e0137e4b (patch) | |
tree | f6bfe1456515787fee7a0d8654abb7366cca2b5b /src/db/plugins/upnp/UpnpDatabasePlugin.cxx | |
parent | 80cb680fca973a1e6d09dbd53a852f0f50caec06 (diff) |
db/LightSong: pass URI to constructor
Diffstat (limited to 'src/db/plugins/upnp/UpnpDatabasePlugin.cxx')
-rw-r--r-- | src/db/plugins/upnp/UpnpDatabasePlugin.cxx | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/db/plugins/upnp/UpnpDatabasePlugin.cxx b/src/db/plugins/upnp/UpnpDatabasePlugin.cxx index f24deb6a4..4679e70db 100644 --- a/src/db/plugins/upnp/UpnpDatabasePlugin.cxx +++ b/src/db/plugins/upnp/UpnpDatabasePlugin.cxx @@ -48,18 +48,24 @@ static const char *const rootid = "0"; -class UpnpSong : public LightSong { - std::string uri2, real_uri2; +class UpnpSongData { +protected: + std::string uri; + Tag tag; + + template<typename U, typename T> + UpnpSongData(U &&_uri, T &&_tag) noexcept + :uri(std::forward<U>(_uri)), tag(std::forward<T>(_tag)) {} +}; - Tag tag2; +class UpnpSong : UpnpSongData, public LightSong { + std::string real_uri2; public: UpnpSong(UPnPDirObject &&object, std::string &&_uri) - :LightSong(tag2), - uri2(std::move(_uri)), - real_uri2(std::move(object.url)), - tag2(std::move(object.tag)) { - uri = uri2.c_str(); + :UpnpSongData(std::move(_uri), std::move(object.tag)), + LightSong(UpnpSongData::uri.c_str(), UpnpSongData::tag), + real_uri2(std::move(object.url)) { real_uri = real_uri2.c_str(); } }; @@ -318,8 +324,7 @@ visitSong(const UPnPDirObject &meta, const char *path, if (!visit_song) return; - LightSong song(meta.tag); - song.uri = path; + LightSong song(path, meta.tag); song.real_uri = meta.url.c_str(); if (selection.Match(song)) |