1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
<html xmlns:cf="http://docbook.sourceforge.net/xmlns/chunkfast/1.0">
4
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
5
<title>EXMLHash</title>
6
<meta name="generator" content="DocBook XSL Stylesheets V1.69.0">
7
<link rel="start" href="index.html" title="Evolution API Reference: libedataserver, utility library">
8
<link rel="up" href="ch01.html" title="Evolution API Reference: libedataserver, utility library">
9
<link rel="prev" href="libedataserver-e-url.html" title="EUrl">
10
<link rel="next" href="libedataserver-md5-utils.html" title="MD5 Utility Functions">
11
<meta name="generator" content="GTK-Doc V1.4 (XML mode)">
12
<link rel="stylesheet" href="style.css" type="text/css">
13
<link rel="chapter" href="ch01.html" title="Evolution API Reference: libedataserver, utility library">
15
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
16
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
18
<td><a accesskey="p" href="libedataserver-e-url.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
19
<td><a accesskey="u" href="ch01.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
20
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
21
<th width="100%" align="center">Evolution API Reference: libedataserver, utility library</th>
22
<td><a accesskey="n" href="libedataserver-md5-utils.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
24
<tr><td colspan="5" class="shortcuts"><nobr><a href="#top_of_page" class="shortcut">Top</a>
26
<a href="#desc" class="shortcut">Description</a></nobr></td></tr>
28
<div class="refentry" lang="en">
29
<a name="libedataserver-e-xml-hash-utils"></a><div class="titlepage"></div>
30
<div class="refnamediv"><table width="100%"><tr>
32
<h2><span class="refentrytitle"><a name="top_of_page"></a>EXMLHash</span></h2>
33
<p>EXMLHash — Functions for manipulating xml as a hash table.</p>
35
<td valign="top" align="right"></td>
37
<div class="refsynopsisdiv">
38
<a name="synopsis"></a><h2>Synopsis</h2>
39
<pre class="synopsis">
43
enum <a href="libedataserver-e-xml-hash-utils.html#EXmlHashType">EXmlHashType</a>;
45
href="../glib/glib-Hash-Tables.html#GHashTable"
46
>GHashTable</a>* <a href="libedataserver-e-xml-hash-utils.html#e-xml-to-hash">e_xml_to_hash</a> (xmlDoc *doc,
47
<a href="libedataserver-e-xml-hash-utils.html#EXmlHashType">EXmlHashType</a> type);
48
xmlDoc* <a href="libedataserver-e-xml-hash-utils.html#e-xml-from-hash">e_xml_from_hash</a> (<a
49
href="../glib/glib-Hash-Tables.html#GHashTable"
50
>GHashTable</a> *hash,
51
<a href="libedataserver-e-xml-hash-utils.html#EXmlHashType">EXmlHashType</a> type,
52
const char *root_node);
53
void <a href="libedataserver-e-xml-hash-utils.html#e-xml-destroy-hash">e_xml_destroy_hash</a> (<a
54
href="../glib/glib-Hash-Tables.html#GHashTable"
55
>GHashTable</a> *hash);
56
enum <a href="libedataserver-e-xml-hash-utils.html#EXmlHashStatus">EXmlHashStatus</a>;
57
void (<a href="libedataserver-e-xml-hash-utils.html#EXmlHashFunc">*EXmlHashFunc</a>) (const char *key,
60
href="../glib/glib-Basic-Types.html#gpointer"
61
>gpointer</a> user_data);
62
typedef <a href="libedataserver-e-xml-hash-utils.html#EXmlHash">EXmlHash</a>;
63
<a href="libedataserver-e-xml-hash-utils.html#EXmlHash">EXmlHash</a>* <a href="libedataserver-e-xml-hash-utils.html#e-xmlhash-new">e_xmlhash_new</a> (const char *filename);
64
void <a href="libedataserver-e-xml-hash-utils.html#e-xmlhash-add">e_xmlhash_add</a> (<a href="libedataserver-e-xml-hash-utils.html#EXmlHash">EXmlHash</a> *hash,
67
void <a href="libedataserver-e-xml-hash-utils.html#e-xmlhash-remove">e_xmlhash_remove</a> (<a href="libedataserver-e-xml-hash-utils.html#EXmlHash">EXmlHash</a> *hash,
69
<a href="libedataserver-e-xml-hash-utils.html#EXmlHashStatus">EXmlHashStatus</a> <a href="libedataserver-e-xml-hash-utils.html#e-xmlhash-compare">e_xmlhash_compare</a> (<a href="libedataserver-e-xml-hash-utils.html#EXmlHash">EXmlHash</a> *hash,
71
const char *compare_data);
72
void <a href="libedataserver-e-xml-hash-utils.html#e-xmlhash-foreach-key">e_xmlhash_foreach_key</a> (<a href="libedataserver-e-xml-hash-utils.html#EXmlHash">EXmlHash</a> *hash,
73
<a href="libedataserver-e-xml-hash-utils.html#EXmlHashFunc">EXmlHashFunc</a> func,
75
href="../glib/glib-Basic-Types.html#gpointer"
76
>gpointer</a> user_data);
77
void <a href="libedataserver-e-xml-hash-utils.html#e-xmlhash-write">e_xmlhash_write</a> (<a href="libedataserver-e-xml-hash-utils.html#EXmlHash">EXmlHash</a> *hash);
78
void <a href="libedataserver-e-xml-hash-utils.html#e-xmlhash-destroy">e_xmlhash_destroy</a> (<a href="libedataserver-e-xml-hash-utils.html#EXmlHash">EXmlHash</a> *hash);
81
<div class="refsect1" lang="en">
82
<a name="desc"></a><h2>Description</h2>
87
<div class="refsect1" lang="en">
88
<a name="details"></a><h2>Details</h2>
89
<div class="refsect2" lang="en">
90
<a name="id2597318"></a><h3>
91
<a name="EXmlHashType"></a>enum EXmlHashType</h3>
92
<a class="indexterm" name="id2597327"></a><pre class="programlisting">typedef enum {
93
E_XML_HASH_TYPE_OBJECT_UID,
94
E_XML_HASH_TYPE_PROPERTY
102
<div class="variablelist"><table border="0">
103
<col align="left" valign="top">
107
<span class="term"><code class="literal">E_XML_HASH_TYPE_OBJECT_UID</code></span></td>
108
<td> Use the object UID as the hash key.
113
<span class="term"><code class="literal">E_XML_HASH_TYPE_PROPERTY</code></span></td>
114
<td> Use the property name as the hash key.
121
<div class="refsect2" lang="en">
122
<a name="id2597383"></a><h3>
123
<a name="e-xml-to-hash"></a>e_xml_to_hash ()</h3>
124
<a class="indexterm" name="id2597393"></a><pre class="programlisting"><a
125
href="../glib/glib-Hash-Tables.html#GHashTable"
126
>GHashTable</a>* e_xml_to_hash (xmlDoc *doc,
127
<a href="libedataserver-e-xml-hash-utils.html#EXmlHashType">EXmlHashType</a> type);</pre>
130
href="../glib/glib-Hash-Tables.html#GHashTable"
131
><span class="type">GHashTable</span></a> representation of the <span class="type">xmlDoc</span> <em class="parameter"><code>doc</code></em>.
132
If <em class="parameter"><code>type</code></em> is * <em class="parameter"><code>E_XML_HASH_TYPE_PROPERTY</code></em>, all XML nodes will be
134
href="../glib/glib-Hash-Tables.html#GHashTable"
135
><span class="type">GHashTable</span></a> by name. If <em class="parameter"><code>type</code></em> is
136
<code class="literal">E_XML_HASH_TYPE_OBJECT_UID</code>, then XML objects will be indexed in
137
the hash by their UID (other nodes will still be indexed by name).</p>
141
<div class="variablelist"><table border="0">
142
<col align="left" valign="top">
146
<span class="term"><em class="parameter"><code>doc</code></em> :</span></td>
147
<td> The <span class="type">xmlDoc</span> to store in a hash table.
152
<span class="term"><em class="parameter"><code>type</code></em> :</span></td>
153
<td> The value type to use as a key in the hash table.
158
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
159
<td> The newly-created <a
160
href="../glib/glib-Hash-Tables.html#GHashTable"
161
><span class="type">GHashTable</span></a> representation of <em class="parameter"><code>doc</code></em>.
168
<div class="refsect2" lang="en">
169
<a name="id2597546"></a><h3>
170
<a name="e-xml-from-hash"></a>e_xml_from_hash ()</h3>
171
<a class="indexterm" name="id2597557"></a><pre class="programlisting">xmlDoc* e_xml_from_hash (<a
172
href="../glib/glib-Hash-Tables.html#GHashTable"
173
>GHashTable</a> *hash,
174
<a href="libedataserver-e-xml-hash-utils.html#EXmlHashType">EXmlHashType</a> type,
175
const char *root_node);</pre>
177
Uses the key/value pair representation of an XML structure in <em class="parameter"><code>hash</code></em>
178
to build an equivalent <span class="type">xmlDoc</span>. This is the reverse of
179
<a href="libedataserver-e-xml-hash-utils.html#e-xml-to-hash"><code class="function">e_xml_to_hash()</code></a>.</p>
183
<div class="variablelist"><table border="0">
184
<col align="left" valign="top">
188
<span class="term"><em class="parameter"><code>hash</code></em> :</span></td>
190
href="../glib/glib-Hash-Tables.html#GHashTable"
191
><span class="type">GHashTable</span></a> to extract the XML from.
196
<span class="term"><em class="parameter"><code>type</code></em> :</span></td>
197
<td> The <a href="libedataserver-e-xml-hash-utils.html#EXmlHashType"><span class="type">EXmlHashType</span></a> used to store the XML.
202
<span class="term"><em class="parameter"><code>root_node</code></em> :</span></td>
208
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
209
<td> The <span class="type">xmlDoc</span> created from the data in <em class="parameter"><code>hash</code></em>.
216
<div class="refsect2" lang="en">
217
<a name="id2595017"></a><h3>
218
<a name="e-xml-destroy-hash"></a>e_xml_destroy_hash ()</h3>
219
<a class="indexterm" name="id2595027"></a><pre class="programlisting">void e_xml_destroy_hash (<a
220
href="../glib/glib-Hash-Tables.html#GHashTable"
221
>GHashTable</a> *hash);</pre>
223
Frees the memory used by <em class="parameter"><code>hash</code></em> and its contents.</p>
227
<div class="variablelist"><table border="0">
228
<col align="left" valign="top">
231
<span class="term"><em class="parameter"><code>hash</code></em> :</span></td>
233
href="../glib/glib-Hash-Tables.html#GHashTable"
234
><span class="type">GHashTable</span></a> to destroy.
240
<div class="refsect2" lang="en">
241
<a name="id2595090"></a><h3>
242
<a name="EXmlHashStatus"></a>enum EXmlHashStatus</h3>
243
<a class="indexterm" name="id2595100"></a><pre class="programlisting">typedef enum {
244
E_XMLHASH_STATUS_SAME,
245
E_XMLHASH_STATUS_DIFFERENT,
246
E_XMLHASH_STATUS_NOT_FOUND
254
<div class="variablelist"><table border="0">
255
<col align="left" valign="top">
259
<span class="term"><code class="literal">E_XMLHASH_STATUS_SAME</code></span></td>
260
<td> The compared values are the same.
265
<span class="term"><code class="literal">E_XMLHASH_STATUS_DIFFERENT</code></span></td>
266
<td> The compared values are different.
271
<span class="term"><code class="literal">E_XMLHASH_STATUS_NOT_FOUND</code></span></td>
272
<td> The key to compare against was not found.
279
<div class="refsect2" lang="en">
280
<a name="id2598439"></a><h3>
281
<a name="EXmlHashFunc"></a>EXmlHashFunc ()</h3>
282
<a class="indexterm" name="id2598447"></a><pre class="programlisting">void (*EXmlHashFunc) (const char *key,
285
href="../glib/glib-Basic-Types.html#gpointer"
286
>gpointer</a> user_data);</pre>
290
<div class="variablelist"><table border="0">
291
<col align="left" valign="top">
295
<span class="term"><em class="parameter"><code>key</code></em> :</span></td>
301
<span class="term"><em class="parameter"><code>value</code></em> :</span></td>
307
<span class="term"><em class="parameter"><code>user_data</code></em> :</span></td>
317
<div class="refsect2" lang="en">
318
<a name="id2598526"></a><h3>
319
<a name="EXmlHash"></a>EXmlHash</h3>
320
<a class="indexterm" name="id2598534"></a><pre class="programlisting">typedef struct EXmlHash EXmlHash;
323
A hash table representation of an XML file.</p>
329
<div class="refsect2" lang="en">
330
<a name="id2598552"></a><h3>
331
<a name="e-xmlhash-new"></a>e_xmlhash_new ()</h3>
332
<a class="indexterm" name="id2598560"></a><pre class="programlisting"><a href="libedataserver-e-xml-hash-utils.html#EXmlHash">EXmlHash</a>* e_xmlhash_new (const char *filename);</pre>
334
Creates a new <a href="libedataserver-e-xml-hash-utils.html#EXmlHash"><span class="type">EXmlHash</span></a> from the file <em class="parameter"><code>filename</code></em>. If <em class="parameter"><code>filename</code></em> does
335
not already exist, an empty <a href="libedataserver-e-xml-hash-utils.html#EXmlHash"><span class="type">EXmlHash</span></a> will be created.</p>
339
<div class="variablelist"><table border="0">
340
<col align="left" valign="top">
344
<span class="term"><em class="parameter"><code>filename</code></em> :</span></td>
345
<td> The name of an XML file.
350
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
351
<td> The new <a href="libedataserver-e-xml-hash-utils.html#EXmlHash"><span class="type">EXmlHash</span></a> structure, or <code class="literal">NULL</code> if unable to parse
352
<em class="parameter"><code>filename</code></em>.
359
<div class="refsect2" lang="en">
360
<a name="id2598664"></a><h3>
361
<a name="e-xmlhash-add"></a>e_xmlhash_add ()</h3>
362
<a class="indexterm" name="id2598674"></a><pre class="programlisting">void e_xmlhash_add (<a href="libedataserver-e-xml-hash-utils.html#EXmlHash">EXmlHash</a> *hash,
364
const char *data);</pre>
366
Adds a new key/value pair to the <a href="libedataserver-e-xml-hash-utils.html#EXmlHash"><span class="type">EXmlHash</span></a> <em class="parameter"><code>hash</code></em>.</p>
370
<div class="variablelist"><table border="0">
371
<col align="left" valign="top">
375
<span class="term"><em class="parameter"><code>hash</code></em> :</span></td>
376
<td> The <a href="libedataserver-e-xml-hash-utils.html#EXmlHash"><span class="type">EXmlHash</span></a> to add an entry to.
381
<span class="term"><em class="parameter"><code>key</code></em> :</span></td>
382
<td> The key to use for the entry.
387
<span class="term"><em class="parameter"><code>data</code></em> :</span></td>
388
<td> The value of the new entry.
395
<div class="refsect2" lang="en">
396
<a name="id2598785"></a><h3>
397
<a name="e-xmlhash-remove"></a>e_xmlhash_remove ()</h3>
398
<a class="indexterm" name="id2598796"></a><pre class="programlisting">void e_xmlhash_remove (<a href="libedataserver-e-xml-hash-utils.html#EXmlHash">EXmlHash</a> *hash,
399
const char *key);</pre>
401
Remove the entry in <em class="parameter"><code>hash</code></em> with key equal to <em class="parameter"><code>key</code></em>, if it exists.</p>
405
<div class="variablelist"><table border="0">
406
<col align="left" valign="top">
410
<span class="term"><em class="parameter"><code>hash</code></em> :</span></td>
411
<td> The <a href="libedataserver-e-xml-hash-utils.html#EXmlHash"><span class="type">EXmlHash</span></a> to remove an entry from.
416
<span class="term"><em class="parameter"><code>key</code></em> :</span></td>
417
<td> The key of the entry to remove.
424
<div class="refsect2" lang="en">
425
<a name="id2598885"></a><h3>
426
<a name="e-xmlhash-compare"></a>e_xmlhash_compare ()</h3>
427
<a class="indexterm" name="id2598896"></a><pre class="programlisting"><a href="libedataserver-e-xml-hash-utils.html#EXmlHashStatus">EXmlHashStatus</a> e_xmlhash_compare (<a href="libedataserver-e-xml-hash-utils.html#EXmlHash">EXmlHash</a> *hash,
429
const char *compare_data);</pre>
431
Compares the value with key equal to <em class="parameter"><code>key</code></em> in <em class="parameter"><code>hash</code></em> against
432
<em class="parameter"><code>compare_data</code></em>.</p>
436
<div class="variablelist"><table border="0">
437
<col align="left" valign="top">
441
<span class="term"><em class="parameter"><code>hash</code></em> :</span></td>
442
<td> The <a href="libedataserver-e-xml-hash-utils.html#EXmlHash"><span class="type">EXmlHash</span></a> to compare against.
447
<span class="term"><em class="parameter"><code>key</code></em> :</span></td>
448
<td> The key of the hash entry to compare with.
453
<span class="term"><em class="parameter"><code>compare_data</code></em> :</span></td>
454
<td> The data to compare against the hash entry.
459
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
460
<td> E_XMLHASH_STATUS_SAME if the value and <em class="parameter"><code>compare_data</code></em> are
461
equal,E_XMLHASH_STATUS_DIFFERENT if they are different, or
462
E_XMLHASH_STATUS_NOT_FOUND if there is no entry in <em class="parameter"><code>hash</code></em> with
463
its key equal to <em class="parameter"><code>key</code></em>.
470
<div class="refsect2" lang="en">
471
<a name="id2599046"></a><h3>
472
<a name="e-xmlhash-foreach-key"></a>e_xmlhash_foreach_key ()</h3>
473
<a class="indexterm" name="id2599055"></a><pre class="programlisting">void e_xmlhash_foreach_key (<a href="libedataserver-e-xml-hash-utils.html#EXmlHash">EXmlHash</a> *hash,
474
<a href="libedataserver-e-xml-hash-utils.html#EXmlHashFunc">EXmlHashFunc</a> func,
476
href="../glib/glib-Basic-Types.html#gpointer"
477
>gpointer</a> user_data);</pre>
479
Executes <em class="parameter"><code>func</code></em> against each key/value pair in <em class="parameter"><code>hash</code></em>.</p>
483
<div class="variablelist"><table border="0">
484
<col align="left" valign="top">
488
<span class="term"><em class="parameter"><code>hash</code></em> :</span></td>
489
<td> An <a href="libedataserver-e-xml-hash-utils.html#EXmlHash"><span class="type">EXmlHash</span></a>.
494
<span class="term"><em class="parameter"><code>func</code></em> :</span></td>
495
<td> The <a href="libedataserver-e-xml-hash-utils.html#EXmlHashFunc"><span class="type">EXmlHashFunc</span></a> to execute on the data in <em class="parameter"><code>hash</code></em>.
500
<span class="term"><em class="parameter"><code>user_data</code></em> :</span></td>
501
<td> The data to pass to <em class="parameter"><code>func</code></em>.
508
<div class="refsect2" lang="en">
509
<a name="id2599185"></a><h3>
510
<a name="e-xmlhash-write"></a>e_xmlhash_write ()</h3>
511
<a class="indexterm" name="id2599195"></a><pre class="programlisting">void e_xmlhash_write (<a href="libedataserver-e-xml-hash-utils.html#EXmlHash">EXmlHash</a> *hash);</pre>
513
Writes the XML represented by <em class="parameter"><code>hash</code></em> to the file originally passed
514
to <a href="libedataserver-e-xml-hash-utils.html#e-xmlhash-new"><code class="function">e_xmlhash_new()</code></a>.</p>
518
<div class="variablelist"><table border="0">
519
<col align="left" valign="top">
522
<span class="term"><em class="parameter"><code>hash</code></em> :</span></td>
523
<td> The <a href="libedataserver-e-xml-hash-utils.html#EXmlHash"><span class="type">EXmlHash</span></a> to write.
529
<div class="refsect2" lang="en">
530
<a name="id2599268"></a><h3>
531
<a name="e-xmlhash-destroy"></a>e_xmlhash_destroy ()</h3>
532
<a class="indexterm" name="id2599278"></a><pre class="programlisting">void e_xmlhash_destroy (<a href="libedataserver-e-xml-hash-utils.html#EXmlHash">EXmlHash</a> *hash);</pre>
534
Frees the memory associated with <em class="parameter"><code>hash</code></em>.</p>
538
<div class="variablelist"><table border="0">
539
<col align="left" valign="top">
542
<span class="term"><em class="parameter"><code>hash</code></em> :</span></td>
543
<td> The <a href="libedataserver-e-xml-hash-utils.html#EXmlHash"><span class="type">EXmlHash</span></a> to destroy.