meanwhile  1.1.1
mw_util.h
Go to the documentation of this file.
1 
2 /*
3  Meanwhile - Unofficial Lotus Sametime Community Client Library
4  Copyright (C) 2004 Christopher (siege) O'Brien
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public
17  License along with this library; if not, write to the Free
18  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20 
21 #ifndef _MW_UTIL_H
22 #define _MW_UTIL_H
23 
24 
25 #include <glib.h>
26 
27 #define map_guint_new() \
28  g_hash_table_new(g_direct_hash, g_direct_equal)
29 
30 
31 #define map_guint_new_full(valfree) \
32  g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, (valfree))
33 
34 
35 #define map_guint_insert(ht, key, val) \
36  g_hash_table_insert((ht), GUINT_TO_POINTER((guint)(key)), (val))
37 
38 
39 #define map_guint_replace(ht, key, val) \
40  g_hash_table_replace((ht), GUINT_TO_POINTER((guint)(key)), (val))
41 
42 
43 #define map_guint_lookup(ht, key) \
44  g_hash_table_lookup((ht), GUINT_TO_POINTER((guint)(key)))
45 
46 
47 #define map_guint_remove(ht, key) \
48  g_hash_table_remove((ht), GUINT_TO_POINTER((guint)(key)))
49 
50 
51 #define map_guint_steal(ht, key) \
52  g_hash_table_steal((ht), GUINT_TO_POINTER((guint)(key)))
53 
54 
55 GList *map_collect_keys(GHashTable *ht);
56 
57 
58 GList *map_collect_values(GHashTable *ht);
59 
60 
61 struct mw_datum {
62  gpointer data;
63  GDestroyNotify clear;
64 };
65 
66 
67 struct mw_datum *mw_datum_new(gpointer data, GDestroyNotify clear);
68 
69 
70 void mw_datum_set(struct mw_datum *d, gpointer data, GDestroyNotify clear);
71 
72 
73 gpointer mw_datum_get(struct mw_datum *d);
74 
75 
76 void mw_datum_clear(struct mw_datum *d);
77 
78 
79 void mw_datum_free(struct mw_datum *d);
80 
81 
82 #endif
mwService_funcClear clear
The service&#39;s cleanup handler.
Definition: mw_service.h:195
gpointer mw_datum_get(struct mw_datum *d)
GDestroyNotify clear
Definition: mw_util.h:63
void mw_datum_set(struct mw_datum *d, gpointer data, GDestroyNotify clear)
void mw_datum_free(struct mw_datum *d)
GList * map_collect_keys(GHashTable *ht)
struct mw_datum * mw_datum_new(gpointer data, GDestroyNotify clear)
void mw_datum_clear(struct mw_datum *d)
GList * map_collect_values(GHashTable *ht)
gpointer data
Definition: mw_util.h:62
Definition: mw_util.h:61