1 /* gom-adapter.h 2 * 3 * Copyright (C) 2011 Christian Hergert <chris@dronelabs.com> 4 * 5 * This file is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Lesser General Public 7 * License as published by the Free Software Foundation; either 8 * version 2.1 of the License, or (at your option) any later version. 9 * 10 * This file is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 */ 18 19 #ifndef GOM_ADAPTER_H 20 #define GOM_ADAPTER_H 21 22 #include <gio/gio.h> 23 24 G_BEGIN_DECLS 25 26 #define GOM_TYPE_ADAPTER (gom_adapter_get_type()) 27 #define GOM_ADAPTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GOM_TYPE_ADAPTER, GomAdapter)) 28 #define GOM_ADAPTER_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GOM_TYPE_ADAPTER, GomAdapter const)) 29 #define GOM_ADAPTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GOM_TYPE_ADAPTER, GomAdapterClass)) 30 #define GOM_IS_ADAPTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GOM_TYPE_ADAPTER)) 31 #define GOM_IS_ADAPTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GOM_TYPE_ADAPTER)) 32 #define GOM_ADAPTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GOM_TYPE_ADAPTER, GomAdapterClass)) 33 34 typedef struct _GomAdapter GomAdapter; 35 typedef struct _GomAdapterClass GomAdapterClass; 36 typedef struct _GomAdapterPrivate GomAdapterPrivate; 37 38 typedef void (*GomAdapterCallback) (GomAdapter *adapter, 39 gpointer user_data); 40 41 struct _GomAdapter 42 { 43 GObject parent; 44 45 /*< private >*/ 46 GomAdapterPrivate *priv; 47 }; 48 49 struct _GomAdapterClass 50 { 51 GObjectClass parent_class; 52 }; 53 54 gboolean gom_adapter_close_sync (GomAdapter *adapter, 55 GError **error); 56 void gom_adapter_close_async (GomAdapter *adapter, 57 GAsyncReadyCallback callback, 58 gpointer user_data); 59 gboolean gom_adapter_close_finish (GomAdapter *adapter, 60 GAsyncResult *result, 61 GError **error); 62 gpointer gom_adapter_get_handle (GomAdapter *adapter); 63 GType gom_adapter_get_type (void) G_GNUC_CONST; 64 GomAdapter *gom_adapter_new (void); 65 gboolean gom_adapter_open_sync (GomAdapter *adapter, 66 const gchar *uri, 67 GError **error); 68 void gom_adapter_open_async (GomAdapter *adapter, 69 const gchar *uri, 70 GAsyncReadyCallback callback, 71 gpointer user_data); 72 gboolean gom_adapter_open_finish (GomAdapter *adapter, 73 GAsyncResult *result, 74 GError **error); 75 void gom_adapter_queue_read (GomAdapter *adapter, 76 GomAdapterCallback callback, 77 gpointer user_data); 78 void gom_adapter_queue_write (GomAdapter *adapter, 79 GomAdapterCallback callback, 80 gpointer user_data); 81 gboolean gom_adapter_execute_sql (GomAdapter *adapter, 82 const gchar *sql, 83 GError **error); 84 85 G_END_DECLS 86 87 #endif /* GOM_ADAPTER_H */ 88