aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-01-11 01:01:54 +0100
committerMax Kellermann <max@duempel.org>2014-01-11 01:01:54 +0100
commit114df1f137d5a32cdde64d43712fb602c2f93ebb (patch)
treeb0f1b51cfed7ef50b1e98a241dcfd8d8c17a2791 /test
parent00adf7ff173afbe7fe13734a27d6ee19096ce640 (diff)
downloadmpd-114df1f137d5a32cdde64d43712fb602c2f93ebb.tar.gz
mpd-114df1f137d5a32cdde64d43712fb602c2f93ebb.tar.xz
mpd-114df1f137d5a32cdde64d43712fb602c2f93ebb.zip
DatabasePlugin: add interface DatabaseListener
Allow database plugins to announce that they have been modified.
Diffstat (limited to 'test')
-rw-r--r--test/DumpDatabase.cxx15
1 files changed, 14 insertions, 1 deletions
diff --git a/test/DumpDatabase.cxx b/test/DumpDatabase.cxx
index 52f7fbd02..ff3464099 100644
--- a/test/DumpDatabase.cxx
+++ b/test/DumpDatabase.cxx
@@ -21,6 +21,7 @@
#include "DatabaseRegistry.hxx"
#include "DatabasePlugin.hxx"
#include "DatabaseSelection.hxx"
+#include "DatabaseListener.hxx"
#include "Directory.hxx"
#include "Song.hxx"
#include "PlaylistVector.hxx"
@@ -28,6 +29,7 @@
#include "ConfigData.hxx"
#include "tag/TagConfig.hxx"
#include "fs/Path.hxx"
+#include "event/Loop.hxx"
#include "util/Error.hxx"
#include <glib.h>
@@ -48,6 +50,13 @@ InputStream::LockRead(void *, size_t, Error &)
}
#endif
+class MyDatabaseListener final : public DatabaseListener {
+public:
+ virtual void OnDatabaseModified() override {
+ cout << "DatabaseModified" << endl;
+ }
+};
+
static bool
DumpDirectory(const Directory &directory, Error &)
{
@@ -108,6 +117,9 @@ main(int argc, char **argv)
TagLoadConfig();
+ EventLoop event_loop;
+ MyDatabaseListener database_listener;
+
/* do it */
const struct config_param *path = config_get_param(CONF_DB_FILE);
@@ -115,7 +127,8 @@ main(int argc, char **argv)
if (path != nullptr)
param.AddBlockParam("path", path->value.c_str(), path->line);
- Database *db = plugin->create(param, error);
+ Database *db = plugin->create(event_loop, database_listener,
+ param, error);
if (db == nullptr) {
cerr << error.GetMessage() << endl;