From 94b2ee627c06679eb2622f2ac2e2fb0240fbab3c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 3 Jan 2013 11:14:36 +0100 Subject: decoder_print: convert to C++ --- src/DecoderPrint.cxx | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/DecoderPrint.hxx | 28 ++++++++++++++++++++++++++ src/OtherCommands.cxx | 2 +- src/decoder_print.c | 53 ------------------------------------------------ src/decoder_print.h | 28 -------------------------- 5 files changed, 85 insertions(+), 82 deletions(-) create mode 100644 src/DecoderPrint.cxx create mode 100644 src/DecoderPrint.hxx delete mode 100644 src/decoder_print.c delete mode 100644 src/decoder_print.h (limited to 'src') diff --git a/src/DecoderPrint.cxx b/src/DecoderPrint.cxx new file mode 100644 index 000000000..a22908c0e --- /dev/null +++ b/src/DecoderPrint.cxx @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2003-2013 The Music Player Daemon Project + * http://www.musicpd.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "config.h" +#include "DecoderPrint.hxx" +#include "decoder_list.h" +#include "decoder_plugin.h" + +extern "C" { +#include "client.h" +} + +#include + +static void +decoder_plugin_print(struct client *client, + const struct decoder_plugin *plugin) +{ + const char *const*p; + + assert(plugin != NULL); + assert(plugin->name != NULL); + + client_printf(client, "plugin: %s\n", plugin->name); + + if (plugin->suffixes != NULL) + for (p = plugin->suffixes; *p != NULL; ++p) + client_printf(client, "suffix: %s\n", *p); + + if (plugin->mime_types != NULL) + for (p = plugin->mime_types; *p != NULL; ++p) + client_printf(client, "mime_type: %s\n", *p); +} + +void +decoder_list_print(struct client *client) +{ + decoder_plugins_for_each_enabled(plugin) + decoder_plugin_print(client, plugin); +} diff --git a/src/DecoderPrint.hxx b/src/DecoderPrint.hxx new file mode 100644 index 000000000..e6e14aef3 --- /dev/null +++ b/src/DecoderPrint.hxx @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2003-2013 The Music Player Daemon Project + * http://www.musicpd.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef MPD_DECODER_PRINT_HXX +#define MPD_DECODER_PRINT_HXX + +struct client; + +void +decoder_list_print(struct client *client); + +#endif diff --git a/src/OtherCommands.cxx b/src/OtherCommands.cxx index 756f8d5b6..66d97d841 100644 --- a/src/OtherCommands.cxx +++ b/src/OtherCommands.cxx @@ -28,13 +28,13 @@ #include "TagPrint.hxx" #include "TimePrint.hxx" #include "Mapper.hxx" +#include "DecoderPrint.hxx" extern "C" { #include "protocol/argparser.h" #include "protocol/result.h" #include "ls.h" #include "uri.h" -#include "decoder_print.h" #include "volume.h" #include "stats.h" } diff --git a/src/decoder_print.c b/src/decoder_print.c deleted file mode 100644 index e14477ed8..000000000 --- a/src/decoder_print.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2003-2011 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include "config.h" -#include "decoder_print.h" -#include "decoder_list.h" -#include "decoder_plugin.h" -#include "client.h" - -#include - -static void -decoder_plugin_print(struct client *client, - const struct decoder_plugin *plugin) -{ - const char *const*p; - - assert(plugin != NULL); - assert(plugin->name != NULL); - - client_printf(client, "plugin: %s\n", plugin->name); - - if (plugin->suffixes != NULL) - for (p = plugin->suffixes; *p != NULL; ++p) - client_printf(client, "suffix: %s\n", *p); - - if (plugin->mime_types != NULL) - for (p = plugin->mime_types; *p != NULL; ++p) - client_printf(client, "mime_type: %s\n", *p); -} - -void -decoder_list_print(struct client *client) -{ - decoder_plugins_for_each_enabled(plugin) - decoder_plugin_print(client, plugin); -} diff --git a/src/decoder_print.h b/src/decoder_print.h deleted file mode 100644 index 31713d5d8..000000000 --- a/src/decoder_print.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2003-2011 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef MPD_DECODER_PRINT_H -#define MPD_DECODER_PRINT_H - -struct client; - -void -decoder_list_print(struct client *client); - -#endif -- cgit v1.2.3