summaryrefslogtreecommitdiff
path: root/src/search_engine.cpp
diff options
context:
space:
mode:
authorAndrzej Rybczak <electricityispower@gmail.com>2012-10-01 20:44:22 +0200
committerAndrzej Rybczak <electricityispower@gmail.com>2012-10-01 20:44:22 +0200
commit9a292ca20d5b7c5f37efb4cd793c7c3fe4140442 (patch)
tree57abbc93f56e79ed4c0ccc675f6bfebc2986d6c9 /src/search_engine.cpp
parent60faa154627ed667a7e40cebc6475d3c30b3aab9 (diff)
mpd: make functions take item consumer instead of returning vector of items
Diffstat (limited to 'src/search_engine.cpp')
-rw-r--r--src/search_engine.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/search_engine.cpp b/src/search_engine.cpp
index 12327a27..16b608d5 100644
--- a/src/search_engine.cpp
+++ b/src/search_engine.cpp
@@ -410,21 +410,19 @@ void SearchEngine::Search()
Mpd.AddSearch(MPD_TAG_DATE, itsConstraints[9]);
if (!itsConstraints[10].empty())
Mpd.AddSearch(MPD_TAG_COMMENT, itsConstraints[10]);
- auto songs = Mpd.CommitSearchSongs();
- for (auto s = songs.begin(); s != songs.end(); ++s)
- w.addItem(*s);
+ Mpd.CommitSearchSongs([this](MPD::Song &&s) {
+ w.addItem(s);
+ });
return;
}
MPD::SongList list;
if (Config.search_in_db)
- list = Mpd.GetDirectoryRecursive("/");
+ Mpd.GetDirectoryRecursive("/", [&list](MPD::Song &&s) {
+ list.push_back(s);
+ });
else
- {
- list.reserve(myPlaylist->main().size());
- for (auto s = myPlaylist->main().beginV(); s != myPlaylist->main().endV(); ++s)
- list.push_back(*s);
- }
+ list.insert(list.end(), myPlaylist->main().beginV(), myPlaylist->main().endV());
bool any_found = 1;
bool found = 1;