MPD: db/update/Remove.hxx Source File

MPD 0.20.18

Remove.hxx
Go to the documentation of this file.
1 /*
2 * Copyright 2003-2017 The Music Player Daemon Project
3 * http://www.musicpd.org
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #ifndef MPD_UPDATE_REMOVE_HXX
21 #define MPD_UPDATE_REMOVE_HXX
22
23 #include "check.h"
24 #include "event/DeferredMonitor.hxx"
25 #include "thread/Mutex.hxx"
26 #include "Compiler.h"
27
28 #include <forward_list>
29 #include <string>
30
31 struct Song;
32 class DatabaseListener;
33
38 class UpdateRemoveService final : DeferredMonitor {
39 DatabaseListener &listener;
40
41 Mutex mutex;
42
43 std::forward_list<std::string> uris;
44
45 public:
46 UpdateRemoveService(EventLoop &_loop, DatabaseListener &_listener)
47 :DeferredMonitor(_loop), listener(_listener) {}
48
55 void Remove(std::string &&uri);
56
57 private:
58 /* virtual methods from class DeferredMonitor */
59 virtual void RunDeferred() override;
60 };
61
62 #endif
check.h
EventLoop
An event loop that polls for events on file/socket descriptors.
Definition: Loop.hxx:52
Mutex
Definition: Mutex.hxx:43
DatabaseListener
An object that listens to events from the Database.
Definition: DatabaseListener.hxx:30
DeferredMonitor
Defer execution of an event into an EventLoop.
Definition: DeferredMonitor.hxx:32
Song
A song file inside the configured music directory.
Definition: Song.hxx:44
Compiler.h
Mutex.hxx
UpdateRemoveService::Remove
void Remove(std::string &&uri)
Sends a signal to the main thread which will in turn remove the song: from the sticker database and f...
DeferredMonitor.hxx
UpdateRemoveService
This class handles Song removal.
Definition: Remove.hxx:38
UpdateRemoveService::UpdateRemoveService
UpdateRemoveService(EventLoop &_loop, DatabaseListener &_listener)
Definition: Remove.hxx:46
uri
const Storage const char * uri
Definition: DatabasePlaylist.hxx:31