aboutsummaryrefslogtreecommitdiffstats
path: root/src/db/update/Editor.hxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-01-29 20:16:43 +0100
committerMax Kellermann <max@duempel.org>2014-01-30 18:47:05 +0100
commitc6725884bc155da431889468c86c546f0f64f9a1 (patch)
tree61d89751ecc98db9600620ac1788f32dea9214e1 /src/db/update/Editor.hxx
parenta31738f6f1473f4f621bc16513ed0c6024749389 (diff)
downloadmpd-c6725884bc155da431889468c86c546f0f64f9a1.tar.gz
mpd-c6725884bc155da431889468c86c546f0f64f9a1.tar.xz
mpd-c6725884bc155da431889468c86c546f0f64f9a1.zip
db/update: convert to OO API
Move global variables into the new classes. That may allow multiple update threads for multiple databases one day.
Diffstat (limited to '')
-rw-r--r--src/db/update/Editor.hxx (renamed from src/db/update/UpdateDatabase.hxx)48
1 files changed, 29 insertions, 19 deletions
diff --git a/src/db/update/UpdateDatabase.hxx b/src/db/update/Editor.hxx
index bd7c395f2..a9093d662 100644
--- a/src/db/update/UpdateDatabase.hxx
+++ b/src/db/update/Editor.hxx
@@ -21,30 +21,40 @@
#define MPD_UPDATE_DATABASE_HXX
#include "check.h"
+#include "Remove.hxx"
struct Directory;
struct Song;
+class UpdateRemoveService;
-/**
- * Caller must lock the #db_mutex.
- */
-void
-delete_song(Directory &parent, Song *song);
+class DatabaseEditor final {
+ UpdateRemoveService remove;
-/**
- * Recursively free a directory and all its contents.
- *
- * Caller must lock the #db_mutex.
- */
-void
-delete_directory(Directory *directory);
+public:
+ DatabaseEditor(EventLoop &_loop)
+ :remove(_loop) {}
-/**
- * Caller must NOT lock the #db_mutex.
- *
- * @return true if the database was modified
- */
-bool
-delete_name_in(Directory &parent, const char *name);
+ /**
+ * Caller must lock the #db_mutex.
+ */
+ void DeleteSong(Directory &parent, Song *song);
+
+ /**
+ * Recursively free a directory and all its contents.
+ *
+ * Caller must lock the #db_mutex.
+ */
+ void DeleteDirectory(Directory *directory);
+
+ /**
+ * Caller must NOT lock the #db_mutex.
+ *
+ * @return true if the database was modified
+ */
+ bool DeleteNameIn(Directory &parent, const char *name);
+
+private:
+ void ClearDirectory(Directory &directory);
+};
#endif