1 /* 2 * Database record interface for DAAP sharing 3 * 4 * Copyright (C) 2008 W. Michael Petullo <mike@flyn.org> 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 2.1 of the License, or (at your option) any later version. 10 * 11 * This library is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with this library; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 */ 20 21 #ifndef __DAAP_RECORD_H 22 #define __DAAP_RECORD_H 23 24 #include <glib.h> 25 #include <gio/gio.h> 26 27 #include <libdmapsharing/dmap-record.h> 28 #include <libdmapsharing/dmap-db.h> 29 30 G_BEGIN_DECLS 31 /** 32 * DAAP_TYPE_RECORD: 33 * 34 * The type for #DAAPRecord. 35 */ 36 #define DAAP_TYPE_RECORD (daap_record_get_type ()) 37 /** 38 * DAAP_RECORD: 39 * @o: Object which is subject to casting. 40 * 41 * Casts a #DAAPRecord or derived pointer into a (DAAPRecord *) pointer. 42 * Depending on the current debugging level, this function may invoke 43 * certain runtime checks to identify invalid casts. 44 */ 45 #define DAAP_RECORD(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), \ 46 DAAP_TYPE_RECORD, DAAPRecord)) 47 /** 48 * IS_DAAP_RECORD: 49 * @o: Instance to check for being a %DAAP_TYPE_RECORD. 50 * 51 * Checks whether a valid #GTypeInstance pointer is of type %DAAP_TYPE_RECORD. 52 */ 53 #define IS_DAAP_RECORD(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), \ 54 DAAP_TYPE_RECORD)) 55 /** 56 * DAAP_RECORD_GET_INTERFACE: 57 * @o: a #DAAPRecord instance. 58 * 59 * Get the class structure associated to a #DAAPRecord instance. 60 * 61 * Returns: pointer to object interface structure. 62 */ 63 #define DAAP_RECORD_GET_INTERFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), \ 64 DAAP_TYPE_RECORD, DAAPRecordIface)) 65 typedef struct _DAAPRecord DAAPRecord; 66 typedef struct _DAAPRecordIface DAAPRecordIface; 67 68 struct _DAAPRecordIface 69 { 70 GTypeInterface parent; 71 72 gboolean (*itunes_compat) (DAAPRecord * record); 73 GInputStream *(*read) (DAAPRecord * record, GError ** err); 74 }; 75 76 GType daap_record_get_type (void); 77 78 /** 79 * daap_record_itunes_compat: 80 * @record: A DAAPRecord. 81 * 82 * Returns: TRUE if record is compatible with iTunes, else FALSE. 83 */ 84 gboolean daap_record_itunes_compat (DAAPRecord * record); 85 86 /** 87 * daap_record_read: 88 * @record: a DAAPRecord. 89 * @err: a GError. 90 * 91 * Returns: A GInputStream that provides read-only access to the data stream 92 * associated with record. 93 */ 94 GInputStream *daap_record_read (DAAPRecord * record, GError ** err); 95 96 /** 97 * daap_record_cmp_by_album: 98 * @a: first ID. 99 * @b: second ID. 100 * @db: A DMAPDb for which a and b are valid ID's. 101 * 102 * Compares the two records associated with the provided keys according 103 * to album. Suitable to sort lists of albums. 104 */ 105 gint daap_record_cmp_by_album (gpointer a, gpointer b, DMAPDb * db); 106 107 #endif /* __DAAP_RECORD_H */ 108 109 G_END_DECLS 110