goa: Add missing linker flag (for real).
[platform/upstream/evolution-data-server.git] / libedataserver / e-xml-hash-utils.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
4  *
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.
8  *
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.
13  *
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.
18  */
19
20 #if !defined (__LIBEDATASERVER_H_INSIDE__) && !defined (LIBEDATASERVER_COMPILATION)
21 #error "Only <libedataserver/libedataserver.h> should be included directly."
22 #endif
23
24 #ifndef E_XML_HASH_UTILS_H
25 #define E_XML_HASH_UTILS_H
26
27 #include <glib.h>
28 #include <libxml/parser.h>
29
30 G_BEGIN_DECLS
31
32 /**
33  * EXmlHashType:
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.
36  **/
37 typedef enum {
38         E_XML_HASH_TYPE_OBJECT_UID,
39         E_XML_HASH_TYPE_PROPERTY
40 } EXmlHashType;
41
42 GHashTable *    e_xml_to_hash                   (xmlDoc *doc,
43                                                  EXmlHashType type);
44 xmlDoc *        e_xml_from_hash                 (GHashTable *hash,
45                                                  EXmlHashType type,
46                                                  const gchar *root_name);
47 void            e_xml_destroy_hash              (GHashTable *hash);
48
49 /**
50  * EXmlHashStatus:
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.
54  **/
55 typedef enum {
56         E_XMLHASH_STATUS_SAME,
57         E_XMLHASH_STATUS_DIFFERENT,
58         E_XMLHASH_STATUS_NOT_FOUND
59 } EXmlHashStatus;
60
61 typedef void            (*EXmlHashFunc)         (const gchar *key,
62                                                  const gchar *value,
63                                                  gpointer user_data);
64 typedef gboolean        (*EXmlHashRemoveFunc)   (const gchar *key,
65                                                  const gchar *value,
66                                                  gpointer user_data);
67
68 typedef struct EXmlHash EXmlHash;
69
70 EXmlHash *      e_xmlhash_new                   (const gchar *filename);
71 void            e_xmlhash_add                   (EXmlHash *hash,
72                                                  const gchar *key,
73                                                  const gchar *data);
74 void            e_xmlhash_remove                (EXmlHash *hash,
75                                                  const gchar *key);
76 EXmlHashStatus  e_xmlhash_compare               (EXmlHash *hash,
77                                                  const gchar *key,
78                                                  const gchar *compare_data);
79 void            e_xmlhash_foreach_key           (EXmlHash *hash,
80                                                  EXmlHashFunc func,
81                                                  gpointer user_data);
82 void            e_xmlhash_foreach_key_remove    (EXmlHash *hash,
83                                                  EXmlHashRemoveFunc func,
84                                                  gpointer user_data);
85 void            e_xmlhash_write                 (EXmlHash *hash);
86 void            e_xmlhash_destroy               (EXmlHash *hash);
87
88 G_END_DECLS
89
90 #endif /* E_XML_HASH_UTILS_H */