/*  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_ATTR_MAP_H
#define H_ATTR_MAP_H

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

G_BEGIN_DECLS

typedef struct _HAttribute HAttribute;
typedef GHashTable         HAttrMap;

typedef void (*HAttrFunc)  (HAttribute *attr,
                            gpointer    user_data);

struct _HAttribute
{
  gchar *name;
  GType  type;
};

HAttribute *h_attr_new          (const gchar *name,
                                 GType        type);
HAttribute *h_attr_copy         (HAttribute  *attr);
void        h_attr_free         (HAttribute  *attr);

HAttrMap   *h_attr_map_new      (void);
void        h_attr_map_free     (HAttrMap    *map);
HAttribute *h_attr_map_get      (HAttrMap    *map,
                                 const gchar *name);
void        h_attr_map_insert   (HAttrMap    *map,
                                 HAttribute  *attr);
void        h_attr_map_foreach  (HAttrMap    *map,
                                 HAttrFunc    func,
                                 gpointer     user_data);
guint       h_attr_map_get_size (HAttrMap    *map);


G_END_DECLS

#endif /* #ifdef H_ATTR_MAP_H */
