Blame src/mw_util.h

Packit 16808d
Packit 16808d
/*
Packit 16808d
  Meanwhile - Unofficial Lotus Sametime Community Client Library
Packit 16808d
  Copyright (C) 2004  Christopher (siege) O'Brien
Packit 16808d
  
Packit 16808d
  This library is free software; you can redistribute it and/or
Packit 16808d
  modify it under the terms of the GNU Library General Public
Packit 16808d
  License as published by the Free Software Foundation; either
Packit 16808d
  version 2 of the License, or (at your option) any later version.
Packit 16808d
  
Packit 16808d
  This library is distributed in the hope that it will be useful,
Packit 16808d
  but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 16808d
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 16808d
  Library General Public License for more details.
Packit 16808d
  
Packit 16808d
  You should have received a copy of the GNU Library General Public
Packit 16808d
  License along with this library; if not, write to the Free
Packit 16808d
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
Packit 16808d
*/
Packit 16808d
Packit 16808d
#ifndef _MW_UTIL_H
Packit 16808d
#define _MW_UTIL_H
Packit 16808d
Packit 16808d
Packit 16808d
#include <glib.h>
Packit 16808d
Packit 16808d
#define map_guint_new() \
Packit 16808d
  g_hash_table_new(g_direct_hash, g_direct_equal)
Packit 16808d
Packit 16808d
Packit 16808d
#define map_guint_new_full(valfree) \
Packit 16808d
  g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, (valfree))
Packit 16808d
Packit 16808d
Packit 16808d
#define map_guint_insert(ht, key, val) \
Packit 16808d
  g_hash_table_insert((ht), GUINT_TO_POINTER((guint)(key)), (val))
Packit 16808d
Packit 16808d
Packit 16808d
#define map_guint_replace(ht, key, val) \
Packit 16808d
  g_hash_table_replace((ht), GUINT_TO_POINTER((guint)(key)), (val))
Packit 16808d
Packit 16808d
Packit 16808d
#define map_guint_lookup(ht, key) \
Packit 16808d
  g_hash_table_lookup((ht), GUINT_TO_POINTER((guint)(key)))
Packit 16808d
Packit 16808d
Packit 16808d
#define map_guint_remove(ht, key) \
Packit 16808d
  g_hash_table_remove((ht), GUINT_TO_POINTER((guint)(key)))
Packit 16808d
Packit 16808d
Packit 16808d
#define map_guint_steal(ht, key) \
Packit 16808d
  g_hash_table_steal((ht), GUINT_TO_POINTER((guint)(key)))
Packit 16808d
Packit 16808d
Packit 16808d
GList *map_collect_keys(GHashTable *ht);
Packit 16808d
Packit 16808d
Packit 16808d
GList *map_collect_values(GHashTable *ht);
Packit 16808d
Packit 16808d
Packit 16808d
struct mw_datum {
Packit 16808d
  gpointer data;
Packit 16808d
  GDestroyNotify clear;
Packit 16808d
};
Packit 16808d
Packit 16808d
Packit 16808d
struct mw_datum *mw_datum_new(gpointer data, GDestroyNotify clear);
Packit 16808d
Packit 16808d
Packit 16808d
void mw_datum_set(struct mw_datum *d, gpointer data, GDestroyNotify clear);
Packit 16808d
Packit 16808d
Packit 16808d
gpointer mw_datum_get(struct mw_datum *d);
Packit 16808d
Packit 16808d
Packit 16808d
void mw_datum_clear(struct mw_datum *d);
Packit 16808d
Packit 16808d
Packit 16808d
void mw_datum_free(struct mw_datum *d);
Packit 16808d
Packit 16808d
Packit 16808d
#endif