summaryrefslogtreecommitdiff
path: root/mpc/format.h
blob: e7aefeb12cf1ca5428da6cefd3d63e9f358e0fdd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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