From 7652a2986b0d0ad55b2776685130f1c68d7108c7 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 6 Aug 2015 22:10:25 +0200 Subject: client/Response: new Client wrapper class for writing responses --- src/queue/QueuePrint.cxx | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'src/queue/QueuePrint.cxx') diff --git a/src/queue/QueuePrint.cxx b/src/queue/QueuePrint.cxx index c5bda5607..5ae1a3036 100644 --- a/src/queue/QueuePrint.cxx +++ b/src/queue/QueuePrint.cxx @@ -22,7 +22,7 @@ #include "Queue.hxx" #include "SongFilter.hxx" #include "SongPrint.hxx" -#include "client/Client.hxx" +#include "client/Response.hxx" /** * Send detailed information about a range of songs in the queue to a @@ -33,70 +33,70 @@ * @param end the index of the last song (excluding) */ static void -queue_print_song_info(Client &client, const Queue &queue, +queue_print_song_info(Response &r, Partition &partition, const Queue &queue, unsigned position) { - song_print_info(client, queue.Get(position)); - client_printf(client, "Pos: %u\nId: %u\n", - position, queue.PositionToId(position)); + song_print_info(r, partition, queue.Get(position)); + r.Format("Pos: %u\nId: %u\n", + position, queue.PositionToId(position)); uint8_t priority = queue.GetPriorityAtPosition(position); if (priority != 0) - client_printf(client, "Prio: %u\n", priority); + r.Format("Prio: %u\n", priority); } void -queue_print_info(Client &client, const Queue &queue, +queue_print_info(Response &r, Partition &partition, const Queue &queue, unsigned start, unsigned end) { assert(start <= end); assert(end <= queue.GetLength()); for (unsigned i = start; i < end; ++i) - queue_print_song_info(client, queue, i); + queue_print_song_info(r, partition, queue, i); } void -queue_print_uris(Client &client, const Queue &queue, +queue_print_uris(Response &r, Partition &partition, const Queue &queue, unsigned start, unsigned end) { assert(start <= end); assert(end <= queue.GetLength()); for (unsigned i = start; i < end; ++i) { - client_printf(client, "%i:", i); - song_print_uri(client, queue.Get(i)); + r.Format("%i:", i); + song_print_uri(r, partition, queue.Get(i)); } } void -queue_print_changes_info(Client &client, const Queue &queue, +queue_print_changes_info(Response &r, Partition &partition, const Queue &queue, uint32_t version) { for (unsigned i = 0; i < queue.GetLength(); i++) { if (queue.IsNewerAtPosition(i, version)) - queue_print_song_info(client, queue, i); + queue_print_song_info(r, partition, queue, i); } } void -queue_print_changes_position(Client &client, const Queue &queue, +queue_print_changes_position(Response &r, const Queue &queue, uint32_t version) { for (unsigned i = 0; i < queue.GetLength(); i++) if (queue.IsNewerAtPosition(i, version)) - client_printf(client, "cpos: %i\nId: %i\n", - i, queue.PositionToId(i)); + r.Format("cpos: %i\nId: %i\n", + i, queue.PositionToId(i)); } void -queue_find(Client &client, const Queue &queue, +queue_find(Response &r, Partition &partition, const Queue &queue, const SongFilter &filter) { for (unsigned i = 0; i < queue.GetLength(); i++) { const DetachedSong &song = queue.Get(i); if (filter.Match(song)) - queue_print_song_info(client, queue, i); + queue_print_song_info(r, partition, queue, i); } } -- cgit v1.2.3