gdataset.h

Go to the documentation of this file.
00001 /* GLIB - Library of useful routines for C programming
00002  * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
00003  * Portions copyright (c) 2006 Nokia Corporation.  All rights reserved.
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Lesser General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2 of the License, or (at your option) any later version.
00009  *
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Lesser General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Lesser General Public
00016  * License along with this library; if not, write to the
00017  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018  * Boston, MA 02111-1307, USA.
00019  */
00020 
00021 /*
00022  * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
00023  * file for a list of people on the GLib Team.  See the ChangeLog
00024  * files for a list of changes.  These files are distributed with
00025  * GLib at ftp://ftp.gtk.org/pub/gtk/. 
00026  */
00027 
00028 #ifndef __G_DATASET_H__
00029 #define __G_DATASET_H__
00030 
00031 #include <_ansi.h>
00032 #include <glib/gquark.h>
00033 
00034 G_BEGIN_DECLS
00035 
00036 typedef struct _GData           GData;
00037 
00038 typedef void            (*GDataForeachFunc)     (GQuark         key_id,
00039                                                  gpointer       data,
00040                                                  gpointer       user_data);
00041 
00042 /* Keyed Data List
00043  */
00044 IMPORT_C void     g_datalist_init                (GData            **datalist);
00045 IMPORT_C void     g_datalist_clear               (GData            **datalist);
00046 IMPORT_C gpointer g_datalist_id_get_data         (GData            **datalist,
00047                                          GQuark             key_id);
00048 IMPORT_C void     g_datalist_id_set_data_full    (GData            **datalist,
00049                                          GQuark             key_id,
00050                                          gpointer           data,
00051                                          GDestroyNotify     destroy_func);
00052 IMPORT_C gpointer g_datalist_id_remove_no_notify (GData            **datalist,
00053                                          GQuark             key_id);
00054 IMPORT_C void     g_datalist_foreach             (GData            **datalist,
00055                                          GDataForeachFunc   func,
00056                                          gpointer           user_data);
00057 
00065 #define G_DATALIST_FLAGS_MASK 0x3
00066 
00067 IMPORT_C void     g_datalist_set_flags           (GData            **datalist,
00068                                          guint              flags);
00069 IMPORT_C void     g_datalist_unset_flags         (GData            **datalist,
00070                                          guint              flags);
00071 IMPORT_C guint    g_datalist_get_flags           (GData            **datalist);
00072 
00073 #define   g_datalist_id_set_data(dl, q, d)      \
00074      g_datalist_id_set_data_full ((dl), (q), (d), NULL)
00075 #define   g_datalist_id_remove_data(dl, q)      \
00076      g_datalist_id_set_data ((dl), (q), NULL)
00077 #define   g_datalist_get_data(dl, k)            \
00078      (g_datalist_id_get_data ((dl), g_quark_try_string (k)))
00079 #define   g_datalist_set_data_full(dl, k, d, f) \
00080      g_datalist_id_set_data_full ((dl), g_quark_from_string (k), (d), (f))
00081 #define   g_datalist_remove_no_notify(dl, k)    \
00082      g_datalist_id_remove_no_notify ((dl), g_quark_try_string (k))
00083 #define   g_datalist_set_data(dl, k, d)         \
00084      g_datalist_set_data_full ((dl), (k), (d), NULL)
00085 #define   g_datalist_remove_data(dl, k)         \
00086      g_datalist_id_set_data ((dl), g_quark_try_string (k), NULL)
00087 
00088 
00089 /* Location Associated Keyed Data
00090  */
00091 IMPORT_C void      g_dataset_destroy             (gconstpointer    dataset_location);
00092 IMPORT_C gpointer  g_dataset_id_get_data         (gconstpointer    dataset_location,
00093                                          GQuark           key_id);
00094 IMPORT_C void      g_dataset_id_set_data_full    (gconstpointer    dataset_location,
00095                                          GQuark           key_id,
00096                                          gpointer         data,
00097                                          GDestroyNotify   destroy_func);
00098 IMPORT_C gpointer  g_dataset_id_remove_no_notify (gconstpointer    dataset_location,
00099                                          GQuark           key_id);
00100 IMPORT_C void      g_dataset_foreach             (gconstpointer    dataset_location,
00101                                          GDataForeachFunc func,
00102                                          gpointer         user_data);
00103 #define   g_dataset_id_set_data(l, k, d)        \
00104      g_dataset_id_set_data_full ((l), (k), (d), NULL)
00105 #define   g_dataset_id_remove_data(l, k)        \
00106      g_dataset_id_set_data ((l), (k), NULL)
00107 #define   g_dataset_get_data(l, k)              \
00108      (g_dataset_id_get_data ((l), g_quark_try_string (k)))
00109 #define   g_dataset_set_data_full(l, k, d, f)   \
00110      g_dataset_id_set_data_full ((l), g_quark_from_string (k), (d), (f))
00111 #define   g_dataset_remove_no_notify(l, k)      \
00112      g_dataset_id_remove_no_notify ((l), g_quark_try_string (k))
00113 #define   g_dataset_set_data(l, k, d)           \
00114      g_dataset_set_data_full ((l), (k), (d), NULL)
00115 #define   g_dataset_remove_data(l, k)           \
00116      g_dataset_id_set_data ((l), g_quark_try_string (k), NULL)
00117 
00118 G_END_DECLS
00119 
00120 #endif /* __G_DATASET_H__ */
00121 
00122 
00123 
00124 

Copyright © Nokia Corporation 2001-2008
Back to top