comparison src/audacious/tuple.h @ 3489:9580bb3e58fa trunk

Tuple handling API changed to include support for "hardcoded" fields.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 01 Sep 2007 07:08:21 +0300
parents 86dafe2300f7
children 6f34cc4217b9
comparison
equal deleted inserted replaced
3415:abfa5f49ff07 3489:9580bb3e58fa
22 #define __AUDACIOUS_TUPLE_H__ 22 #define __AUDACIOUS_TUPLE_H__
23 23
24 #include <glib.h> 24 #include <glib.h>
25 #include <mowgli.h> 25 #include <mowgli.h>
26 26
27 typedef struct _Tuple {
28 mowgli_object_t parent;
29 mowgli_dictionary_t *dict;
30 } Tuple;
31 27
28 enum {
29 FIELD_ARTIST = 0,
30 FIELD_TITLE,
31 FIELD_ALBUM,
32 FIELD_COMMENT,
33 FIELD_GENRE,
34
35 FIELD_TRACK,
36 FIELD_TRACK_NUMBER,
37 FIELD_LENGTH,
38 FIELD_YEAR,
39 FIELD_QUALITY,
40
41 FIELD_CODEC,
42 FIELD_FILE_NAME,
43 FIELD_FILE_PATH,
44 FIELD_FILE_EXT,
45 FIELD_SONG_ARTIST,
46
47 FIELD_MTIME,
48 FIELD_FORMATTER,
49 FIELD_PERFORMER,
50 FIELD_COPYRIGHT,
51
52 /* special field, must always be last */
53 FIELD_LAST
54 };
55
56 extern const gchar *tuple_fields[FIELD_LAST];
32 57
33 typedef enum { 58 typedef enum {
34 TUPLE_STRING, 59 TUPLE_STRING,
35 TUPLE_INT, 60 TUPLE_INT,
36 TUPLE_UNKNOWN 61 TUPLE_UNKNOWN
42 gchar *string; 67 gchar *string;
43 gint integer; 68 gint integer;
44 } value; 69 } value;
45 } TupleValue; 70 } TupleValue;
46 71
72 typedef struct _Tuple {
73 mowgli_object_t parent;
74 mowgli_dictionary_t *dict;
75 TupleValue *values[FIELD_LAST];
76 } Tuple;
77
78
47 Tuple *tuple_new(void); 79 Tuple *tuple_new(void);
48 Tuple *tuple_new_from_filename(const gchar *filename); 80 Tuple *tuple_new_from_filename(const gchar *filename);
49 gboolean tuple_associate_string(Tuple *tuple, const gchar *field, const gchar *string); 81 gboolean tuple_associate_string(Tuple *tuple, const gint nfield, const gchar *field, const gchar *string);
50 gboolean tuple_associate_int(Tuple *tuple, const gchar *field, gint integer); 82 gboolean tuple_associate_int(Tuple *tuple, const gint nfield, const gchar *field, gint integer);
51 void tuple_disassociate(Tuple *tuple, const gchar *field); 83 void tuple_disassociate(Tuple *tuple, const gint nfield, const gchar *field);
52 void tuple_disassociate_now(TupleValue *value); 84 void tuple_disassociate_now(TupleValue *value);
53 TupleValueType tuple_get_value_type(Tuple *tuple, const gchar *field); 85 TupleValueType tuple_get_value_type(Tuple *tuple, const gint nfield, const gchar *field);
54 const gchar *tuple_get_string(Tuple *tuple, const gchar *field); 86 const gchar *tuple_get_string(Tuple *tuple, const gint nfield, const gchar *field);
55 int tuple_get_int(Tuple *tuple, const gchar *field); 87 gint tuple_get_int(Tuple *tuple, const gint nfield, const gchar *field);
56 #define tuple_free(x) mowgli_object_unref(x); 88 #define tuple_free(x) mowgli_object_unref(x);
57 89
58 #endif 90 #endif