meanwhile 1.0.2
|
00001 00002 /* 00003 Meanwhile - Unofficial Lotus Sametime Community Client Library 00004 Copyright (C) 2004 Christopher (siege) O'Brien 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License as published by the Free Software Foundation; either 00009 version 2 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public 00017 License along with this library; if not, write to the Free 00018 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 */ 00020 00021 #ifndef _MW_UTIL_H 00022 #define _MW_UTIL_H 00023 00024 00025 #include <glib.h> 00026 00027 00028 #define map_guint_new() \ 00029 g_hash_table_new(g_direct_hash, g_direct_equal) 00030 00031 00032 #define map_guint_new_full(valfree) \ 00033 g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, (valfree)) 00034 00035 00036 #define map_guint_insert(ht, key, val) \ 00037 g_hash_table_insert((ht), GUINT_TO_POINTER((guint)(key)), (val)) 00038 00039 00040 #define map_guint_replace(ht, key, val) \ 00041 g_hash_table_replace((ht), GUINT_TO_POINTER((guint)(key)), (val)) 00042 00043 00044 #define map_guint_lookup(ht, key) \ 00045 g_hash_table_lookup((ht), GUINT_TO_POINTER((guint)(key))) 00046 00047 00048 #define map_guint_remove(ht, key) \ 00049 g_hash_table_remove((ht), GUINT_TO_POINTER((guint)(key))) 00050 00051 00052 #define map_guint_steal(ht, key) \ 00053 g_hash_table_steal((ht), GUINT_TO_POINTER((guint)(key))) 00054 00055 00056 GList *map_collect_keys(GHashTable *ht); 00057 00058 00059 GList *map_collect_values(GHashTable *ht); 00060 00061 00062 struct mw_datum { 00063 gpointer data; 00064 GDestroyNotify clear; 00065 }; 00066 00067 00068 struct mw_datum *mw_datum_new(gpointer data, GDestroyNotify clear); 00069 00070 00071 void mw_datum_set(struct mw_datum *d, gpointer data, GDestroyNotify clear); 00072 00073 00074 gpointer mw_datum_get(struct mw_datum *d); 00075 00076 00077 void mw_datum_clear(struct mw_datum *d); 00078 00079 00080 void mw_datum_free(struct mw_datum *d); 00081 00082 00083 #endif