From 0dc3752e3fa92e1a11018d3d2fba13da1a88212a Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Tue, 12 May 2015 10:28:29 +0200 Subject: [PATCH] add missing song_list.h --- src/song_list.h | 78 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 src/song_list.h diff --git a/src/song_list.h b/src/song_list.h new file mode 100644 index 00000000..17c67dec --- /dev/null +++ b/src/song_list.h @@ -0,0 +1,78 @@ +/*************************************************************************** + * Copyright (C) 2008-2014 by Andrzej Rybczak * + * electricityispower@gmail.com * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#ifndef NCMPCPP_SONG_LIST_H +#define NCMPCPP_SONG_LIST_H + +#include +#include +#include "menu.h" +#include "song.h" + +template +using SongIteratorT = boost::range_detail::any_iterator< + ValueT, + boost::random_access_traversal_tag, + const ValueT, // const needed, see https://svn.boost.org/trac/boost/ticket/10493 + std::ptrdiff_t +>; + +typedef SongIteratorT> SongIterator; +typedef SongIteratorT> ConstSongIterator; + +namespace Bit { +const size_t Properties = 0; +const size_t Song = 1; +} + +struct SongList +{ + virtual SongIterator currentS() = 0; + virtual ConstSongIterator currentS() const = 0; + virtual SongIterator beginS() = 0; + virtual ConstSongIterator beginS() const = 0; + virtual SongIterator endS() = 0; + virtual ConstSongIterator endS() const = 0; + + virtual std::vector getSelectedSongs() = 0; +}; + +inline SongIterator begin(SongList &list) { return list.beginS(); } +inline ConstSongIterator begin(const SongList &list) { return list.beginS(); } +inline SongIterator end(SongList &list) { return list.endS(); } +inline ConstSongIterator end(const SongList &list) { return list.endS(); } + +struct SongMenu: NC::Menu, SongList +{ + SongMenu() { } + SongMenu(NC::Menu &&base) + : NC::Menu(std::move(base)) { } + + virtual SongIterator currentS() OVERRIDE; + virtual ConstSongIterator currentS() const OVERRIDE; + virtual SongIterator beginS() OVERRIDE; + virtual ConstSongIterator beginS() const OVERRIDE; + virtual SongIterator endS() OVERRIDE; + virtual ConstSongIterator endS() const OVERRIDE; + + virtual std::vector getSelectedSongs() OVERRIDE; +}; + +#endif // NCMPCPP_SONG_LIST_H \ No newline at end of file