aboutsummaryrefslogtreecommitdiffstats
path: root/src/DecoderPrint.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-10-21 22:02:19 +0200
committerMax Kellermann <max@duempel.org>2013-10-21 22:02:19 +0200
commit74904b9cf2fe163c0ae1d53fb73b19826b256812 (patch)
tree5c7ee7cc1358b897d5734c14bba2f8c704e1c861 /src/DecoderPrint.cxx
parent82059645f18e4a8aa734e0a376d10bb52fc1cc7d (diff)
downloadmpd-74904b9cf2fe163c0ae1d53fb73b19826b256812.tar.gz
mpd-74904b9cf2fe163c0ae1d53fb73b19826b256812.tar.xz
mpd-74904b9cf2fe163c0ae1d53fb73b19826b256812.zip
DecoderList: reimplement _for_each() with function object
Diffstat (limited to 'src/DecoderPrint.cxx')
-rw-r--r--src/DecoderPrint.cxx22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/DecoderPrint.cxx b/src/DecoderPrint.cxx
index 9845e45ed..2372272c2 100644
--- a/src/DecoderPrint.cxx
+++ b/src/DecoderPrint.cxx
@@ -23,31 +23,33 @@
#include "DecoderPlugin.hxx"
#include "Client.hxx"
+#include <functional>
+
#include <assert.h>
static void
decoder_plugin_print(Client &client,
- const struct DecoderPlugin *plugin)
+ const DecoderPlugin &plugin)
{
const char *const*p;
- assert(plugin != nullptr);
- assert(plugin->name != nullptr);
+ assert(plugin.name != nullptr);
- client_printf(client, "plugin: %s\n", plugin->name);
+ client_printf(client, "plugin: %s\n", plugin.name);
- if (plugin->suffixes != nullptr)
- for (p = plugin->suffixes; *p != nullptr; ++p)
+ if (plugin.suffixes != nullptr)
+ for (p = plugin.suffixes; *p != nullptr; ++p)
client_printf(client, "suffix: %s\n", *p);
- if (plugin->mime_types != nullptr)
- for (p = plugin->mime_types; *p != nullptr; ++p)
+ if (plugin.mime_types != nullptr)
+ for (p = plugin.mime_types; *p != nullptr; ++p)
client_printf(client, "mime_type: %s\n", *p);
}
void
decoder_list_print(Client &client)
{
- decoder_plugins_for_each_enabled(plugin)
- decoder_plugin_print(client, plugin);
+ using namespace std::placeholders;
+ const auto f = std::bind(decoder_plugin_print, std::ref(client), _1);
+ decoder_plugins_for_each_enabled(f);
}