aboutsummaryrefslogtreecommitdiff
path: root/mpc/format.h
diff options
context:
space:
mode:
Diffstat (limited to 'mpc/format.h')
-rw-r--r--mpc/format.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/mpc/format.h b/mpc/format.h
new file mode 100644
index 0000000..e7aefeb
--- /dev/null
+++ b/mpc/format.h
@@ -0,0 +1,34 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+// Copyright The Music Player Daemon Project
+
+#ifndef MPC_FORMAT_H
+#define MPC_FORMAT_H
+
+#include "Compiler.h"
+
+struct mpd_song;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Pretty-print an object into a string using the given format
+ * specification.
+ *
+ * @param format the format string
+ * @param object the object
+ * @param getter a getter function that extracts a value from the object
+ * @return the resulting string to be freed by free(); NULL if
+ * no format string group produced any output
+ */
+gcc_malloc
+char *
+format_object(const char *format, const void *object,
+ const char *(*getter)(const void *object, const char *name));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif