1 /* 2 * Database record interface for DPAP 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 __DPAP_RECORD_H 22 #define __DPAP_RECORD_H 23 24 #include <glib.h> 25 #include <gio/gio.h> 26 27 #include <libdmapsharing/dmap-record.h> 28 29 G_BEGIN_DECLS 30 /** 31 * DPAP_TYPE_RECORD: 32 * 33 * The type for #DPAPRecord. 34 */ 35 #define DPAP_TYPE_RECORD (dpap_record_get_type ()) 36 /** 37 * DPAP_RECORD: 38 * @o: Object which is subject to casting. 39 * 40 * Casts a #DPAPRecord or derived pointer into a (DPAPRecord *) pointer. 41 * Depending on the current debugging level, this function may invoke 42 * certain runtime checks to identify invalid casts. 43 */ 44 #define DPAP_RECORD(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), \ 45 DPAP_TYPE_RECORD, DPAPRecord)) 46 /** 47 * IS_DPAP_RECORD: 48 * @o: Instance to check for being a %DPAP_TYPE_RECORD. 49 * 50 * Checks whether a valid #GTypeInstance pointer is of type %DPAP_TYPE_RECORD. 51 */ 52 #define IS_DPAP_RECORD(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), \ 53 DPAP_TYPE_RECORD)) 54 /** 55 * DPAP_RECORD_GET_INTERFACE: 56 * @o: a #DPAPRecord instance. 57 * 58 * Get the class structure associated to a #DPAPRecord instance. 59 * 60 * Returns: pointer to object interface structure. 61 */ 62 #define DPAP_RECORD_GET_INTERFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), \ 63 DPAP_TYPE_RECORD, DPAPRecordIface)) 64 typedef struct _DPAPRecord DPAPRecord; 65 typedef struct _DPAPRecordIface DPAPRecordIface; 66 67 struct _DPAPRecordIface 68 { 69 GTypeInterface parent; 70 71 GInputStream *(*read) (DPAPRecord * record, GError ** err); 72 }; 73 74 GType dpap_record_get_type (void); 75 76 /** 77 * dpap_record_read: 78 * @record: a DPAPRecord. 79 * @err: a GError. 80 * 81 * Returns: A GInputStream that provides read-only access to the data stream 82 * associated with record. 83 */ 84 GInputStream *dpap_record_read (DPAPRecord * record, GError ** err); 85 86 #endif /* __DPAP_RECORD_H */ 87 88 G_END_DECLS 89