/*  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_TYPES_H
#define H_TYPES_H

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

G_BEGIN_DECLS

typedef gpointer  (*HCloneFunc) (gconstpointer value);
typedef gchar    *(*HStrFunc)   (gconstpointer value);

typedef struct _HTypeInfo HTypeInfo;

struct _HTypeInfo
{
  gsize          size;
  HCloneFunc     clone;
  GCompareFunc   compare;
  GEqualFunc     equal;
  GHashFunc      hash;
  GDestroyNotify free;
  HStrFunc       str;
};

void           h_type_init         (void);
gboolean       h_type_add          (GType            type,
                                    const HTypeInfo *info);
gboolean       h_type_remove       (GType            type);
gboolean       h_type_known        (GType            type);
HTypeInfo     *h_type_get_info     (GType            type);
GCompareFunc   h_type_compare_func (GType            type);
GHashFunc      h_type_hash_func    (GType            type);
GEqualFunc     h_type_equal_func   (GType            type);
GDestroyNotify h_type_free_func    (GType            type);

gpointer h_value_clone   (GType         type,
                          gconstpointer value);
gchar   *h_value_str     (GType         type,
                          gconstpointer value);
void     h_value_free    (GType         type,
                          gpointer      value);
gint     h_value_compare (GType         type,
                          gconstpointer value1,
                          gconstpointer value2);

void     h_dummy          (gconstpointer value);
gpointer h_identity       (gconstpointer value);
gint     h_direct_compare (gconstpointer value1,
                           gconstpointer value2);

G_END_DECLS

#endif /* #ifndef H_TYPES_H */
