Config: reformat all descriptions to fill 80 columns
[ncmpcpp.git] / src / song_list.cpp
blobddea39f9951d491efae91dfa4293ee5a209d9120
1 /***************************************************************************
2 * Copyright (C) 2008-2017 by Andrzej Rybczak *
3 * electricityispower@gmail.com *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
21 #include "helpers/song_iterator_maker.h"
22 #include "screens/song_info.h"
23 #include "utility/functional.h"
25 SongIterator SongMenu::currentS()
27 return makeSongIterator(current());
30 ConstSongIterator SongMenu::currentS() const
32 return makeConstSongIterator(current());
35 SongIterator SongMenu::beginS()
37 return makeSongIterator(begin());
40 ConstSongIterator SongMenu::beginS() const
42 return makeConstSongIterator(begin());
45 SongIterator SongMenu::endS()
47 return makeSongIterator(end());
50 ConstSongIterator SongMenu::endS() const
52 return makeConstSongIterator(end());
55 std::vector<MPD::Song> SongMenu::getSelectedSongs()
57 std::vector<MPD::Song> result;
58 for (auto it = begin(); it != end(); ++it)
59 if (it->isSelected())
60 result.push_back(it->value());
61 if (result.empty() && !empty())
62 result.push_back(current()->value());
63 return result;