1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 * Copyright (C) 2001-2003 Ximian, Inc.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of version 2 of the GNU Lesser General Public
7 * License as published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this program; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
20 #ifndef __E_XML_HASH_UTILS_H__
21 #define __E_XML_HASH_UTILS_H__
24 #include <libxml/parser.h>
30 * @E_XML_HASH_TYPE_OBJECT_UID: Use the object UID as the hash key.
31 * @E_XML_HASH_TYPE_PROPERTY: Use the property name as the hash key.
34 E_XML_HASH_TYPE_OBJECT_UID,
35 E_XML_HASH_TYPE_PROPERTY
38 GHashTable *e_xml_to_hash (xmlDoc *doc,
40 xmlDoc *e_xml_from_hash (GHashTable *hash,
42 const char *root_node);
44 void e_xml_destroy_hash (GHashTable *hash);
50 * @E_XMLHASH_STATUS_SAME: The compared values are the same.
51 * @E_XMLHASH_STATUS_DIFFERENT: The compared values are different.
52 * @E_XMLHASH_STATUS_NOT_FOUND: The key to compare against was not found.
55 E_XMLHASH_STATUS_SAME,
56 E_XMLHASH_STATUS_DIFFERENT,
57 E_XMLHASH_STATUS_NOT_FOUND
60 typedef void (* EXmlHashFunc) (const char *key, const char *value, gpointer user_data);
61 typedef gboolean (* EXmlHashRemoveFunc) (const char *key, const char *value, gpointer user_data);
63 typedef struct EXmlHash EXmlHash;
65 EXmlHash *e_xmlhash_new (const char *filename);
67 void e_xmlhash_add (EXmlHash *hash,
70 void e_xmlhash_remove (EXmlHash *hash,
73 EXmlHashStatus e_xmlhash_compare (EXmlHash *hash,
75 const char *compare_data);
76 void e_xmlhash_foreach_key (EXmlHash *hash,
79 void e_xmlhash_foreach_key_remove (EXmlHash *hash,
80 EXmlHashRemoveFunc func,
83 void e_xmlhash_write (EXmlHash *hash);
84 void e_xmlhash_destroy (EXmlHash *hash);