aboutsummaryrefslogtreecommitdiffstats
path: root/src/sticker.h
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-03-14 14:20:01 +0100
committerMax Kellermann <max@duempel.org>2009-03-14 14:20:01 +0100
commitdd67992a0c403ff23b071fe9b1e312cfaa4bd924 (patch)
tree7f5d03f53e48dc63ff6c0bea369dd249c6b6bcea /src/sticker.h
parent5b687795c499e9fef4eeed234552f1171a845a95 (diff)
downloadmpd-dd67992a0c403ff23b071fe9b1e312cfaa4bd924.tar.gz
mpd-dd67992a0c403ff23b071fe9b1e312cfaa4bd924.tar.xz
mpd-dd67992a0c403ff23b071fe9b1e312cfaa4bd924.zip
sticker: added "struct sticker"
The sticker struct can be used for enumerating values. This will replace the sticker_list_values() function.
Diffstat (limited to 'src/sticker.h')
-rw-r--r--src/sticker.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/sticker.h b/src/sticker.h
index 5e9ba55f7..9ca740d45 100644
--- a/src/sticker.h
+++ b/src/sticker.h
@@ -46,6 +46,8 @@
#include <stdbool.h>
+struct sticker;
+
/**
* Opens the sticker database (if path is not NULL).
*/
@@ -94,4 +96,45 @@ sticker_store_value(const char *type, const char *uri,
bool
sticker_delete(const char *type, const char *uri);
+/**
+ * Frees resources held by the sticker object.
+ *
+ * @param sticker the sticker object to be freed
+ */
+void
+sticker_free(struct sticker *sticker);
+
+/**
+ * Determines a single value in a sticker.
+ *
+ * @param sticker the sticker object
+ * @param name the name of the sticker
+ * @return the sticker value, or NULL if none was found
+ */
+const char *
+sticker_get_value(struct sticker *sticker, const char *name);
+
+/**
+ * Iterates over all sticker items in a sticker.
+ *
+ * @param sticker the sticker object
+ * @param func a callback function
+ * @param user_data an opaque pointer for the callback function
+ */
+void
+sticker_foreach(struct sticker *sticker,
+ void (*func)(const char *name, const char *value,
+ gpointer user_data),
+ gpointer user_data);
+
+/**
+ * Loads the sticker for the specified resource.
+ *
+ * @param type the resource type, e.g. "song"
+ * @param uri the URI of the resource, e.g. the song path
+ * @return a sticker object, or NULL on error or if there is no sticker
+ */
+struct sticker *
+sticker_load(const char *type, const char *uri);
+
#endif