Handle streams separately in tree_add_track()
[cmus.git] / format_print.h
blobb2ec560d64d3289bfe4e815d529b9f775e5725f6
1 #ifndef _FORMAT_PRINT_H
2 #define _FORMAT_PRINT_H
4 struct format_option {
5 union {
6 /* NULL is treated like "" */
7 const char *fo_str;
8 int fo_int;
9 /* [h:]mm:ss. can be negative */
10 int fo_time;
12 /* set to 1 if you want to disable printing */
13 unsigned int empty : 1;
14 enum { FO_STR, FO_INT, FO_TIME } type;
15 char ch;
18 #define DEF_FO_STR(ch) { { .fo_str = NULL }, 0, FO_STR, ch }
19 #define DEF_FO_INT(ch) { { .fo_int = 0 }, 0, FO_INT, ch }
20 #define DEF_FO_TIME(ch) { { .fo_time = 0 }, 0, FO_TIME, ch }
21 #define DEF_FO_END { { .fo_str = NULL }, 0, 0, 0 }
23 int format_print(char *str, int width, const char *format, const struct format_option *fopts);
24 int format_valid(const char *format);
26 #endif