diff options
author | Max Kellermann <max@duempel.org> | 2013-01-07 11:33:00 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-01-07 11:33:00 +0100 |
commit | 400ff1c81253d29b127834c0b5367e83bbb3430c (patch) | |
tree | d3660b68292829a6d1f76c4e32e26fef8bb53a19 | |
parent | d360f17a59fe6ed52ffa74c48c63164cf203d1e0 (diff) | |
download | mpd-400ff1c81253d29b127834c0b5367e83bbb3430c.tar.gz mpd-400ff1c81253d29b127834c0b5367e83bbb3430c.tar.xz mpd-400ff1c81253d29b127834c0b5367e83bbb3430c.zip |
DatabaseQueue: pass DatabaseSelection to Add...()
Diffstat (limited to '')
-rw-r--r-- | src/DatabaseCommands.cxx | 4 | ||||
-rw-r--r-- | src/DatabaseQueue.cxx | 7 | ||||
-rw-r--r-- | src/DatabaseQueue.hxx | 9 | ||||
-rw-r--r-- | src/QueueCommands.cxx | 5 |
4 files changed, 10 insertions, 15 deletions
diff --git a/src/DatabaseCommands.cxx b/src/DatabaseCommands.cxx index 116aa840a..bd5a48b35 100644 --- a/src/DatabaseCommands.cxx +++ b/src/DatabaseCommands.cxx @@ -91,9 +91,9 @@ handle_match_add(Client *client, int argc, char *argv[], bool fold_case) return COMMAND_RETURN_ERROR; } + const DatabaseSelection selection("", true, &filter); GError *error = NULL; - return AddFromDatabase(client->partition, - "", &filter, &error) + return AddFromDatabase(client->partition, selection, &error) ? COMMAND_RETURN_OK : print_error(client, error); } diff --git a/src/DatabaseQueue.cxx b/src/DatabaseQueue.cxx index d7bc97f56..dd93cf662 100644 --- a/src/DatabaseQueue.cxx +++ b/src/DatabaseQueue.cxx @@ -42,16 +42,13 @@ AddToQueue(Partition &partition, song &song, GError **error_r) } bool -AddFromDatabase(Partition &partition, - const char *uri, - const SongFilter *filter, GError **error_r) +AddFromDatabase(Partition &partition, const DatabaseSelection &selection, + GError **error_r) { const Database *db = GetDatabase(error_r); if (db == nullptr) return false; - const DatabaseSelection selection(uri, true, filter); - using namespace std::placeholders; const auto f = std::bind(AddToQueue, std::ref(partition), _1, _2); return db->Visit(selection, f, error_r); diff --git a/src/DatabaseQueue.hxx b/src/DatabaseQueue.hxx index 14947d5d5..bae5b1f05 100644 --- a/src/DatabaseQueue.hxx +++ b/src/DatabaseQueue.hxx @@ -20,16 +20,13 @@ #ifndef MPD_DATABASE_QUEUE_HXX #define MPD_DATABASE_QUEUE_HXX -#include "gcc.h" #include "gerror.h" -class SongFilter; struct Partition; +struct DatabaseSelection; -gcc_nonnull(2) bool -AddFromDatabase(Partition &partition, - const char *name, - const SongFilter *filter, GError **error_r); +AddFromDatabase(Partition &partition, const DatabaseSelection &selection, + GError **error_r); #endif diff --git a/src/QueueCommands.cxx b/src/QueueCommands.cxx index 58792fd1a..7ef5bffab 100644 --- a/src/QueueCommands.cxx +++ b/src/QueueCommands.cxx @@ -22,6 +22,7 @@ #include "CommandError.hxx" #include "DatabaseQueue.hxx" #include "SongFilter.hxx" +#include "DatabaseSelection.hxx" #include "Playlist.hxx" #include "PlaylistPrint.hxx" #include "ClientFile.hxx" @@ -69,9 +70,9 @@ handle_add(Client *client, G_GNUC_UNUSED int argc, char *argv[]) return print_playlist_result(client, result); } + const DatabaseSelection selection(uri, true); GError *error = NULL; - return AddFromDatabase(client->partition, - uri, nullptr, &error) + return AddFromDatabase(client->partition, selection, &error) ? COMMAND_RETURN_OK : print_error(client, error); } |