meanwhile 1.1.0
|
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 #define map_guint_new() \ 00028 g_hash_table_new(g_direct_hash, g_direct_equal) 00029 00030 00031 #define map_guint_new_full(valfree) \ 00032 g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, (valfree)) 00033 00034 00035 #define map_guint_insert(ht, key, val) \ 00036 g_hash_table_insert((ht), GUINT_TO_POINTER((guint)(key)), (val)) 00037 00038 00039 #define map_guint_replace(ht, key, val) \ 00040 g_hash_table_replace((ht), GUINT_TO_POINTER((guint)(key)), (val)) 00041 00042 00043 #define map_guint_lookup(ht, key) \ 00044 g_hash_table_lookup((ht), GUINT_TO_POINTER((guint)(key))) 00045 00046 00047 #define map_guint_remove(ht, key) \ 00048 g_hash_table_remove((ht), GUINT_TO_POINTER((guint)(key))) 00049 00050 00051 #define map_guint_steal(ht, key) \ 00052 g_hash_table_steal((ht), GUINT_TO_POINTER((guint)(key))) 00053 00054 00055 GList *map_collect_keys(GHashTable *ht); 00056 00057 00058 GList *map_collect_values(GHashTable *ht); 00059 00060 00061 struct mw_datum { 00062 gpointer data; 00063 GDestroyNotify clear; 00064 }; 00065 00066 00067 struct mw_datum *mw_datum_new(gpointer data, GDestroyNotify clear); 00068 00069 00070 void mw_datum_set(struct mw_datum *d, gpointer data, GDestroyNotify clear); 00071 00072 00073 gpointer mw_datum_get(struct mw_datum *d); 00074 00075 00076 void mw_datum_clear(struct mw_datum *d); 00077 00078 00079 void mw_datum_free(struct mw_datum *d); 00080 00081 00082 #endif