| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| 5 | <title>Hashes</title> |
| 6 | <meta name="generator" content="DocBook XSL Stylesheets V1.76.1"> |
| 7 | <link rel="home" href="index.html" title="Redland RDF Library Manual"> |
| 8 | <link rel="up" href="reference-manual.html" title="Part II. Reference Manual"> |
| 9 | <link rel="prev" href="redland-files.html" title="Files"> |
| 10 | <link rel="next" href="redland-heuristics.html" title="Heuristics"> |
| 11 | <meta name="generator" content="GTK-Doc V1.18 (XML mode)"> |
| 12 | <link rel="stylesheet" href="style.css" type="text/css"> |
| 13 | </head> |
| 14 | <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> |
| 15 | <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"> |
| 16 | <tr valign="middle"> |
| 17 | <td><a accesskey="p" href="redland-files.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td> |
| 18 | <td><a accesskey="u" href="reference-manual.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td> |
| 19 | <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td> |
| 20 | <th width="100%" align="center">Redland RDF Library Manual</th> |
| 21 | <td><a accesskey="n" href="redland-heuristics.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td> |
| 22 | </tr> |
| 23 | <tr><td colspan="5" class="shortcuts"> |
| 24 | <a href="#redland-hash.synopsis" class="shortcut">Top</a> |
| 25 | | |
| 26 | <a href="#redland-hash.description" class="shortcut">Description</a> |
| 27 | </td></tr> |
| 28 | </table> |
| 29 | <div class="refentry"> |
| 30 | <a name="redland-hash"></a><div class="titlepage"></div> |
| 31 | <div class="refnamediv"><table width="100%"><tr> |
| 32 | <td valign="top"> |
| 33 | <h2><span class="refentrytitle"><a name="redland-hash.top_of_page"></a>Hashes</span></h2> |
| 34 | <p>Hashes — Key:Value hashes or dictionaries.</p> |
| 35 | </td> |
| 36 | <td valign="top" align="right"></td> |
| 37 | </tr></table></div> |
| 38 | <div class="refsynopsisdiv"> |
| 39 | <a name="redland-hash.synopsis"></a><h2>Synopsis</h2> |
| 40 | <pre class="synopsis">typedef <a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash">librdf_hash</a>; |
| 41 | typedef <a class="link" href="redland-hash.html#librdf-hash-cursor" title="librdf_hash_cursor">librdf_hash_cursor</a>; |
| 42 | <a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="returnvalue">librdf_hash</span></a> * <a class="link" href="redland-hash.html#librdf-new-hash" title="librdf_new_hash ()">librdf_new_hash</a> (<em class="parameter"><code><a class="link" href="redland-world.html#librdf-world" title="librdf_world"><span class="type">librdf_world</span></a> *world</code></em>, |
| 43 | <em class="parameter"><code>const <span class="type">char</span> *name</code></em>); |
| 44 | <a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="returnvalue">librdf_hash</span></a> * <a class="link" href="redland-hash.html#librdf-new-hash-from-string" title="librdf_new_hash_from_string ()">librdf_new_hash_from_string</a> (<em class="parameter"><code><a class="link" href="redland-world.html#librdf-world" title="librdf_world"><span class="type">librdf_world</span></a> *world</code></em>, |
| 45 | <em class="parameter"><code>const <span class="type">char</span> *name</code></em>, |
| 46 | <em class="parameter"><code>const <span class="type">char</span> *string</code></em>); |
| 47 | <a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="returnvalue">librdf_hash</span></a> * <a class="link" href="redland-hash.html#librdf-new-hash-from-array-of-strings" title="librdf_new_hash_from_array_of_strings ()">librdf_new_hash_from_array_of_strings</a> |
| 48 | (<em class="parameter"><code><a class="link" href="redland-world.html#librdf-world" title="librdf_world"><span class="type">librdf_world</span></a> *world</code></em>, |
| 49 | <em class="parameter"><code>const <span class="type">char</span> *name</code></em>, |
| 50 | <em class="parameter"><code>const <span class="type">char</span> **array</code></em>); |
| 51 | <a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="returnvalue">librdf_hash</span></a> * <a class="link" href="redland-hash.html#librdf-new-hash-from-hash" title="librdf_new_hash_from_hash ()">librdf_new_hash_from_hash</a> (<em class="parameter"><code><a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="type">librdf_hash</span></a> *old_hash</code></em>); |
| 52 | <span class="returnvalue">void</span> <a class="link" href="redland-hash.html#librdf-free-hash" title="librdf_free_hash ()">librdf_free_hash</a> (<em class="parameter"><code><a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="type">librdf_hash</span></a> *hash</code></em>); |
| 53 | <span class="returnvalue">char</span> * <a class="link" href="redland-hash.html#librdf-hash-get" title="librdf_hash_get ()">librdf_hash_get</a> (<em class="parameter"><code><a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="type">librdf_hash</span></a> *hash</code></em>, |
| 54 | <em class="parameter"><code>const <span class="type">char</span> *key</code></em>); |
| 55 | <span class="returnvalue">int</span> <a class="link" href="redland-hash.html#librdf-hash-get-as-boolean" title="librdf_hash_get_as_boolean ()">librdf_hash_get_as_boolean</a> (<em class="parameter"><code><a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="type">librdf_hash</span></a> *hash</code></em>, |
| 56 | <em class="parameter"><code>const <span class="type">char</span> *key</code></em>); |
| 57 | <span class="returnvalue">long</span> <a class="link" href="redland-hash.html#librdf-hash-get-as-long" title="librdf_hash_get_as_long ()">librdf_hash_get_as_long</a> (<em class="parameter"><code><a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="type">librdf_hash</span></a> *hash</code></em>, |
| 58 | <em class="parameter"><code>const <span class="type">char</span> *key</code></em>); |
| 59 | <span class="returnvalue">char</span> * <a class="link" href="redland-hash.html#librdf-hash-get-del" title="librdf_hash_get_del ()">librdf_hash_get_del</a> (<em class="parameter"><code><a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="type">librdf_hash</span></a> *hash</code></em>, |
| 60 | <em class="parameter"><code>const <span class="type">char</span> *key</code></em>); |
| 61 | <span class="returnvalue">int</span> <a class="link" href="redland-hash.html#librdf-hash-put-strings" title="librdf_hash_put_strings ()">librdf_hash_put_strings</a> (<em class="parameter"><code><a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="type">librdf_hash</span></a> *hash</code></em>, |
| 62 | <em class="parameter"><code>const <span class="type">char</span> *key</code></em>, |
| 63 | <em class="parameter"><code>const <span class="type">char</span> *value</code></em>); |
| 64 | <span class="returnvalue">void</span> <a class="link" href="redland-hash.html#librdf-hash-print" title="librdf_hash_print ()">librdf_hash_print</a> (<em class="parameter"><code><a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="type">librdf_hash</span></a> *hash</code></em>, |
| 65 | <em class="parameter"><code><span class="type">FILE</span> *fh</code></em>); |
| 66 | <span class="returnvalue">void</span> <a class="link" href="redland-hash.html#librdf-hash-print-keys" title="librdf_hash_print_keys ()">librdf_hash_print_keys</a> (<em class="parameter"><code><a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="type">librdf_hash</span></a> *hash</code></em>, |
| 67 | <em class="parameter"><code><span class="type">FILE</span> *fh</code></em>); |
| 68 | <span class="returnvalue">void</span> <a class="link" href="redland-hash.html#librdf-hash-print-values" title="librdf_hash_print_values ()">librdf_hash_print_values</a> (<em class="parameter"><code><a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="type">librdf_hash</span></a> *hash</code></em>, |
| 69 | <em class="parameter"><code>const <span class="type">char</span> *key_string</code></em>, |
| 70 | <em class="parameter"><code><span class="type">FILE</span> *fh</code></em>); |
| 71 | unsigned <span class="returnvalue">char</span> * <a class="link" href="redland-hash.html#librdf-hash-interpret-template" title="librdf_hash_interpret_template ()">librdf_hash_interpret_template</a> (<em class="parameter"><code>const unsigned <span class="type">char</span> *template_string</code></em>, |
| 72 | <em class="parameter"><code><a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="type">librdf_hash</span></a> *dictionary</code></em>, |
| 73 | <em class="parameter"><code>const unsigned <span class="type">char</span> *prefix</code></em>, |
| 74 | <em class="parameter"><code>const unsigned <span class="type">char</span> *suffix</code></em>); |
| 75 | <span class="returnvalue">int</span> <a class="link" href="redland-hash.html#librdf-hash-from-string" title="librdf_hash_from_string ()">librdf_hash_from_string</a> (<em class="parameter"><code><a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="type">librdf_hash</span></a> *hash</code></em>, |
| 76 | <em class="parameter"><code>const <span class="type">char</span> *string</code></em>); |
| 77 | <span class="returnvalue">char</span> * <a class="link" href="redland-hash.html#librdf-hash-to-string" title="librdf_hash_to_string ()">librdf_hash_to_string</a> (<em class="parameter"><code><a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="type">librdf_hash</span></a> *hash</code></em>, |
| 78 | <em class="parameter"><code>const <span class="type">char</span> *filter[]</code></em>); |
| 79 | </pre> |
| 80 | </div> |
| 81 | <div class="refsect1"> |
| 82 | <a name="redland-hash.description"></a><h2>Description</h2> |
| 83 | <p> |
| 84 | Interface to implementations of key:value hashes either in memory, on |
| 85 | disk and with persistence. Keys may have multiple and duplicate values. |
| 86 | </p> |
| 87 | </div> |
| 88 | <div class="refsect1"> |
| 89 | <a name="redland-hash.details"></a><h2>Details</h2> |
| 90 | <div class="refsect2"> |
| 91 | <a name="librdf-hash"></a><h3>librdf_hash</h3> |
| 92 | <pre class="programlisting">typedef struct librdf_hash_s librdf_hash; |
| 93 | </pre> |
| 94 | <p> |
| 95 | Redland hash class. |
| 96 | </p> |
| 97 | </div> |
| 98 | <hr> |
| 99 | <div class="refsect2"> |
| 100 | <a name="librdf-hash-cursor"></a><h3>librdf_hash_cursor</h3> |
| 101 | <pre class="programlisting">typedef struct librdf_hash_cursor_s librdf_hash_cursor; |
| 102 | </pre> |
| 103 | <p> |
| 104 | Redland hash cursor class. |
| 105 | </p> |
| 106 | </div> |
| 107 | <hr> |
| 108 | <div class="refsect2"> |
| 109 | <a name="librdf-new-hash"></a><h3>librdf_new_hash ()</h3> |
| 110 | <pre class="programlisting"><a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="returnvalue">librdf_hash</span></a> * librdf_new_hash (<em class="parameter"><code><a class="link" href="redland-world.html#librdf-world" title="librdf_world"><span class="type">librdf_world</span></a> *world</code></em>, |
| 111 | <em class="parameter"><code>const <span class="type">char</span> *name</code></em>);</pre> |
| 112 | <p> |
| 113 | Constructor - create a new <a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="type">librdf_hash</span></a> object. |
| 114 | </p> |
| 115 | <div class="variablelist"><table border="0"> |
| 116 | <col align="left" valign="top"> |
| 117 | <tbody> |
| 118 | <tr> |
| 119 | <td><p><span class="term"><em class="parameter"><code>world</code></em> :</span></p></td> |
| 120 | <td>redland world object</td> |
| 121 | </tr> |
| 122 | <tr> |
| 123 | <td><p><span class="term"><em class="parameter"><code>name</code></em> :</span></p></td> |
| 124 | <td>factory name</td> |
| 125 | </tr> |
| 126 | <tr> |
| 127 | <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| 128 | <td>a new <a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="type">librdf_hash</span></a> object or NULL on failure</td> |
| 129 | </tr> |
| 130 | </tbody> |
| 131 | </table></div> |
| 132 | </div> |
| 133 | <hr> |
| 134 | <div class="refsect2"> |
| 135 | <a name="librdf-new-hash-from-string"></a><h3>librdf_new_hash_from_string ()</h3> |
| 136 | <pre class="programlisting"><a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="returnvalue">librdf_hash</span></a> * librdf_new_hash_from_string (<em class="parameter"><code><a class="link" href="redland-world.html#librdf-world" title="librdf_world"><span class="type">librdf_world</span></a> *world</code></em>, |
| 137 | <em class="parameter"><code>const <span class="type">char</span> *name</code></em>, |
| 138 | <em class="parameter"><code>const <span class="type">char</span> *string</code></em>);</pre> |
| 139 | <p> |
| 140 | Constructor - create a new <a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="type">librdf_hash</span></a> object from a string. |
| 141 | </p> |
| 142 | <p> |
| 143 | See <a class="link" href="redland-hash.html#librdf-hash-from-string" title="librdf_hash_from_string ()"><span class="type">librdf_hash_from_string</span></a> for the string format. |
| 144 | </p> |
| 145 | <div class="variablelist"><table border="0"> |
| 146 | <col align="left" valign="top"> |
| 147 | <tbody> |
| 148 | <tr> |
| 149 | <td><p><span class="term"><em class="parameter"><code>world</code></em> :</span></p></td> |
| 150 | <td>redland world object</td> |
| 151 | </tr> |
| 152 | <tr> |
| 153 | <td><p><span class="term"><em class="parameter"><code>name</code></em> :</span></p></td> |
| 154 | <td>hash name</td> |
| 155 | </tr> |
| 156 | <tr> |
| 157 | <td><p><span class="term"><em class="parameter"><code>string</code></em> :</span></p></td> |
| 158 | <td>hash encoded as a string</td> |
| 159 | </tr> |
| 160 | <tr> |
| 161 | <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| 162 | <td>a new <a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="type">librdf_hash</span></a> object or NULL on failure</td> |
| 163 | </tr> |
| 164 | </tbody> |
| 165 | </table></div> |
| 166 | </div> |
| 167 | <hr> |
| 168 | <div class="refsect2"> |
| 169 | <a name="librdf-new-hash-from-array-of-strings"></a><h3>librdf_new_hash_from_array_of_strings ()</h3> |
| 170 | <pre class="programlisting"><a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="returnvalue">librdf_hash</span></a> * librdf_new_hash_from_array_of_strings |
| 171 | (<em class="parameter"><code><a class="link" href="redland-world.html#librdf-world" title="librdf_world"><span class="type">librdf_world</span></a> *world</code></em>, |
| 172 | <em class="parameter"><code>const <span class="type">char</span> *name</code></em>, |
| 173 | <em class="parameter"><code>const <span class="type">char</span> **array</code></em>);</pre> |
| 174 | <p> |
| 175 | Constructor - create a new <a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="type">librdf_hash</span></a> object from an array of strings. |
| 176 | </p> |
| 177 | <div class="variablelist"><table border="0"> |
| 178 | <col align="left" valign="top"> |
| 179 | <tbody> |
| 180 | <tr> |
| 181 | <td><p><span class="term"><em class="parameter"><code>world</code></em> :</span></p></td> |
| 182 | <td>redland world object</td> |
| 183 | </tr> |
| 184 | <tr> |
| 185 | <td><p><span class="term"><em class="parameter"><code>name</code></em> :</span></p></td> |
| 186 | <td>hash name</td> |
| 187 | </tr> |
| 188 | <tr> |
| 189 | <td><p><span class="term"><em class="parameter"><code>array</code></em> :</span></p></td> |
| 190 | <td>address of the start of the array of char* pointers</td> |
| 191 | </tr> |
| 192 | <tr> |
| 193 | <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| 194 | <td>a new <a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="type">librdf_hash</span></a> object or NULL on failure</td> |
| 195 | </tr> |
| 196 | </tbody> |
| 197 | </table></div> |
| 198 | </div> |
| 199 | <hr> |
| 200 | <div class="refsect2"> |
| 201 | <a name="librdf-new-hash-from-hash"></a><h3>librdf_new_hash_from_hash ()</h3> |
| 202 | <pre class="programlisting"><a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="returnvalue">librdf_hash</span></a> * librdf_new_hash_from_hash (<em class="parameter"><code><a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="type">librdf_hash</span></a> *old_hash</code></em>);</pre> |
| 203 | <p> |
| 204 | Copy Constructor - create a new <a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="type">librdf_hash</span></a> object from an existing one. |
| 205 | </p> |
| 206 | <div class="variablelist"><table border="0"> |
| 207 | <col align="left" valign="top"> |
| 208 | <tbody> |
| 209 | <tr> |
| 210 | <td><p><span class="term"><em class="parameter"><code>old_hash</code></em> :</span></p></td> |
| 211 | <td>the hash to use to construct the hash</td> |
| 212 | </tr> |
| 213 | <tr> |
| 214 | <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| 215 | <td>a new <a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="type">librdf_hash</span></a> object or NULL on failure</td> |
| 216 | </tr> |
| 217 | </tbody> |
| 218 | </table></div> |
| 219 | </div> |
| 220 | <hr> |
| 221 | <div class="refsect2"> |
| 222 | <a name="librdf-free-hash"></a><h3>librdf_free_hash ()</h3> |
| 223 | <pre class="programlisting"><span class="returnvalue">void</span> librdf_free_hash (<em class="parameter"><code><a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="type">librdf_hash</span></a> *hash</code></em>);</pre> |
| 224 | <p> |
| 225 | Destructor - destroy a <a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="type">librdf_hash</span></a> object. |
| 226 | </p> |
| 227 | <div class="variablelist"><table border="0"> |
| 228 | <col align="left" valign="top"> |
| 229 | <tbody><tr> |
| 230 | <td><p><span class="term"><em class="parameter"><code>hash</code></em> :</span></p></td> |
| 231 | <td>hash object</td> |
| 232 | </tr></tbody> |
| 233 | </table></div> |
| 234 | </div> |
| 235 | <hr> |
| 236 | <div class="refsect2"> |
| 237 | <a name="librdf-hash-get"></a><h3>librdf_hash_get ()</h3> |
| 238 | <pre class="programlisting"><span class="returnvalue">char</span> * librdf_hash_get (<em class="parameter"><code><a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="type">librdf_hash</span></a> *hash</code></em>, |
| 239 | <em class="parameter"><code>const <span class="type">char</span> *key</code></em>);</pre> |
| 240 | <p> |
| 241 | Retrieve one value from hash for a given key as string. |
| 242 | </p> |
| 243 | <p> |
| 244 | The value returned is from newly allocated memory which the |
| 245 | caller must free. |
| 246 | </p> |
| 247 | <div class="variablelist"><table border="0"> |
| 248 | <col align="left" valign="top"> |
| 249 | <tbody> |
| 250 | <tr> |
| 251 | <td><p><span class="term"><em class="parameter"><code>hash</code></em> :</span></p></td> |
| 252 | <td>hash object</td> |
| 253 | </tr> |
| 254 | <tr> |
| 255 | <td><p><span class="term"><em class="parameter"><code>key</code></em> :</span></p></td> |
| 256 | <td>pointer to key</td> |
| 257 | </tr> |
| 258 | <tr> |
| 259 | <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| 260 | <td>the value or NULL on failure</td> |
| 261 | </tr> |
| 262 | </tbody> |
| 263 | </table></div> |
| 264 | </div> |
| 265 | <hr> |
| 266 | <div class="refsect2"> |
| 267 | <a name="librdf-hash-get-as-boolean"></a><h3>librdf_hash_get_as_boolean ()</h3> |
| 268 | <pre class="programlisting"><span class="returnvalue">int</span> librdf_hash_get_as_boolean (<em class="parameter"><code><a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="type">librdf_hash</span></a> *hash</code></em>, |
| 269 | <em class="parameter"><code>const <span class="type">char</span> *key</code></em>);</pre> |
| 270 | <p> |
| 271 | Lookup a hash key and decode value as a boolean. |
| 272 | </p> |
| 273 | <p> |
| 274 | False values: "no", "false" |
| 275 | True values: "yes", "true" |
| 276 | </p> |
| 277 | <div class="variablelist"><table border="0"> |
| 278 | <col align="left" valign="top"> |
| 279 | <tbody> |
| 280 | <tr> |
| 281 | <td><p><span class="term"><em class="parameter"><code>hash</code></em> :</span></p></td> |
| 282 | <td> |
| 283 | <a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="type">librdf_hash</span></a> object</td> |
| 284 | </tr> |
| 285 | <tr> |
| 286 | <td><p><span class="term"><em class="parameter"><code>key</code></em> :</span></p></td> |
| 287 | <td>key string to look up</td> |
| 288 | </tr> |
| 289 | <tr> |
| 290 | <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| 291 | <td>>0 (for true), 0 (for false) or <0 (for key not found or not known boolean value)</td> |
| 292 | </tr> |
| 293 | </tbody> |
| 294 | </table></div> |
| 295 | </div> |
| 296 | <hr> |
| 297 | <div class="refsect2"> |
| 298 | <a name="librdf-hash-get-as-long"></a><h3>librdf_hash_get_as_long ()</h3> |
| 299 | <pre class="programlisting"><span class="returnvalue">long</span> librdf_hash_get_as_long (<em class="parameter"><code><a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="type">librdf_hash</span></a> *hash</code></em>, |
| 300 | <em class="parameter"><code>const <span class="type">char</span> *key</code></em>);</pre> |
| 301 | <p> |
| 302 | Lookup a hash key and decode value as a long. |
| 303 | </p> |
| 304 | <div class="variablelist"><table border="0"> |
| 305 | <col align="left" valign="top"> |
| 306 | <tbody> |
| 307 | <tr> |
| 308 | <td><p><span class="term"><em class="parameter"><code>hash</code></em> :</span></p></td> |
| 309 | <td> |
| 310 | <a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="type">librdf_hash</span></a> object</td> |
| 311 | </tr> |
| 312 | <tr> |
| 313 | <td><p><span class="term"><em class="parameter"><code>key</code></em> :</span></p></td> |
| 314 | <td>key string to look up</td> |
| 315 | </tr> |
| 316 | <tr> |
| 317 | <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| 318 | <td>>0 (for success), <0 (for key not found or not known boolean value)</td> |
| 319 | </tr> |
| 320 | </tbody> |
| 321 | </table></div> |
| 322 | </div> |
| 323 | <hr> |
| 324 | <div class="refsect2"> |
| 325 | <a name="librdf-hash-get-del"></a><h3>librdf_hash_get_del ()</h3> |
| 326 | <pre class="programlisting"><span class="returnvalue">char</span> * librdf_hash_get_del (<em class="parameter"><code><a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="type">librdf_hash</span></a> *hash</code></em>, |
| 327 | <em class="parameter"><code>const <span class="type">char</span> *key</code></em>);</pre> |
| 328 | <p> |
| 329 | Retrieve one value from hash for a given key as string and remove all values with that key. |
| 330 | </p> |
| 331 | <p> |
| 332 | The value returned is from newly allocated memory which the |
| 333 | caller must free. |
| 334 | </p> |
| 335 | <div class="variablelist"><table border="0"> |
| 336 | <col align="left" valign="top"> |
| 337 | <tbody> |
| 338 | <tr> |
| 339 | <td><p><span class="term"><em class="parameter"><code>hash</code></em> :</span></p></td> |
| 340 | <td>hash object</td> |
| 341 | </tr> |
| 342 | <tr> |
| 343 | <td><p><span class="term"><em class="parameter"><code>key</code></em> :</span></p></td> |
| 344 | <td>pointer to key</td> |
| 345 | </tr> |
| 346 | <tr> |
| 347 | <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| 348 | <td>the value or NULL on failure</td> |
| 349 | </tr> |
| 350 | </tbody> |
| 351 | </table></div> |
| 352 | </div> |
| 353 | <hr> |
| 354 | <div class="refsect2"> |
| 355 | <a name="librdf-hash-put-strings"></a><h3>librdf_hash_put_strings ()</h3> |
| 356 | <pre class="programlisting"><span class="returnvalue">int</span> librdf_hash_put_strings (<em class="parameter"><code><a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="type">librdf_hash</span></a> *hash</code></em>, |
| 357 | <em class="parameter"><code>const <span class="type">char</span> *key</code></em>, |
| 358 | <em class="parameter"><code>const <span class="type">char</span> *value</code></em>);</pre> |
| 359 | <p> |
| 360 | Insert key/value pairs into the hash as strings. |
| 361 | </p> |
| 362 | <p> |
| 363 | The key and values are copied into the hash, no sharing i s done. |
| 364 | </p> |
| 365 | <div class="variablelist"><table border="0"> |
| 366 | <col align="left" valign="top"> |
| 367 | <tbody> |
| 368 | <tr> |
| 369 | <td><p><span class="term"><em class="parameter"><code>hash</code></em> :</span></p></td> |
| 370 | <td>hash object</td> |
| 371 | </tr> |
| 372 | <tr> |
| 373 | <td><p><span class="term"><em class="parameter"><code>key</code></em> :</span></p></td> |
| 374 | <td>key</td> |
| 375 | </tr> |
| 376 | <tr> |
| 377 | <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| 378 | <td>value</td> |
| 379 | </tr> |
| 380 | <tr> |
| 381 | <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| 382 | <td>non 0 on failure</td> |
| 383 | </tr> |
| 384 | </tbody> |
| 385 | </table></div> |
| 386 | </div> |
| 387 | <hr> |
| 388 | <div class="refsect2"> |
| 389 | <a name="librdf-hash-print"></a><h3>librdf_hash_print ()</h3> |
| 390 | <pre class="programlisting"><span class="returnvalue">void</span> librdf_hash_print (<em class="parameter"><code><a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="type">librdf_hash</span></a> *hash</code></em>, |
| 391 | <em class="parameter"><code><span class="type">FILE</span> *fh</code></em>);</pre> |
| 392 | <p> |
| 393 | Pretty print the hash to a file descriptor. |
| 394 | </p> |
| 395 | <div class="variablelist"><table border="0"> |
| 396 | <col align="left" valign="top"> |
| 397 | <tbody> |
| 398 | <tr> |
| 399 | <td><p><span class="term"><em class="parameter"><code>hash</code></em> :</span></p></td> |
| 400 | <td>the hash</td> |
| 401 | </tr> |
| 402 | <tr> |
| 403 | <td><p><span class="term"><em class="parameter"><code>fh</code></em> :</span></p></td> |
| 404 | <td>file handle</td> |
| 405 | </tr> |
| 406 | </tbody> |
| 407 | </table></div> |
| 408 | </div> |
| 409 | <hr> |
| 410 | <div class="refsect2"> |
| 411 | <a name="librdf-hash-print-keys"></a><h3>librdf_hash_print_keys ()</h3> |
| 412 | <pre class="programlisting"><span class="returnvalue">void</span> librdf_hash_print_keys (<em class="parameter"><code><a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="type">librdf_hash</span></a> *hash</code></em>, |
| 413 | <em class="parameter"><code><span class="type">FILE</span> *fh</code></em>);</pre> |
| 414 | <p> |
| 415 | Pretty print the keys to a file descriptor. |
| 416 | </p> |
| 417 | <div class="variablelist"><table border="0"> |
| 418 | <col align="left" valign="top"> |
| 419 | <tbody> |
| 420 | <tr> |
| 421 | <td><p><span class="term"><em class="parameter"><code>hash</code></em> :</span></p></td> |
| 422 | <td>the hash</td> |
| 423 | </tr> |
| 424 | <tr> |
| 425 | <td><p><span class="term"><em class="parameter"><code>fh</code></em> :</span></p></td> |
| 426 | <td>file handle</td> |
| 427 | </tr> |
| 428 | </tbody> |
| 429 | </table></div> |
| 430 | </div> |
| 431 | <hr> |
| 432 | <div class="refsect2"> |
| 433 | <a name="librdf-hash-print-values"></a><h3>librdf_hash_print_values ()</h3> |
| 434 | <pre class="programlisting"><span class="returnvalue">void</span> librdf_hash_print_values (<em class="parameter"><code><a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="type">librdf_hash</span></a> *hash</code></em>, |
| 435 | <em class="parameter"><code>const <span class="type">char</span> *key_string</code></em>, |
| 436 | <em class="parameter"><code><span class="type">FILE</span> *fh</code></em>);</pre> |
| 437 | <p> |
| 438 | Pretty print the values of one key to a file descriptor. |
| 439 | </p> |
| 440 | <div class="variablelist"><table border="0"> |
| 441 | <col align="left" valign="top"> |
| 442 | <tbody> |
| 443 | <tr> |
| 444 | <td><p><span class="term"><em class="parameter"><code>hash</code></em> :</span></p></td> |
| 445 | <td>the hash</td> |
| 446 | </tr> |
| 447 | <tr> |
| 448 | <td><p><span class="term"><em class="parameter"><code>key_string</code></em> :</span></p></td> |
| 449 | <td>the key as a string</td> |
| 450 | </tr> |
| 451 | <tr> |
| 452 | <td><p><span class="term"><em class="parameter"><code>fh</code></em> :</span></p></td> |
| 453 | <td>file handle</td> |
| 454 | </tr> |
| 455 | </tbody> |
| 456 | </table></div> |
| 457 | </div> |
| 458 | <hr> |
| 459 | <div class="refsect2"> |
| 460 | <a name="librdf-hash-interpret-template"></a><h3>librdf_hash_interpret_template ()</h3> |
| 461 | <pre class="programlisting">unsigned <span class="returnvalue">char</span> * librdf_hash_interpret_template (<em class="parameter"><code>const unsigned <span class="type">char</span> *template_string</code></em>, |
| 462 | <em class="parameter"><code><a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="type">librdf_hash</span></a> *dictionary</code></em>, |
| 463 | <em class="parameter"><code>const unsigned <span class="type">char</span> *prefix</code></em>, |
| 464 | <em class="parameter"><code>const unsigned <span class="type">char</span> *suffix</code></em>);</pre> |
| 465 | <p> |
| 466 | Interpret keys in a template string to their value in a dictionary. |
| 467 | </p> |
| 468 | <p> |
| 469 | Can be used to do variable substitution for a string where |
| 470 | the syntax that marks the variable is defined by the <em class="parameter"><code>prefix</code></em> |
| 471 | and <em class="parameter"><code>suffix</code></em> strings, and the variables are stored in the <em class="parameter"><code>dictionary</code></em> |
| 472 | hash table. |
| 473 | </p> |
| 474 | <div class="variablelist"><table border="0"> |
| 475 | <col align="left" valign="top"> |
| 476 | <tbody> |
| 477 | <tr> |
| 478 | <td><p><span class="term"><em class="parameter"><code>template_string</code></em> :</span></p></td> |
| 479 | <td>template string to interprate</td> |
| 480 | </tr> |
| 481 | <tr> |
| 482 | <td><p><span class="term"><em class="parameter"><code>dictionary</code></em> :</span></p></td> |
| 483 | <td>dictionary of key/values to substitute</td> |
| 484 | </tr> |
| 485 | <tr> |
| 486 | <td><p><span class="term"><em class="parameter"><code>prefix</code></em> :</span></p></td> |
| 487 | <td>prefix to mark a key in the template</td> |
| 488 | </tr> |
| 489 | <tr> |
| 490 | <td><p><span class="term"><em class="parameter"><code>suffix</code></em> :</span></p></td> |
| 491 | <td>suffix to mark a key in the template</td> |
| 492 | </tr> |
| 493 | <tr> |
| 494 | <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| 495 | <td>Newly allocated string, or NULL on failure</td> |
| 496 | </tr> |
| 497 | </tbody> |
| 498 | </table></div> |
| 499 | </div> |
| 500 | <hr> |
| 501 | <div class="refsect2"> |
| 502 | <a name="librdf-hash-from-string"></a><h3>librdf_hash_from_string ()</h3> |
| 503 | <pre class="programlisting"><span class="returnvalue">int</span> librdf_hash_from_string (<em class="parameter"><code><a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="type">librdf_hash</span></a> *hash</code></em>, |
| 504 | <em class="parameter"><code>const <span class="type">char</span> *string</code></em>);</pre> |
| 505 | <p> |
| 506 | Initialise a hash from a string. |
| 507 | </p> |
| 508 | <p> |
| 509 | The string format is something like: |
| 510 | key1='value1',key2='value2', key3='\'quoted value\'' |
| 511 | </p> |
| 512 | <p> |
| 513 | The 's are required and whitespace can appear around the = and ,s |
| 514 | </p> |
| 515 | <div class="variablelist"><table border="0"> |
| 516 | <col align="left" valign="top"> |
| 517 | <tbody> |
| 518 | <tr> |
| 519 | <td><p><span class="term"><em class="parameter"><code>hash</code></em> :</span></p></td> |
| 520 | <td>hash object</td> |
| 521 | </tr> |
| 522 | <tr> |
| 523 | <td><p><span class="term"><em class="parameter"><code>string</code></em> :</span></p></td> |
| 524 | <td>hash encoded as a string</td> |
| 525 | </tr> |
| 526 | <tr> |
| 527 | <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| 528 | <td>non 0 on failure</td> |
| 529 | </tr> |
| 530 | </tbody> |
| 531 | </table></div> |
| 532 | </div> |
| 533 | <hr> |
| 534 | <div class="refsect2"> |
| 535 | <a name="librdf-hash-to-string"></a><h3>librdf_hash_to_string ()</h3> |
| 536 | <pre class="programlisting"><span class="returnvalue">char</span> * librdf_hash_to_string (<em class="parameter"><code><a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="type">librdf_hash</span></a> *hash</code></em>, |
| 537 | <em class="parameter"><code>const <span class="type">char</span> *filter[]</code></em>);</pre> |
| 538 | <p> |
| 539 | Format the hash as a string, suitable for parsing by librdf_hash_from_string. |
| 540 | </p> |
| 541 | <p> |
| 542 | Note: this method allocates a new string since this is a _to_ method |
| 543 | and the caller must call <a class="link" href="redland-general.html#librdf-free-memory" title="librdf_free_memory ()"><code class="function">librdf_free_memory()</code></a> to free the resulting memory. |
| 544 | </p> |
| 545 | <div class="variablelist"><table border="0"> |
| 546 | <col align="left" valign="top"> |
| 547 | <tbody> |
| 548 | <tr> |
| 549 | <td><p><span class="term"><em class="parameter"><code>hash</code></em> :</span></p></td> |
| 550 | <td> |
| 551 | <a class="link" href="redland-hash.html#librdf-hash" title="librdf_hash"><span class="type">librdf_hash</span></a> object</td> |
| 552 | </tr> |
| 553 | <tr> |
| 554 | <td><p><span class="term"><em class="parameter"><code>filter</code></em> :</span></p></td> |
| 555 | <td>NULL terminated list of keys to ignore</td> |
| 556 | </tr> |
| 557 | <tr> |
| 558 | <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| 559 | <td>string representation of the hash or NULL on failure</td> |
| 560 | </tr> |
| 561 | </tbody> |
| 562 | </table></div> |
| 563 | </div> |
| 564 | </div> |
| 565 | </div> |
| 566 | <div class="footer"> |
| 567 | <hr> |
| 568 | Generated by GTK-Doc V1.18</div> |
| 569 | </body> |
| 570 | </html> |