1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
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 #if !defined (__LIBEDATASERVER_H_INSIDE__) && !defined (LIBEDATASERVER_COMPILATION)
21 #error "Only <libedataserver/libedataserver.h> should be included directly."
24 #ifndef E_XML_HASH_UTILS_H
25 #define E_XML_HASH_UTILS_H
28 #include <libxml/parser.h>
34 * @E_XML_HASH_TYPE_OBJECT_UID: Use the object UID as the hash key.
35 * @E_XML_HASH_TYPE_PROPERTY: Use the property name as the hash key.
38 E_XML_HASH_TYPE_OBJECT_UID,
39 E_XML_HASH_TYPE_PROPERTY
42 GHashTable * e_xml_to_hash (xmlDoc *doc,
44 xmlDoc * e_xml_from_hash (GHashTable *hash,
46 const gchar *root_name);
47 void e_xml_destroy_hash (GHashTable *hash);
51 * @E_XMLHASH_STATUS_SAME: The compared values are the same.
52 * @E_XMLHASH_STATUS_DIFFERENT: The compared values are different.
53 * @E_XMLHASH_STATUS_NOT_FOUND: The key to compare against was not found.
56 E_XMLHASH_STATUS_SAME,
57 E_XMLHASH_STATUS_DIFFERENT,
58 E_XMLHASH_STATUS_NOT_FOUND
61 typedef void (*EXmlHashFunc) (const gchar *key,
64 typedef gboolean (*EXmlHashRemoveFunc) (const gchar *key,
68 typedef struct EXmlHash EXmlHash;
70 EXmlHash * e_xmlhash_new (const gchar *filename);
71 void e_xmlhash_add (EXmlHash *hash,
74 void e_xmlhash_remove (EXmlHash *hash,
76 EXmlHashStatus e_xmlhash_compare (EXmlHash *hash,
78 const gchar *compare_data);
79 void e_xmlhash_foreach_key (EXmlHash *hash,
82 void e_xmlhash_foreach_key_remove (EXmlHash *hash,
83 EXmlHashRemoveFunc func,
85 void e_xmlhash_write (EXmlHash *hash);
86 void e_xmlhash_destroy (EXmlHash *hash);
90 #endif /* E_XML_HASH_UTILS_H */