diff options
Diffstat (limited to 'src/database.h')
-rw-r--r-- | src/database.h | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/src/database.h b/src/database.h index 67149b20b..f877b74d3 100644 --- a/src/database.h +++ b/src/database.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2010 The Music Player Daemon Project + * Copyright (C) 2003-2011 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -20,62 +20,76 @@ #ifndef MPD_DATABASE_H #define MPD_DATABASE_H +#include "gcc.h" + #include <glib.h> #include <sys/time.h> #include <stdbool.h> +struct config_param; struct directory; +struct db_selection; +struct db_visitor; /** * Initialize the database library. * * @param path the absolute path of the database file */ -void -db_init(const char *path); +bool +db_init(const struct config_param *path, GError **error_r); void db_finish(void); /** - * Clear the database. - */ -void -db_clear(void); - -/** * Returns the root directory object. Returns NULL if there is no * configured music directory. */ +G_GNUC_PURE struct directory * db_get_root(void); +/** + * Caller must lock the #db_mutex. + */ +gcc_nonnull(1) +G_GNUC_PURE struct directory * db_get_directory(const char *name); +gcc_nonnull(1) +G_GNUC_PURE struct song * db_get_song(const char *file); -int db_walk(const char *name, - int (*forEachSong)(struct song *, void *), - int (*forEachDir)(struct directory *, void *), void *data); +gcc_nonnull(1,2) +bool +db_visit(const struct db_selection *selection, + const struct db_visitor *visitor, void *ctx, + GError **error_r); +gcc_nonnull(1,2) bool -db_check(void); +db_walk(const char *uri, + const struct db_visitor *visitor, void *ctx, + GError **error_r); bool -db_save(void); +db_save(GError **error_r); bool db_load(GError **error); +G_GNUC_PURE time_t db_get_mtime(void); /** * Returns true if there is a valid database file on the disk. */ +G_GNUC_PURE static inline bool db_exists(void) { |