/*  libhrel - Holyrel library

    Copyright (C) 2005 Chong Kai Xiong <descender@phreaker.net>

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public
    License along with this library; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA  02111-1307  USA.
*/

#ifndef H_TUPLE_H
#define H_TUPLE_H

#include <glib.h>
#include <glib-object.h>
#include <stdarg.h>

G_BEGIN_DECLS

#define H_TYPE_TUPLE      (h_tuple_get_type ())

typedef GHashTable         HTuple;
typedef struct _HTupleElem HTupleElem;

struct _HTupleElem
{
    GType    type;
    gpointer value;
};

GType       h_tuple_get_type        (void);
HTuple     *h_tuple_new             (void);
HTuple     *h_tuple_newv            (gboolean     typed,
                                     ...);
HTuple     *h_tuple_new_v           (gboolean     typed,
                                     va_list      args);
HTuple     *h_tuple_n_new_v         (gboolean     typed,
                                     guint        size,
                                     va_list      args);
void        h_tuple_free            (HTuple      *tuple);
HTuple     *h_tuple_clone           (HTuple      *tuple);
HTuple     *h_tuple_clone_elems_l   (HTuple      *tuple,
                                     GSList      *list);
guint       h_tuple_get_size        (HTuple      *tuple);
void        h_tuple_insert          (HTuple      *tuple,
                                     const gchar *name,
                                     GType        type,
                                     gpointer     value);
void        h_tuple_print           (HTuple      *tuple);
HTupleElem *h_tuple_get             (HTuple      *tuple,
                                     const gchar *name);
gpointer    h_tuple_get_value       (HTuple      *tuple,
                                     const gchar *name);
gboolean    h_tuple_equal           (HTuple      *tuple1,
                                     HTuple      *tuple2);
gboolean    h_tuple_equal_elem      (HTuple      *tuple1,
                                     HTuple      *tuple2,
                                     const gchar *name);
gboolean    h_tuple_equal_elems     (HTuple      *tuple1,
                                     HTuple      *tuple2,
                                     ...);
gboolean    h_tuple_equal_elems_l   (HTuple      *tuple1,
                                     HTuple      *tuple2,
                                     GSList      *list);
gint        h_tuple_compare_elem    (HTuple      *tuple1,
                                     HTuple      *tuple2,
                                     const gchar *name);
gint        h_tuple_compare_elems   (HTuple      *tuple1,
                                     HTuple      *tuple2,
                                     ...);
gint        h_tuple_compare_elems_l (HTuple      *tuple1,
                                     HTuple      *tuple2,
                                     GSList      *list);
guint       h_tuple_hash            (HTuple      *tuple);
guint       h_tuple_hash_elems      (HTuple      *tuple,
                                     ...);
guint       h_tuple_hash_elems_l    (HTuple      *tuple,
                                     GSList      *list);

G_END_DECLS

#endif /* #ifndef H_TUPLE_H */
