From 5faf443038edfb7e79ae423a3499faa3af05d64b Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 9 Jan 2013 22:37:47 +0100 Subject: event_pipe.h: convert to C++ --- src/EventPipe.cxx | 2 +- src/EventPipe.hxx | 69 +++++++++++++++++++++++++++++++++++++ src/Idle.cxx | 5 +-- src/Main.cxx | 2 +- src/PlayerThread.cxx | 5 +-- src/PlaylistGlobal.cxx | 5 +-- src/SignalHandlers.cxx | 2 +- src/UpdateGlue.cxx | 2 +- src/UpdateRemove.cxx | 5 +-- src/Volume.cxx | 5 +-- src/Win32Main.cxx | 5 +-- src/event_pipe.h | 77 ------------------------------------------ src/mixer/AlsaMixerPlugin.cxx | 2 +- src/mixer/PulseMixerPlugin.cxx | 2 +- 14 files changed, 81 insertions(+), 107 deletions(-) create mode 100644 src/EventPipe.hxx delete mode 100644 src/event_pipe.h (limited to 'src') diff --git a/src/EventPipe.cxx b/src/EventPipe.cxx index b2c80a3c1..6c885c01b 100644 --- a/src/EventPipe.cxx +++ b/src/EventPipe.cxx @@ -18,7 +18,7 @@ */ #include "config.h" -#include "event_pipe.h" +#include "EventPipe.hxx" #include "fd_util.h" #include "mpd_error.h" diff --git a/src/EventPipe.hxx b/src/EventPipe.hxx new file mode 100644 index 000000000..f7a0c30f3 --- /dev/null +++ b/src/EventPipe.hxx @@ -0,0 +1,69 @@ +/* + * 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_EVENT_PIPE_HXX +#define MPD_EVENT_PIPE_HXX + +enum pipe_event { + /** database update was finished */ + PIPE_EVENT_UPDATE, + + /** during database update, a song was deleted */ + PIPE_EVENT_DELETE, + + /** an idle event was emitted */ + PIPE_EVENT_IDLE, + + /** must call playlist_sync() */ + PIPE_EVENT_PLAYLIST, + + /** the current song's tag has changed */ + PIPE_EVENT_TAG, + + /** SIGHUP received: reload configuration, roll log file */ + PIPE_EVENT_RELOAD, + + /** a hardware mixer plugin has detected a change */ + PIPE_EVENT_MIXER, + + /** shutdown requested */ + PIPE_EVENT_SHUTDOWN, + + PIPE_EVENT_MAX +}; + +typedef void (*event_pipe_callback_t)(void); + +void event_pipe_init(void); + +void event_pipe_deinit(void); + +void +event_pipe_register(enum pipe_event event, event_pipe_callback_t callback); + +void event_pipe_emit(enum pipe_event event); + +/** + * Similar to event_pipe_emit(), but aimed for use in signal handlers: + * it doesn't lock the mutex, and doesn't log on error. That makes it + * potentially lossy, but for its intended use, that does not matter. + */ +void event_pipe_emit_fast(enum pipe_event event); + +#endif /* MAIN_NOTIFY_H */ diff --git a/src/Idle.cxx b/src/Idle.cxx index 4027461c2..0d42f7dd5 100644 --- a/src/Idle.cxx +++ b/src/Idle.cxx @@ -24,10 +24,7 @@ #include "config.h" #include "Idle.hxx" - -extern "C" { -#include "event_pipe.h" -} +#include "EventPipe.hxx" #include #include diff --git a/src/Main.cxx b/src/Main.cxx index c66943070..a158b5e2f 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -43,6 +43,7 @@ #include "Idle.hxx" #include "SignalHandlers.hxx" #include "Log.hxx" +#include "EventPipe.hxx" extern "C" { #include "daemon.h" @@ -55,7 +56,6 @@ extern "C" { #include "input_init.h" #include "playlist_list.h" #include "zeroconf.h" -#include "event_pipe.h" } #include "mpd_error.h" diff --git a/src/PlayerThread.cxx b/src/PlayerThread.cxx index bb6f52e02..14c8a03f2 100644 --- a/src/PlayerThread.cxx +++ b/src/PlayerThread.cxx @@ -32,10 +32,7 @@ #include "OutputAll.hxx" #include "tag.h" #include "Idle.hxx" - -extern "C" { -#include "event_pipe.h" -} +#include "EventPipe.hxx" #include diff --git a/src/PlaylistGlobal.cxx b/src/PlaylistGlobal.cxx index 1a5f11410..87f362a2e 100644 --- a/src/PlaylistGlobal.cxx +++ b/src/PlaylistGlobal.cxx @@ -27,10 +27,7 @@ #include "Playlist.hxx" #include "Main.hxx" #include "Partition.hxx" - -extern "C" { -#include "event_pipe.h" -} +#include "EventPipe.hxx" static void playlist_tag_event(void) diff --git a/src/SignalHandlers.cxx b/src/SignalHandlers.cxx index dfef9bf84..14da08c7b 100644 --- a/src/SignalHandlers.cxx +++ b/src/SignalHandlers.cxx @@ -24,7 +24,7 @@ #include "Log.hxx" #include "Main.hxx" -#include "event_pipe.h" +#include "EventPipe.hxx" #include "mpd_error.h" #include diff --git a/src/UpdateGlue.cxx b/src/UpdateGlue.cxx index 984535bef..fba4c1862 100644 --- a/src/UpdateGlue.cxx +++ b/src/UpdateGlue.cxx @@ -25,9 +25,9 @@ #include "Mapper.hxx" #include "DatabaseSimple.hxx" #include "Idle.hxx" +#include "EventPipe.hxx" extern "C" { -#include "event_pipe.h" #include "stats.h" } diff --git a/src/UpdateRemove.cxx b/src/UpdateRemove.cxx index 41aa51773..afa7c2931 100644 --- a/src/UpdateRemove.cxx +++ b/src/UpdateRemove.cxx @@ -21,10 +21,7 @@ #include "UpdateRemove.hxx" #include "Playlist.hxx" #include "Partition.hxx" - -extern "C" { -#include "event_pipe.h" -} +#include "EventPipe.hxx" #include "song.h" #include "Main.hxx" diff --git a/src/Volume.cxx b/src/Volume.cxx index a046aa942..6a71a6964 100644 --- a/src/Volume.cxx +++ b/src/Volume.cxx @@ -21,10 +21,7 @@ #include "Volume.hxx" #include "MixerAll.hxx" #include "Idle.hxx" - -extern "C" { -#include "event_pipe.h" -} +#include "EventPipe.hxx" #include diff --git a/src/Win32Main.cxx b/src/Win32Main.cxx index 8543ea108..710811f47 100644 --- a/src/Win32Main.cxx +++ b/src/Win32Main.cxx @@ -23,10 +23,7 @@ #ifdef WIN32 #include "mpd_error.h" - -extern "C" { -#include "event_pipe.h" -} +#include "EventPipe.hxx" #include diff --git a/src/event_pipe.h b/src/event_pipe.h deleted file mode 100644 index 7c136304f..000000000 --- a/src/event_pipe.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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 EVENT_PIPE_H -#define EVENT_PIPE_H - -enum pipe_event { - /** database update was finished */ - PIPE_EVENT_UPDATE, - - /** during database update, a song was deleted */ - PIPE_EVENT_DELETE, - - /** an idle event was emitted */ - PIPE_EVENT_IDLE, - - /** must call playlist_sync() */ - PIPE_EVENT_PLAYLIST, - - /** the current song's tag has changed */ - PIPE_EVENT_TAG, - - /** SIGHUP received: reload configuration, roll log file */ - PIPE_EVENT_RELOAD, - - /** a hardware mixer plugin has detected a change */ - PIPE_EVENT_MIXER, - - /** shutdown requested */ - PIPE_EVENT_SHUTDOWN, - - PIPE_EVENT_MAX -}; - -typedef void (*event_pipe_callback_t)(void); - -#ifdef __cplusplus -extern "C" { -#endif - -void event_pipe_init(void); - -void event_pipe_deinit(void); - -void -event_pipe_register(enum pipe_event event, event_pipe_callback_t callback); - -void event_pipe_emit(enum pipe_event event); - -/** - * Similar to event_pipe_emit(), but aimed for use in signal handlers: - * it doesn't lock the mutex, and doesn't log on error. That makes it - * potentially lossy, but for its intended use, that does not matter. - */ -void event_pipe_emit_fast(enum pipe_event event); - -#ifdef __cplusplus -} -#endif - -#endif /* MAIN_NOTIFY_H */ diff --git a/src/mixer/AlsaMixerPlugin.cxx b/src/mixer/AlsaMixerPlugin.cxx index 6623d12ec..f00bfcb9d 100644 --- a/src/mixer/AlsaMixerPlugin.cxx +++ b/src/mixer/AlsaMixerPlugin.cxx @@ -20,7 +20,7 @@ #include "config.h" #include "mixer_api.h" #include "output_api.h" -#include "event_pipe.h" +#include "EventPipe.hxx" #include #include diff --git a/src/mixer/PulseMixerPlugin.cxx b/src/mixer/PulseMixerPlugin.cxx index 509b91bc8..3b7937560 100644 --- a/src/mixer/PulseMixerPlugin.cxx +++ b/src/mixer/PulseMixerPlugin.cxx @@ -22,7 +22,7 @@ #include "mixer_api.h" #include "output/pulse_output_plugin.h" #include "conf.h" -#include "event_pipe.h" +#include "EventPipe.hxx" #include -- cgit v1.2.3