aboutsummaryrefslogtreecommitdiffstats
path: root/src/db_plugin.h
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2011-09-10 18:48:10 +0200
committerMax Kellermann <max@duempel.org>2011-09-13 21:47:00 +0200
commita94d4be466ea3a48389361b483f72df45834f7d2 (patch)
tree734076ad49d963a00648f58dee4cde111dc0364a /src/db_plugin.h
parentb7d2d4cfe8b88174a7b1f41840ddc0b23dbd6a75 (diff)
downloadmpd-a94d4be466ea3a48389361b483f72df45834f7d2.tar.gz
mpd-a94d4be466ea3a48389361b483f72df45834f7d2.tar.xz
mpd-a94d4be466ea3a48389361b483f72df45834f7d2.zip
db_plugin: add method visit()
Diffstat (limited to '')
-rw-r--r--src/db_plugin.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/db_plugin.h b/src/db_plugin.h
index 5fec2529e..1c7e14ede 100644
--- a/src/db_plugin.h
+++ b/src/db_plugin.h
@@ -31,6 +31,8 @@
#include <stdbool.h>
struct config_param;
+struct db_selection;
+struct db_visitor;
struct db {
const struct db_plugin *plugin;
@@ -67,6 +69,13 @@ struct db_plugin {
*/
struct song *(*get_song)(struct db *db, const char *uri,
GError **error_r);
+
+ /**
+ * Visit the selected entities.
+ */
+ bool (*visit)(struct db *db, const struct db_selection *selection,
+ const struct db_visitor *visitor, void *ctx,
+ GError **error_r);
};
G_GNUC_MALLOC
@@ -78,6 +87,7 @@ db_plugin_new(const struct db_plugin *plugin, const struct config_param *param,
assert(plugin->init != NULL);
assert(plugin->finish != NULL);
assert(plugin->get_song != NULL);
+ assert(plugin->visit != NULL);
assert(error_r == NULL || *error_r == NULL);
struct db *db = plugin->init(param, error_r);
@@ -129,4 +139,18 @@ db_plugin_get_song(struct db *db, const char *uri, GError **error_r)
return db->plugin->get_song(db, uri, error_r);
}
+static inline bool
+db_plugin_visit(struct db *db, const struct db_selection *selection,
+ const struct db_visitor *visitor, void *ctx,
+ GError **error_r)
+{
+ assert(db != NULL);
+ assert(db->plugin != NULL);
+ assert(selection != NULL);
+ assert(visitor != NULL);
+ assert(error_r == NULL || *error_r == NULL);
+
+ return db->plugin->visit(db, selection, visitor, ctx, error_r);
+}
+
#endif