client/Response: add method Fmt() based on libfmt

This commit is contained in:
Max Kellermann
2021-05-21 20:35:29 +02:00
parent a9c704b76e
commit 0440c41cba
27 changed files with 241 additions and 195 deletions
+11 -8
View File
@@ -26,21 +26,24 @@
#include "MultipleOutputs.hxx"
#include "client/Response.hxx"
#include <fmt/format.h>
void
printAudioDevices(Response &r, const MultipleOutputs &outputs)
{
for (unsigned i = 0, n = outputs.Size(); i != n; ++i) {
const auto &ao = outputs.Get(i);
r.Format("outputid: %u\n"
"outputname: %s\n"
"plugin: %s\n"
"outputenabled: %i\n",
i,
ao.GetName(), ao.GetPluginName(),
ao.IsEnabled());
r.Fmt(FMT_STRING("outputid: {}\n"
"outputname: {}\n"
"plugin: {}\n"
"outputenabled: {}\n"),
i,
ao.GetName(), ao.GetPluginName(),
ao.IsEnabled());
for (const auto &[attribute, value] : ao.GetAttributes())
r.Format("attribute: %s=%s\n", attribute.c_str(), value.c_str());
r.Fmt(FMT_STRING("attribute: {}={}\n"),
attribute, value);
}
}
+3
View File
@@ -35,6 +35,9 @@ output_glue = static_library(
'Finish.cxx',
'Init.cxx',
include_directories: inc,
dependencies: [
fmt_dep,
],
)
output_glue_dep = declare_dependency(