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 GType          dbus_g_type_get_structv                      (const char *container,
00038                                                              guint       num_members,
00039                                                              GType      *types);
00040 GType          dbus_g_type_get_struct                       (const char *container,
00041                                                              GType       first_type,
00042                                                              ...);
00043 gboolean       dbus_g_type_is_collection                    (GType       gtype);
00044 gboolean       dbus_g_type_is_map                           (GType       gtype);
00045 gboolean       dbus_g_type_is_struct                        (GType       gtype);
00046 GType          dbus_g_type_get_collection_specialization    (GType       gtype);
00047 GType          dbus_g_type_get_map_key_specialization       (GType       gtype);
00048 GType          dbus_g_type_get_map_value_specialization     (GType       gtype);
00049 GType          dbus_g_type_get_struct_member_type           (GType       gtype,
00050                                                              guint       member);
00051 guint          dbus_g_type_get_struct_size                  (GType       gtype);
00052 
00053 typedef void   (*DBusGTypeSpecializedCollectionIterator)    (const GValue *value,
00054                                                              gpointer      user_data);
00055 typedef void   (*DBusGTypeSpecializedMapIterator)           (const GValue *key_val,
00056                                                              const GValue *value_val,
00057                                                              gpointer      user_data);
00058 
00059 gpointer       dbus_g_type_specialized_construct            (GType gtype);
00060 
00061 typedef struct {
00062   /* public */
00063   GValue *val;
00064   GType specialization_type;
00065   /* padding */
00066   gpointer b;
00067   guint c;
00068   gpointer d;
00069 } DBusGTypeSpecializedAppendContext;
00070 
00071 void           dbus_g_type_specialized_init_append             (GValue *value, DBusGTypeSpecializedAppendContext *ctx);
00072 
00073 void           dbus_g_type_specialized_collection_append       (DBusGTypeSpecializedAppendContext *ctx, GValue *elt);
00074 
00075 void           dbus_g_type_specialized_collection_end_append   (DBusGTypeSpecializedAppendContext *ctx);
00076 
00077 void           dbus_g_type_specialized_map_append              (DBusGTypeSpecializedAppendContext *ctx,
00078                                                                 GValue                            *key,
00079                                                                 GValue                            *val);
00080                                                                 
00081 
00082 gboolean       dbus_g_type_collection_get_fixed             (GValue                                 *value,
00083                                                              gpointer                               *data,
00084                                                              guint                                  *len);
00085 
00086 void           dbus_g_type_collection_value_iterate         (const GValue                           *value,
00087                                                              DBusGTypeSpecializedCollectionIterator  iterator,
00088                                                              gpointer                                user_data);
00089 
00090 void           dbus_g_type_map_value_iterate                (const GValue                           *value,
00091                                                              DBusGTypeSpecializedMapIterator         iterator,
00092                                                              gpointer                                user_data);
00093 
00094 gboolean       dbus_g_type_struct_get_member            (const GValue *value,
00095                                                          guint member,
00096                                                          GValue *dest);
00097 gboolean       dbus_g_type_struct_set_member            (GValue *value,
00098                                                          guint member,
00099                                                          const GValue *src);
00100 
00101 gboolean       dbus_g_type_struct_get                   (const GValue *value,
00102                                                          guint member,
00103                                                          ...);
00104 
00105 gboolean       dbus_g_type_struct_set                   (GValue *value,
00106                                                          guint member,
00107                                                          ...);
00108 
00109 typedef gpointer (*DBusGTypeSpecializedConstructor)     (GType type);
00110 typedef void     (*DBusGTypeSpecializedFreeFunc)        (GType type, gpointer val);
00111 typedef gpointer (*DBusGTypeSpecializedCopyFunc)        (GType type, gpointer src);
00112 
00113 typedef struct {
00114   DBusGTypeSpecializedConstructor    constructor;
00115   DBusGTypeSpecializedFreeFunc       free_func;
00116   DBusGTypeSpecializedCopyFunc       copy_func;
00117   GDestroyNotify                     simple_free_func; /* for type-independent freeing if possible */
00118   gpointer                           padding2;
00119   gpointer                           padding3;
00120 } DBusGTypeSpecializedVtable;
00121 
00122 typedef gboolean (*DBusGTypeSpecializedCollectionFixedAccessorFunc) (GType type, gpointer instance, gpointer *values, guint *len);
00123 typedef void     (*DBusGTypeSpecializedCollectionIteratorFunc)      (GType type, gpointer instance, DBusGTypeSpecializedCollectionIterator iterator, gpointer user_data);
00124 typedef void     (*DBusGTypeSpecializedCollectionAppendFunc)        (DBusGTypeSpecializedAppendContext *ctx, GValue *val);
00125 typedef void     (*DBusGTypeSpecializedCollectionEndAppendFunc)     (DBusGTypeSpecializedAppendContext *ctx);
00126 
00127 typedef struct {
00128   DBusGTypeSpecializedVtable                        base_vtable;
00129   DBusGTypeSpecializedCollectionFixedAccessorFunc   fixed_accessor;
00130   DBusGTypeSpecializedCollectionIteratorFunc        iterator;
00131   DBusGTypeSpecializedCollectionAppendFunc          append_func;
00132   DBusGTypeSpecializedCollectionEndAppendFunc       end_append_func;
00133 } DBusGTypeSpecializedCollectionVtable;
00134 
00135 typedef void (*DBusGTypeSpecializedMapIteratorFunc) (GType type, gpointer instance, DBusGTypeSpecializedMapIterator iterator, gpointer user_data);
00136 typedef void (*DBusGTypeSpecializedMapAppendFunc)   (DBusGTypeSpecializedAppendContext *ctx, GValue *key, GValue *val);
00137 
00138 typedef struct {
00139   DBusGTypeSpecializedVtable                        base_vtable;
00140   DBusGTypeSpecializedMapIteratorFunc               iterator;
00141   DBusGTypeSpecializedMapAppendFunc                 append_func;
00142 } DBusGTypeSpecializedMapVtable;
00143 
00144 typedef gboolean (*DBusGTypeSpecializedStructGetMember) (GType type, gpointer instance, guint member, GValue *ret_value);
00145 typedef gboolean (*DBusGTypeSpecializedStructSetMember) (GType type, gpointer instance, guint member, const GValue *new_value);
00146 
00147 typedef struct {
00148   DBusGTypeSpecializedVtable                        base_vtable;
00149   DBusGTypeSpecializedStructGetMember               get_member;
00150   DBusGTypeSpecializedStructSetMember               set_member;
00151 } DBusGTypeSpecializedStructVtable;
00152 
00153 void           dbus_g_type_specialized_init           (void);
00154 
00155 void           dbus_g_type_register_collection        (const char                                   *name,
00156                                                        const DBusGTypeSpecializedCollectionVtable   *vtable,
00157                                                        guint                                         flags);
00158   
00159 void           dbus_g_type_register_map               (const char                                   *name,
00160                                                        const DBusGTypeSpecializedMapVtable          *vtable,
00161                                                        guint                                         flags);
00162 const DBusGTypeSpecializedMapVtable* dbus_g_type_map_peek_vtable (GType map_type);
00163 const DBusGTypeSpecializedCollectionVtable* dbus_g_type_collection_peek_vtable (GType collection_type);
00164 
00165 void           dbus_g_type_register_struct             (const char                                   *name,
00166                                                        const DBusGTypeSpecializedStructVtable        *vtable,
00167                                                        guint                                          flags);
00168 
00169 const DBusGTypeSpecializedMapVtable* dbus_g_type_map_peek_vtable (GType map_type);
00170 const DBusGTypeSpecializedCollectionVtable* dbus_g_type_collection_peek_vtable (GType collection_type);
00171 
00172 const DBusGTypeSpecializedStructVtable* dbus_g_type_struct_peek_vtable (GType struct_type);
00173 
00174 G_END_DECLS
00175 
00176 #endif

Generated on Wed Oct 3 10:04:23 2007 for D-BUSGLibBindings by  doxygen 1.5.1