From 86b0adc82ce64bb08518088c35ce754dc96d7062 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 26 Jan 2013 01:04:02 +0100 Subject: [PATCH] playlist/*: convert to C++ --- Makefile.am | 16 +++++----- src/CommandLine.cxx | 2 +- src/Main.cxx | 2 +- src/PlaylistAny.cxx | 2 +- src/PlaylistMapper.cxx | 2 +- src/PlaylistPrint.cxx | 2 +- src/{playlist_list.c => PlaylistRegistry.cxx} | 14 ++++++--- src/{playlist_list.h => PlaylistRegistry.hxx} | 6 ++-- src/UpdateWalk.cxx | 2 +- src/playlist/DespotifyPlaylistPlugin.cxx | 2 +- ...plugin.c => EmbeddedCuePlaylistPlugin.cxx} | 31 ++++++++++++------- ...plugin.h => EmbeddedCuePlaylistPlugin.hxx} | 6 ++-- ...list_plugin.c => LastFMPlaylistPlugin.cxx} | 23 ++++++++------ ...list_plugin.h => LastFMPlaylistPlugin.hxx} | 6 ++-- ..._plugin.c => SoundCloudPlaylistPlugin.cxx} | 21 +++++++------ ..._plugin.h => SoundCloudPlaylistPlugin.hxx} | 6 ++-- test/dump_playlist.cxx | 4 +-- 17 files changed, 83 insertions(+), 64 deletions(-) rename src/{playlist_list.c => PlaylistRegistry.cxx} (97%) rename src/{playlist_list.h => PlaylistRegistry.hxx} (94%) rename src/playlist/{embcue_playlist_plugin.c => EmbeddedCuePlaylistPlugin.cxx} (91%) rename src/playlist/{embcue_playlist_plugin.h => EmbeddedCuePlaylistPlugin.hxx} (84%) rename src/playlist/{lastfm_playlist_plugin.c => LastFMPlaylistPlugin.cxx} (95%) rename src/playlist/{lastfm_playlist_plugin.h => LastFMPlaylistPlugin.hxx} (84%) rename src/playlist/{soundcloud_playlist_plugin.c => SoundCloudPlaylistPlugin.cxx} (96%) rename src/playlist/{soundcloud_playlist_plugin.h => SoundCloudPlaylistPlugin.hxx} (83%) diff --git a/Makefile.am b/Makefile.am index d92ea9d5d..577055d51 100644 --- a/Makefile.am +++ b/Makefile.am @@ -97,14 +97,12 @@ mpd_headers = \ src/Playlist.hxx \ src/playlist_error.h \ src/playlist_plugin.h \ - src/playlist_list.h \ src/playlist/extm3u_playlist_plugin.h \ src/playlist/m3u_playlist_plugin.h \ src/playlist/pls_playlist_plugin.h \ src/playlist/xspf_playlist_plugin.h \ src/playlist/asx_playlist_plugin.h \ src/playlist/rss_playlist_plugin.h \ - src/playlist/lastfm_playlist_plugin.h \ src/playlist/cue_playlist_plugin.h \ src/poison.h \ src/riff.h \ @@ -928,9 +926,9 @@ libplaylist_plugins_a_SOURCES = \ src/playlist/asx_playlist_plugin.c \ src/playlist/rss_playlist_plugin.c \ src/playlist/cue_playlist_plugin.c \ - src/playlist/embcue_playlist_plugin.c \ - src/playlist/embcue_playlist_plugin.h \ - src/playlist_list.c + src/playlist/EmbeddedCuePlaylistPlugin.cxx \ + src/playlist/EmbeddedCuePlaylistPlugin.hxx \ + src/PlaylistRegistry.cxx src/PlaylistRegistry.hxx libplaylist_plugins_a_CPPFLAGS = $(AM_CPPFLAGS) \ $(YAJL_CFLAGS) \ $(patsubst -I%/FLAC,-I%,$(FLAC_CFLAGS)) @@ -940,7 +938,9 @@ PLAYLIST_LIBS = \ $(FLAC_LIBS) if ENABLE_LASTFM -libplaylist_plugins_a_SOURCES += src/playlist/lastfm_playlist_plugin.c +libplaylist_plugins_a_SOURCES += \ + src/playlist/LastFMPlaylistPlugin.cxx \ + src/playlist/LastFMPlaylistPlugin.hxx endif if ENABLE_DESPOTIFY @@ -951,8 +951,8 @@ endif if ENABLE_SOUNDCLOUD libplaylist_plugins_a_SOURCES += \ - src/playlist/soundcloud_playlist_plugin.h \ - src/playlist/soundcloud_playlist_plugin.c + src/playlist/SoundCloudPlaylistPlugin.cxx \ + src/playlist/SoundCloudPlaylistPlugin.hxx PLAYLIST_LIBS += $(YAJL_LIBS) endif diff --git a/src/CommandLine.cxx b/src/CommandLine.cxx index 6b7a8b1ca..c0b449859 100644 --- a/src/CommandLine.cxx +++ b/src/CommandLine.cxx @@ -28,7 +28,7 @@ #include "output_plugin.h" #include "InputRegistry.hxx" #include "InputPlugin.hxx" -#include "playlist_list.h" +#include "PlaylistRegistry.hxx" #include "playlist_plugin.h" #include "mpd_error.h" #include "glib_compat.h" diff --git a/src/Main.cxx b/src/Main.cxx index 1bacc0e3e..32374bcca 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -48,6 +48,7 @@ #include "event/Loop.hxx" #include "IOThread.hxx" #include "fs/Path.hxx" +#include "PlaylistRegistry.hxx" extern "C" { #include "daemon.h" @@ -55,7 +56,6 @@ extern "C" { #include "audio_config.h" #include "pcm_resample.h" #include "decoder_list.h" -#include "playlist_list.h" #include "zeroconf.h" } diff --git a/src/PlaylistAny.cxx b/src/PlaylistAny.cxx index f62634c96..5c3073682 100644 --- a/src/PlaylistAny.cxx +++ b/src/PlaylistAny.cxx @@ -20,10 +20,10 @@ #include "config.h" #include "PlaylistAny.hxx" #include "PlaylistMapper.hxx" +#include "PlaylistRegistry.hxx" #include "input_stream.h" extern "C" { -#include "playlist_list.h" #include "uri.h" } diff --git a/src/PlaylistMapper.cxx b/src/PlaylistMapper.cxx index d63681501..aa37453fb 100644 --- a/src/PlaylistMapper.cxx +++ b/src/PlaylistMapper.cxx @@ -20,11 +20,11 @@ #include "config.h" #include "PlaylistMapper.hxx" #include "PlaylistFile.hxx" +#include "PlaylistRegistry.hxx" #include "Mapper.hxx" #include "fs/Path.hxx" extern "C" { -#include "playlist_list.h" #include "uri.h" } diff --git a/src/PlaylistPrint.cxx b/src/PlaylistPrint.cxx index e6ece7e6b..5bde8238a 100644 --- a/src/PlaylistPrint.cxx +++ b/src/PlaylistPrint.cxx @@ -23,6 +23,7 @@ #include "PlaylistAny.hxx" #include "PlaylistSong.hxx" #include "Playlist.hxx" +#include "PlaylistRegistry.hxx" #include "QueuePrint.hxx" #include "SongPrint.hxx" #include "DatabaseGlue.hxx" @@ -31,7 +32,6 @@ #include "input_stream.h" extern "C" { -#include "playlist_list.h" #include "playlist_plugin.h" #include "song.h" } diff --git a/src/playlist_list.c b/src/PlaylistRegistry.cxx similarity index 97% rename from src/playlist_list.c rename to src/PlaylistRegistry.cxx index 9ba78f38c..f919f388b 100644 --- a/src/playlist_list.c +++ b/src/PlaylistRegistry.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2011 The Music Player Daemon Project + * 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 @@ -18,21 +18,25 @@ */ #include "config.h" -#include "playlist_list.h" +#include "PlaylistRegistry.hxx" #include "playlist_plugin.h" #include "playlist/extm3u_playlist_plugin.h" #include "playlist/m3u_playlist_plugin.h" #include "playlist/xspf_playlist_plugin.h" -#include "playlist/lastfm_playlist_plugin.h" +#include "playlist/LastFMPlaylistPlugin.hxx" #include "playlist/DespotifyPlaylistPlugin.hxx" -#include "playlist/soundcloud_playlist_plugin.h" +#include "playlist/SoundCloudPlaylistPlugin.hxx" #include "playlist/pls_playlist_plugin.h" #include "playlist/asx_playlist_plugin.h" #include "playlist/rss_playlist_plugin.h" #include "playlist/cue_playlist_plugin.h" -#include "playlist/embcue_playlist_plugin.h" +#include "playlist/EmbeddedCuePlaylistPlugin.hxx" #include "input_stream.h" + +extern "C" { #include "uri.h" +} + #include "string_util.h" #include "conf.h" #include "mpd_error.h" diff --git a/src/playlist_list.h b/src/PlaylistRegistry.hxx similarity index 94% rename from src/playlist_list.h rename to src/PlaylistRegistry.hxx index c3967d5ae..5116b5082 100644 --- a/src/playlist_list.h +++ b/src/PlaylistRegistry.hxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2011 The Music Player Daemon Project + * 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 @@ -17,8 +17,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef MPD_PLAYLIST_LIST_H -#define MPD_PLAYLIST_LIST_H +#ifndef MPD_PLAYLIST_REGISTRY_HXX +#define MPD_PLAYLIST_REGISTRY_HXX #include diff --git a/src/UpdateWalk.cxx b/src/UpdateWalk.cxx index fb6618111..dcac0f97e 100644 --- a/src/UpdateWalk.cxx +++ b/src/UpdateWalk.cxx @@ -28,6 +28,7 @@ #include "Directory.hxx" #include "song.h" #include "PlaylistVector.hxx" +#include "PlaylistRegistry.hxx" #include "Mapper.hxx" #include "ExcludeList.hxx" #include "conf.h" @@ -35,7 +36,6 @@ extern "C" { #include "uri.h" -#include "playlist_list.h" } #include diff --git a/src/playlist/DespotifyPlaylistPlugin.cxx b/src/playlist/DespotifyPlaylistPlugin.cxx index 049c9499c..3466d5685 100644 --- a/src/playlist/DespotifyPlaylistPlugin.cxx +++ b/src/playlist/DespotifyPlaylistPlugin.cxx @@ -21,7 +21,7 @@ #include "DespotifyPlaylistPlugin.hxx" #include "DespotifyUtils.hxx" #include "playlist_plugin.h" -#include "playlist_list.h" +#include "PlaylistRegistry.hxx" #include "conf.h" #include "uri.h" #include "tag.h" diff --git a/src/playlist/embcue_playlist_plugin.c b/src/playlist/EmbeddedCuePlaylistPlugin.cxx similarity index 91% rename from src/playlist/embcue_playlist_plugin.c rename to src/playlist/EmbeddedCuePlaylistPlugin.cxx index 6d9a957f9..2337f806e 100644 --- a/src/playlist/embcue_playlist_plugin.c +++ b/src/playlist/EmbeddedCuePlaylistPlugin.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2012 The Music Player Daemon Project + * 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 @@ -24,15 +24,18 @@ */ #include "config.h" -#include "playlist/embcue_playlist_plugin.h" +#include "EmbeddedCuePlaylistPlugin.hxx" #include "playlist_plugin.h" #include "tag.h" #include "tag_handler.h" +#include "song.h" + +extern "C" { #include "tag_file.h" #include "tag_ape.h" #include "tag_id3.h" -#include "song.h" #include "cue/cue_parser.h" +} #include #include @@ -67,7 +70,7 @@ struct embcue_playlist { static void embcue_tag_pair(const char *name, const char *value, void *ctx) { - struct embcue_playlist *playlist = ctx; + struct embcue_playlist *playlist = (struct embcue_playlist *)ctx; if (playlist->cuesheet == NULL && g_ascii_strcasecmp(name, "cuesheet") == 0) @@ -75,7 +78,9 @@ embcue_tag_pair(const char *name, const char *value, void *ctx) } static const struct tag_handler embcue_tag_handler = { - .pair = embcue_tag_pair, + nullptr, + nullptr, + embcue_tag_pair, }; static struct playlist_provider * @@ -170,12 +175,16 @@ static const char *const embcue_playlist_suffixes[] = { }; const struct playlist_plugin embcue_playlist_plugin = { - .name = "cue", + "cue", - .open_uri = embcue_playlist_open_uri, - .close = embcue_playlist_close, - .read = embcue_playlist_read, + nullptr, + nullptr, + embcue_playlist_open_uri, + nullptr, + embcue_playlist_close, + embcue_playlist_read, - .suffixes = embcue_playlist_suffixes, - .mime_types = NULL, + embcue_playlist_suffixes, + nullptr, + nullptr, }; diff --git a/src/playlist/embcue_playlist_plugin.h b/src/playlist/EmbeddedCuePlaylistPlugin.hxx similarity index 84% rename from src/playlist/embcue_playlist_plugin.h rename to src/playlist/EmbeddedCuePlaylistPlugin.hxx index c5f21b27e..e306730f4 100644 --- a/src/playlist/embcue_playlist_plugin.h +++ b/src/playlist/EmbeddedCuePlaylistPlugin.hxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2012 The Music Player Daemon Project + * 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 @@ -17,8 +17,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef MPD_PLAYLIST_EMBCUE_PLAYLIST_PLUGIN_H -#define MPD_PLAYLIST_EMBCUE_PLAYLIST_PLUGIN_H +#ifndef MPD_EMBCUE_PLAYLIST_PLUGIN_HXX +#define MPD_EMBCUE_PLAYLIST_PLUGIN_HXX extern const struct playlist_plugin embcue_playlist_plugin; diff --git a/src/playlist/lastfm_playlist_plugin.c b/src/playlist/LastFMPlaylistPlugin.cxx similarity index 95% rename from src/playlist/lastfm_playlist_plugin.c rename to src/playlist/LastFMPlaylistPlugin.cxx index ead14deaa..67192574d 100644 --- a/src/playlist/lastfm_playlist_plugin.c +++ b/src/playlist/LastFMPlaylistPlugin.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2011 The Music Player Daemon Project + * 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 @@ -18,9 +18,9 @@ */ #include "config.h" -#include "playlist/lastfm_playlist_plugin.h" +#include "LastFMPlaylistPlugin.hxx" #include "playlist_plugin.h" -#include "playlist_list.h" +#include "PlaylistRegistry.hxx" #include "conf.h" #include "uri.h" #include "song.h" @@ -284,13 +284,16 @@ static const char *const lastfm_schemes[] = { }; const struct playlist_plugin lastfm_playlist_plugin = { - .name = "lastfm", + "lastfm", - .init = lastfm_init, - .finish = lastfm_finish, - .open_uri = lastfm_open_uri, - .close = lastfm_close, - .read = lastfm_read, + lastfm_init, + lastfm_finish, + lastfm_open_uri, + nullptr, + lastfm_close, + lastfm_read, - .schemes = lastfm_schemes, + lastfm_schemes, + nullptr, + nullptr, }; diff --git a/src/playlist/lastfm_playlist_plugin.h b/src/playlist/LastFMPlaylistPlugin.hxx similarity index 84% rename from src/playlist/lastfm_playlist_plugin.h rename to src/playlist/LastFMPlaylistPlugin.hxx index 46a8b0caf..fe0e206d8 100644 --- a/src/playlist/lastfm_playlist_plugin.h +++ b/src/playlist/LastFMPlaylistPlugin.hxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2011 The Music Player Daemon Project + * 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 @@ -17,8 +17,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef MPD_PLAYLIST_LASTFM_PLAYLIST_PLUGIN_H -#define MPD_PLAYLIST_LASTFM_PLAYLIST_PLUGIN_H +#ifndef MPD_LASTFM_PLAYLIST_PLUGIN_HXX +#define MPD_LASTFM_PLAYLIST_PLUGIN_HXX extern const struct playlist_plugin lastfm_playlist_plugin; diff --git a/src/playlist/soundcloud_playlist_plugin.c b/src/playlist/SoundCloudPlaylistPlugin.cxx similarity index 96% rename from src/playlist/soundcloud_playlist_plugin.c rename to src/playlist/SoundCloudPlaylistPlugin.cxx index 7c79f880a..71a2af6cd 100644 --- a/src/playlist/soundcloud_playlist_plugin.c +++ b/src/playlist/SoundCloudPlaylistPlugin.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2011 The Music Player Daemon Project + * 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 @@ -18,7 +18,7 @@ */ #include "config.h" -#include "playlist/soundcloud_playlist_plugin.h" +#include "SoundCloudPlaylistPlugin.hxx" #include "conf.h" #include "input_stream.h" #include "playlist_plugin.h" @@ -434,15 +434,18 @@ static const char *const soundcloud_schemes[] = { }; const struct playlist_plugin soundcloud_playlist_plugin = { - .name = "soundcloud", + "soundcloud", - .init = soundcloud_init, - .finish = soundcloud_finish, - .open_uri = soundcloud_open_uri, - .close = soundcloud_close, - .read = soundcloud_read, + soundcloud_init, + soundcloud_finish, + soundcloud_open_uri, + nullptr, + soundcloud_close, + soundcloud_read, - .schemes = soundcloud_schemes, + soundcloud_schemes, + nullptr, + nullptr, }; diff --git a/src/playlist/soundcloud_playlist_plugin.h b/src/playlist/SoundCloudPlaylistPlugin.hxx similarity index 83% rename from src/playlist/soundcloud_playlist_plugin.h rename to src/playlist/SoundCloudPlaylistPlugin.hxx index e09e2dd46..7c121328c 100644 --- a/src/playlist/soundcloud_playlist_plugin.h +++ b/src/playlist/SoundCloudPlaylistPlugin.hxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2011 The Music Player Daemon Project + * 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 @@ -17,8 +17,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef MPD_PLAYLIST_SOUNDCLOUD_PLAYLIST_PLUGIN_H -#define MPD_PLAYLIST_SOUNDCLOUD_PLAYLIST_PLUGIN_H +#ifndef MPD_SOUNDCLOUD_PLAYLIST_PLUGIN_HXX +#define MPD_SOUNDCLOUD_PLAYLIST_PLUGIN_HXX extern const struct playlist_plugin soundcloud_playlist_plugin; diff --git a/test/dump_playlist.cxx b/test/dump_playlist.cxx index c95d4376e..cc749d2ad 100644 --- a/test/dump_playlist.cxx +++ b/test/dump_playlist.cxx @@ -26,11 +26,11 @@ #include "decoder_api.h" #include "InputInit.hxx" #include "IOThread.hxx" +#include "PlaylistRegistry.hxx" +#include "playlist_plugin.h" extern "C" { #include "decoder_list.h" -#include "playlist_list.h" -#include "playlist_plugin.h" } #include