client/Response: add method Fmt() based on libfmt
This commit is contained in:
@@ -25,6 +25,8 @@
|
||||
#include "song/LightSong.hxx"
|
||||
#include "client/Response.hxx"
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
/**
|
||||
* Send detailed information about a range of songs in the queue to a
|
||||
* client.
|
||||
@@ -38,12 +40,12 @@ queue_print_song_info(Response &r, const Queue &queue,
|
||||
unsigned position)
|
||||
{
|
||||
song_print_info(r, queue.Get(position));
|
||||
r.Format("Pos: %u\nId: %u\n",
|
||||
position, queue.PositionToId(position));
|
||||
r.Fmt(FMT_STRING("Pos: {}\nId: {}\n"),
|
||||
position, queue.PositionToId(position));
|
||||
|
||||
uint8_t priority = queue.GetPriorityAtPosition(position);
|
||||
if (priority != 0)
|
||||
r.Format("Prio: %u\n", priority);
|
||||
r.Fmt(FMT_STRING("Prio: {}\n"), priority);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -65,7 +67,7 @@ queue_print_uris(Response &r, const Queue &queue,
|
||||
assert(end <= queue.GetLength());
|
||||
|
||||
for (unsigned i = start; i < end; ++i) {
|
||||
r.Format("%i:", i);
|
||||
r.Fmt(FMT_STRING("{}:"), i);
|
||||
song_print_uri(r, queue.Get(i));
|
||||
}
|
||||
}
|
||||
@@ -93,8 +95,8 @@ queue_print_changes_position(Response &r, const Queue &queue,
|
||||
|
||||
for (unsigned i = start; i < end; i++)
|
||||
if (queue.IsNewerAtPosition(i, version))
|
||||
r.Format("cpos: %i\nId: %i\n",
|
||||
i, queue.PositionToId(i));
|
||||
r.Fmt(FMT_STRING("cpos: {}\nId: {}\n"),
|
||||
i, queue.PositionToId(i));
|
||||
}
|
||||
|
||||
void
|
||||
|
Reference in New Issue
Block a user