aboutsummaryrefslogtreecommitdiffstats
path: root/src/queue
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-08-06 22:10:25 +0200
committerMax Kellermann <max@duempel.org>2015-08-12 08:41:05 +0200
commit7652a2986b0d0ad55b2776685130f1c68d7108c7 (patch)
treeb4d45e60e97757454f1ff8e4dc793a1e7d852c36 /src/queue
parentb1480167be487d09ff46bb86ad02041fb28acff1 (diff)
downloadmpd-7652a2986b0d0ad55b2776685130f1c68d7108c7.tar.gz
mpd-7652a2986b0d0ad55b2776685130f1c68d7108c7.tar.xz
mpd-7652a2986b0d0ad55b2776685130f1c68d7108c7.zip
client/Response: new Client wrapper class for writing responses
Diffstat (limited to 'src/queue')
-rw-r--r--src/queue/QueuePrint.cxx36
-rw-r--r--src/queue/QueuePrint.hxx13
2 files changed, 25 insertions, 24 deletions
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);
}
}
diff --git a/src/queue/QueuePrint.hxx b/src/queue/QueuePrint.hxx
index 6589ee93e..88d28e8ca 100644
--- a/src/queue/QueuePrint.hxx
+++ b/src/queue/QueuePrint.hxx
@@ -28,27 +28,28 @@
#include <stdint.h>
struct Queue;
+struct Partition;
class SongFilter;
-class Client;
+class Response;
void
-queue_print_info(Client &client, const Queue &queue,
+queue_print_info(Response &r, Partition &partition, const Queue &queue,
unsigned start, unsigned end);
void
-queue_print_uris(Client &client, const Queue &queue,
+queue_print_uris(Response &r, Partition &partition, const Queue &queue,
unsigned start, unsigned end);
void
-queue_print_changes_info(Client &client, const Queue &queue,
+queue_print_changes_info(Response &r, Partition &partition, const Queue &queue,
uint32_t version);
void
-queue_print_changes_position(Client &client, const Queue &queue,
+queue_print_changes_position(Response &r, const Queue &queue,
uint32_t version);
void
-queue_find(Client &client, const Queue &queue,
+queue_find(Response &response, Partition &partition, const Queue &queue,
const SongFilter &filter);
#endif