summaryrefslogtreecommitdiff
path: root/src/db/plugins/upnp/UpnpDatabasePlugin.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2020-04-03 16:33:45 +0200
committerMax Kellermann <max@musicpd.org>2020-04-08 23:43:59 +0200
commit57fb153c5d000905016d3e2c2a67186397d5066b (patch)
tree7303333683d0456b3ee729ba461dad37b434f553 /src/db/plugins/upnp/UpnpDatabasePlugin.cxx
parent212401d6879106a22bbae61eb70afad21599d279 (diff)
db/Interface: pass std::string_view to GetSong()
Diffstat (limited to 'src/db/plugins/upnp/UpnpDatabasePlugin.cxx')
-rw-r--r--src/db/plugins/upnp/UpnpDatabasePlugin.cxx9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/db/plugins/upnp/UpnpDatabasePlugin.cxx b/src/db/plugins/upnp/UpnpDatabasePlugin.cxx
index ac6240893..1fa54dad3 100644
--- a/src/db/plugins/upnp/UpnpDatabasePlugin.cxx
+++ b/src/db/plugins/upnp/UpnpDatabasePlugin.cxx
@@ -62,8 +62,9 @@ class UpnpSong : UpnpSongData, public LightSong {
std::string real_uri2;
public:
- UpnpSong(UPnPDirObject &&object, std::string &&_uri) noexcept
- :UpnpSongData(std::move(_uri), std::move(object.tag)),
+ template<typename U>
+ UpnpSong(UPnPDirObject &&object, U &&_uri) noexcept
+ :UpnpSongData(std::forward<U>(_uri), std::move(object.tag)),
LightSong(UpnpSongData::uri.c_str(), UpnpSongData::tag),
real_uri2(std::move(object.url)) {
real_uri = real_uri2.c_str();
@@ -87,7 +88,7 @@ public:
void Open() override;
void Close() noexcept override;
- const LightSong *GetSong(const char *uri_utf8) const override;
+ const LightSong *GetSong(std::string_view uri_utf8) const override;
void ReturnSong(const LightSong *song) const noexcept override;
void Visit(const DatabaseSelection &selection,
@@ -185,7 +186,7 @@ UpnpDatabase::ReturnSong(const LightSong *_song) const noexcept
// Get song info by path. We can receive either the id path, or the titles
// one
const LightSong *
-UpnpDatabase::GetSong(const char *uri) const
+UpnpDatabase::GetSong(std::string_view uri) const
{
auto vpath = SplitString(uri, '/');
if (vpath.empty())