dbus-gtype-specialized.h

00001 /* -*- mode: C; c-file-style: "gnu" -*- */
00002 /* dbus-gtype-specialized.h: Non-DBus-specific functions for specialized GTypes
00003  *
00004  * Copyright (C) 2005 Red Hat, Inc.
00005  *
00006  * Licensed under the Academic Free License version 2.1
00007  * 
00008  * This program is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  * 
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021  *
00022  */
00023 
00024 #ifndef DBUS_GOBJECT_TYPE_SPECIALIZED_H
00025 #define DBUS_GOBJECT_TYPE_SPECIALIZED_H
00026 
00027 #include <glib.h>
00028 #include <glib-object.h>
00029 
00030 G_BEGIN_DECLS
00031 
00032 GType          dbus_g_type_get_collection                   (const char *container,
00033                                                              GType       specialization);
00034 GType          dbus_g_type_get_map                          (const char *container,
00035                                                              GType       key_specialization,
00036                                                              GType       value_specialization);
00037 gboolean       dbus_g_type_is_collection                    (GType       gtype);
00038 gboolean       dbus_g_type_is_map                           (GType       gtype);
00039 GType          dbus_g_type_get_collection_specialization    (GType       gtype);
00040 GType          dbus_g_type_get_map_key_specialization       (GType       gtype);
00041 GType          dbus_g_type_get_map_value_specialization     (GType       gtype);
00042 
00043 typedef void   (*DBusGTypeSpecializedCollectionIterator)    (const GValue *val,
00044                                                              gpointer      user_data);
00045 typedef void   (*DBusGTypeSpecializedMapIterator)           (const GValue *key_val,
00046                                                              const GValue *value_val,
00047                                                              gpointer      user_data);
00048 
00049 gpointer       dbus_g_type_specialized_construct            (GType type);
00050 
00051 typedef struct {
00052   /* public */
00053   GValue *val;
00054   GType specialization_type;
00055   /* padding */
00056   gpointer b;
00057   guint c;
00058   gpointer d;
00059 } DBusGTypeSpecializedAppendContext;
00060 
00061 void           dbus_g_type_specialized_init_append             (GValue *val, DBusGTypeSpecializedAppendContext *ctx);
00062 
00063 void           dbus_g_type_specialized_collection_append       (DBusGTypeSpecializedAppendContext *ctx, GValue *elt);
00064 
00065 void           dbus_g_type_specialized_collection_end_append   (DBusGTypeSpecializedAppendContext *ctx);
00066 
00067 void           dbus_g_type_specialized_map_append              (DBusGTypeSpecializedAppendContext *ctx,
00068                                                                 GValue                            *key,
00069                                                                 GValue                            *val);
00070                                                                 
00071 
00072 gboolean       dbus_g_type_collection_get_fixed             (GValue                                 *value,
00073                                                              gpointer                               *data,
00074                                                              guint                                  *len);
00075 
00076 void           dbus_g_type_collection_value_iterate         (const GValue                           *value,
00077                                                              DBusGTypeSpecializedCollectionIterator  iterator,
00078                                                              gpointer                                user_data);
00079 
00080 void           dbus_g_type_map_value_iterate                (const GValue                           *value,
00081                                                              DBusGTypeSpecializedMapIterator         iterator,
00082                                                              gpointer                                user_data);
00083 
00084 typedef gpointer (*DBusGTypeSpecializedConstructor)     (GType type);
00085 typedef void     (*DBusGTypeSpecializedFreeFunc)        (GType type, gpointer val);
00086 typedef gpointer (*DBusGTypeSpecializedCopyFunc)        (GType type, gpointer src);
00087 
00088 typedef struct {
00089   DBusGTypeSpecializedConstructor    constructor;
00090   DBusGTypeSpecializedFreeFunc       free_func;
00091   DBusGTypeSpecializedCopyFunc       copy_func;
00092   gpointer                           padding1;
00093   gpointer                           padding2;
00094   gpointer                           padding3;
00095 } DBusGTypeSpecializedVtable;
00096 
00097 typedef gboolean (*DBusGTypeSpecializedCollectionFixedAccessorFunc) (GType type, gpointer instance, gpointer *values, guint *len);
00098 typedef void     (*DBusGTypeSpecializedCollectionIteratorFunc)      (GType type, gpointer instance, DBusGTypeSpecializedCollectionIterator iterator, gpointer user_data);
00099 typedef void     (*DBusGTypeSpecializedCollectionAppendFunc)        (DBusGTypeSpecializedAppendContext *ctx, GValue *val);
00100 typedef void     (*DBusGTypeSpecializedCollectionEndAppendFunc)     (DBusGTypeSpecializedAppendContext *ctx);
00101 
00102 typedef struct {
00103   DBusGTypeSpecializedVtable                        base_vtable;
00104   DBusGTypeSpecializedCollectionFixedAccessorFunc   fixed_accessor;
00105   DBusGTypeSpecializedCollectionIteratorFunc        iterator;
00106   DBusGTypeSpecializedCollectionAppendFunc          append_func;
00107   DBusGTypeSpecializedCollectionEndAppendFunc       end_append_func;
00108 } DBusGTypeSpecializedCollectionVtable;
00109 
00110 typedef void (*DBusGTypeSpecializedMapIteratorFunc) (GType type, gpointer instance, DBusGTypeSpecializedMapIterator iterator, gpointer user_data);
00111 typedef void (*DBusGTypeSpecializedMapAppendFunc)   (DBusGTypeSpecializedAppendContext *ctx, GValue *key, GValue *val);
00112 
00113 typedef struct {
00114   DBusGTypeSpecializedVtable                        base_vtable;
00115   DBusGTypeSpecializedMapIteratorFunc               iterator;
00116   DBusGTypeSpecializedMapAppendFunc                 append_func;
00117 } DBusGTypeSpecializedMapVtable;
00118 
00119 void           dbus_g_type_specialized_init           (void);
00120 
00121 void           dbus_g_type_register_collection        (const char                                   *name,
00122                                                        const DBusGTypeSpecializedCollectionVtable   *vtable,
00123                                                        guint                                         flags);
00124   
00125 void           dbus_g_type_register_map               (const char                                   *name,
00126                                                        const DBusGTypeSpecializedMapVtable          *vtable,
00127                                                        guint                                         flags);
00128 
00129 G_END_DECLS
00130 
00131 #endif

Generated on Tue Jul 7 15:13:58 2009 for D-BUS by  doxygen 1.4.6