Cleanup.
[jamendo] / src / data_structs.h
1 /*
2  * data_structs.h
3  *
4  *  Created on: 2009-10-05
5  *      Author: marcin
6  */
7
8 #ifndef DATA_STRUCTS_H_
9 #define DATA_STRUCTS_H_
10
11 #include <glib.h>
12 #include <libxml/tree.h>
13
14 extern int G_TYPE_ALBUM;
15 extern int G_TYPE_RADIO;
16
17 void data_structs_type_register();
18
19 /*
20  * unit Album
21  */
22 typedef struct _Album {
23         /**
24          * numeric id of the album
25          */
26         gint id;
27
28         /**
29          * link to the cover of the album
30          */
31         gchar* image;
32
33         /**
34          * name of the album
35          */
36         gchar* name;
37
38         /**
39          * Rating of the album
40          */
41         gdouble rating;
42
43         /**
44          * Display name of the artist.
45          */
46         gchar* artist_name;
47 } Album;
48
49 Album* album_new();
50
51 Album* album_new_from_xml(xmlNode* album_node);
52
53 Album* album_copy(Album* album);
54
55 void album_set_id(Album* album, const gint id);
56
57 void album_set_image(Album* album, const gchar* image);
58
59 gchar* album_get_image(Album* album, gint size);
60
61 void album_set_name(Album* album, const gchar* name);
62
63 void album_set_rating(Album* album, const gdouble rating);
64
65 void album_set_artist_name(Album* album, const gchar* artist_name);
66
67 void album_free(Album* album);
68
69 void album_dump(Album* album);
70
71 void album_list_free(GList* album_list);
72
73 /*
74  * unit Track
75  */
76
77 typedef struct _Track {
78         gint id;
79         gchar* name;
80         gint duration;
81         gchar* stream;
82         gdouble rating;
83         gint artist_id;
84         gchar* artist_name;
85         gint album_id;
86         gchar* album_name;
87 } Track;
88
89 Track* track_new();
90
91 Track* track_new_from_xml(xmlNode* track_node);
92
93 void track_free(Track* track);
94
95 void track_set_id(Track* track, const gint id);
96
97 void track_set_name(Track* track, const gchar* name);
98
99 void track_set_duration(Track* track, const gint duration);
100
101 void track_set_stream(Track* track, const gchar* stream);
102
103 void track_set_rating(Track* track, const gdouble rating);
104
105 void track_set_artist_id(Track* track, const gint artist_id);
106
107 void track_set_artist_name(Track* track, const gchar* artist_name);
108
109 void track_set_album_id(Track* track, const gint album_id);
110
111 void track_set_album_name(Track* track, const gchar* album_name);
112
113 void track_list_free(GList* track_list);
114
115 /*
116  * unit Radio
117  */
118 typedef struct _Radio {
119         gint id;
120         gchar* name;
121         gchar* image;
122 } Radio;
123
124 Radio* radio_new();
125
126 Radio* radio_copy(Radio* radio);
127
128 Radio* radio_new_from_xml(xmlNode* radio_node);
129
130 void radio_free(Radio* radio);
131
132 void radio_set_id(Radio* radio, const gint id);
133
134 void radio_set_name(Radio* radio, const gchar* name);
135
136 void radio_set_image(Radio* radio, const gchar* image);
137
138 void radio_list_free(GList* radio_list);
139
140 #endif /* DATA_STRUCTS_H_ */