diff options
author | Max Kellermann <max@duempel.org> | 2013-09-05 09:37:54 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-09-05 09:40:55 +0200 |
commit | 8929f88e6d78d538d943e80b66fcf21706e53974 (patch) | |
tree | 01232fd55f40dfa1cded59cb28a79b257ebb19e4 /src/playlist/MemoryPlaylistProvider.cxx | |
parent | 5348808bf594de927cc64eebae9118d6971343b1 (diff) | |
download | mpd-8929f88e6d78d538d943e80b66fcf21706e53974.tar.gz mpd-8929f88e6d78d538d943e80b66fcf21706e53974.tar.xz mpd-8929f88e6d78d538d943e80b66fcf21706e53974.zip |
PlaylistPlugin: add interface SongEnumerator
Replaces struct playlist_provider.
Diffstat (limited to '')
-rw-r--r-- | src/MemorySongEnumerator.cxx (renamed from src/playlist/MemoryPlaylistProvider.cxx) | 45 |
1 files changed, 4 insertions, 41 deletions
diff --git a/src/playlist/MemoryPlaylistProvider.cxx b/src/MemorySongEnumerator.cxx index c2b6d9312..7c9d05daa 100644 --- a/src/playlist/MemoryPlaylistProvider.cxx +++ b/src/MemorySongEnumerator.cxx @@ -18,50 +18,13 @@ */ #include "config.h" -#include "MemoryPlaylistProvider.hxx" -#include "Song.hxx" +#include "MemorySongEnumerator.hxx" -static void -memory_playlist_close(struct playlist_provider *_playlist) -{ - MemoryPlaylistProvider *playlist = (MemoryPlaylistProvider *)_playlist; - - delete playlist; -} - -static Song * -memory_playlist_read(struct playlist_provider *_playlist) -{ - MemoryPlaylistProvider *playlist = (MemoryPlaylistProvider *)_playlist; - - return playlist->Read(); -} - -static constexpr struct playlist_plugin memory_playlist_plugin = { - nullptr, - - nullptr, - nullptr, - nullptr, - nullptr, - memory_playlist_close, - memory_playlist_read, - - nullptr, - nullptr, - nullptr, -}; - -MemoryPlaylistProvider::MemoryPlaylistProvider(std::forward_list<SongPointer> &&_songs) - :songs(std::move(_songs)) { - playlist_provider_init(this, &memory_playlist_plugin); -} - -inline Song * -MemoryPlaylistProvider::Read() +Song * +MemorySongEnumerator::NextSong() { if (songs.empty()) - return NULL; + return nullptr; auto result = songs.front().Steal(); songs.pop_front(); |