Commit e9c99e05 authored by Max Kellermann's avatar Max Kellermann

DetachedSong: add LightSong cast operator

parent 332baa4f
......@@ -31,6 +31,19 @@ DetachedSong::DetachedSong(const LightSong &other)
start_time(other.start_time),
end_time(other.end_time) {}
DetachedSong::operator LightSong() const
{
LightSong result;
result.directory = nullptr;
result.uri = uri.c_str();
result.real_uri = real_uri.empty() ? nullptr : real_uri.c_str();
result.tag = &tag;
result.mtime = mtime;
result.start_time = start_time;
result.end_time = end_time;
return result;
}
bool
DetachedSong::IsRemote() const
{
......
......@@ -108,6 +108,9 @@ public:
DetachedSong &operator=(DetachedSong &&) = default;
gcc_pure
explicit operator LightSong() const;
gcc_pure
const char *GetURI() const {
return uri.c_str();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment