Debian Codegraph @

docs/html/redland-list.html

raw symbols SCIP
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>List</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-iterator.html" title="Iterator">
10 <link rel="next" href="redland-log.html" title="Logging">
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-iterator.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-log.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-list.synopsis" class="shortcut">Top</a>
25  | 
26 <a href="#redland-list.description" class="shortcut">Description</a>
27 </td></tr>
28 </table>
29 <div class="refentry">
30 <a name="redland-list"></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-list.top_of_page"></a>List</span></h2>
34 <p>List — Simple list class.</p>
35 </td>
36 <td valign="top" align="right"></td>
37 </tr></table></div>
38 <div class="refsynopsisdiv">
39 <a name="redland-list.synopsis"></a><h2>Synopsis</h2>
40 <pre class="synopsis">typedef <a class="link" href="redland-list.html#librdf-list" title="librdf_list">librdf_list</a>;
41 <a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="returnvalue">librdf_list</span></a> * <a class="link" href="redland-list.html#librdf-new-list" title="librdf_new_list ()">librdf_new_list</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>);
42 <span class="returnvalue">void</span> <a class="link" href="redland-list.html#librdf-free-list" title="librdf_free_list ()">librdf_free_list</a> (<em class="parameter"><code><a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="type">librdf_list</span></a> *list</code></em>);
43 <span class="returnvalue">void</span> <a class="link" href="redland-list.html#librdf-list-clear" title="librdf_list_clear ()">librdf_list_clear</a> (<em class="parameter"><code><a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="type">librdf_list</span></a> *list</code></em>);
44 <span class="returnvalue">int</span> <a class="link" href="redland-list.html#librdf-list-add" title="librdf_list_add ()">librdf_list_add</a> (<em class="parameter"><code><a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="type">librdf_list</span></a> *list</code></em>,
45 <em class="parameter"><code><span class="type">void</span> *data</code></em>);
46 <span class="returnvalue">int</span> <a class="link" href="redland-list.html#librdf-list-unshift" title="librdf_list_unshift ()">librdf_list_unshift</a> (<em class="parameter"><code><a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="type">librdf_list</span></a> *list</code></em>,
47 <em class="parameter"><code><span class="type">void</span> *data</code></em>);
48 <span class="returnvalue">void</span> * <a class="link" href="redland-list.html#librdf-list-shift" title="librdf_list_shift ()">librdf_list_shift</a> (<em class="parameter"><code><a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="type">librdf_list</span></a> *list</code></em>);
49 <span class="returnvalue">void</span> * <a class="link" href="redland-list.html#librdf-list-pop" title="librdf_list_pop ()">librdf_list_pop</a> (<em class="parameter"><code><a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="type">librdf_list</span></a> *list</code></em>);
50 <span class="returnvalue">void</span> * <a class="link" href="redland-list.html#librdf-list-remove" title="librdf_list_remove ()">librdf_list_remove</a> (<em class="parameter"><code><a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="type">librdf_list</span></a> *list</code></em>,
51 <em class="parameter"><code><span class="type">void</span> *data</code></em>);
52 <span class="returnvalue">int</span> <a class="link" href="redland-list.html#librdf-list-contains" title="librdf_list_contains ()">librdf_list_contains</a> (<em class="parameter"><code><a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="type">librdf_list</span></a> *list</code></em>,
53 <em class="parameter"><code><span class="type">void</span> *data</code></em>);
54 <span class="returnvalue">int</span> <a class="link" href="redland-list.html#librdf-list-size" title="librdf_list_size ()">librdf_list_size</a> (<em class="parameter"><code><a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="type">librdf_list</span></a> *list</code></em>);
55 <span class="returnvalue">void</span> <a class="link" href="redland-list.html#librdf-list-set-equals" title="librdf_list_set_equals ()">librdf_list_set_equals</a> (<em class="parameter"><code><a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="type">librdf_list</span></a> *list</code></em>,
56 <em class="parameter"><code><span class="type">int</span> (*equals) (void* data1, void *data2)</code></em>);
57 <a class="link" href="redland-iterator.html#librdf-iterator" title="librdf_iterator"><span class="returnvalue">librdf_iterator</span></a> * <a class="link" href="redland-list.html#librdf-list-get-iterator" title="librdf_list_get_iterator ()">librdf_list_get_iterator</a> (<em class="parameter"><code><a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="type">librdf_list</span></a> *list</code></em>);
58 <span class="returnvalue">void</span> <a class="link" href="redland-list.html#librdf-list-foreach" title="librdf_list_foreach ()">librdf_list_foreach</a> (<em class="parameter"><code><a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="type">librdf_list</span></a> *list</code></em>,
59 <em class="parameter"><code><span class="type">void</span> (*fn) (void *, void *)</code></em>,
60 <em class="parameter"><code><span class="type">void</span> *user_data</code></em>);
61 </pre>
62 </div>
63 <div class="refsect1">
64 <a name="redland-list.description"></a><h2>Description</h2>
65 <p>
66 A simple list class used internally.
67 </p>
68 </div>
69 <div class="refsect1">
70 <a name="redland-list.details"></a><h2>Details</h2>
71 <div class="refsect2">
72 <a name="librdf-list"></a><h3>librdf_list</h3>
73 <pre class="programlisting">typedef struct librdf_list_s librdf_list;
74 </pre>
75 <p>
76 Redland list class.
77 </p>
78 </div>
79 <hr>
80 <div class="refsect2">
81 <a name="librdf-new-list"></a><h3>librdf_new_list ()</h3>
82 <pre class="programlisting"><a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="returnvalue">librdf_list</span></a> * librdf_new_list (<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>);</pre>
83 <p>
84 Constructor - create a new <a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="type">librdf_list</span></a>.
85 </p>
86 <div class="variablelist"><table border="0">
87 <col align="left" valign="top">
88 <tbody>
89 <tr>
90 <td><p><span class="term"><em class="parameter"><code>world</code></em> :</span></p></td>
91 <td>redland world object</td>
92 </tr>
93 <tr>
94 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
95 <td>a new <a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="type">librdf_list</span></a> or NULL on failure</td>
96 </tr>
97 </tbody>
98 </table></div>
99 </div>
100 <hr>
101 <div class="refsect2">
102 <a name="librdf-free-list"></a><h3>librdf_free_list ()</h3>
103 <pre class="programlisting"><span class="returnvalue">void</span> librdf_free_list (<em class="parameter"><code><a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="type">librdf_list</span></a> *list</code></em>);</pre>
104 <p>
105 Destructor - destroy a <a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="type">librdf_list</span></a> object.
106 </p>
107 <div class="variablelist"><table border="0">
108 <col align="left" valign="top">
109 <tbody><tr>
110 <td><p><span class="term"><em class="parameter"><code>list</code></em> :</span></p></td>
111 <td>
112 <a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="type">librdf_list</span></a> object</td>
113 </tr></tbody>
114 </table></div>
115 </div>
116 <hr>
117 <div class="refsect2">
118 <a name="librdf-list-clear"></a><h3>librdf_list_clear ()</h3>
119 <pre class="programlisting"><span class="returnvalue">void</span> librdf_list_clear (<em class="parameter"><code><a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="type">librdf_list</span></a> *list</code></em>);</pre>
120 <p>
121 Empty an librdf_list.
122 </p>
123 <div class="variablelist"><table border="0">
124 <col align="left" valign="top">
125 <tbody><tr>
126 <td><p><span class="term"><em class="parameter"><code>list</code></em> :</span></p></td>
127 <td>
128 <a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="type">librdf_list</span></a> object</td>
129 </tr></tbody>
130 </table></div>
131 </div>
132 <hr>
133 <div class="refsect2">
134 <a name="librdf-list-add"></a><h3>librdf_list_add ()</h3>
135 <pre class="programlisting"><span class="returnvalue">int</span> librdf_list_add (<em class="parameter"><code><a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="type">librdf_list</span></a> *list</code></em>,
136 <em class="parameter"><code><span class="type">void</span> *data</code></em>);</pre>
137 <p>
138 Add a data item to the end of a librdf_list.
139 </p>
140 <p>
141 Equivalent to the list 'push' notion, thus if <a class="link" href="redland-list.html#librdf-list-pop" title="librdf_list_pop ()"><code class="function">librdf_list_pop()</code></a>
142 is called after this, it will return the value added here.
143 </p>
144 <div class="variablelist"><table border="0">
145 <col align="left" valign="top">
146 <tbody>
147 <tr>
148 <td><p><span class="term"><em class="parameter"><code>list</code></em> :</span></p></td>
149 <td>
150 <a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="type">librdf_list</span></a> object</td>
151 </tr>
152 <tr>
153 <td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
154 <td>the data value</td>
155 </tr>
156 <tr>
157 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
158 <td>non 0 on failure</td>
159 </tr>
160 </tbody>
161 </table></div>
162 </div>
163 <hr>
164 <div class="refsect2">
165 <a name="librdf-list-unshift"></a><h3>librdf_list_unshift ()</h3>
166 <pre class="programlisting"><span class="returnvalue">int</span> librdf_list_unshift (<em class="parameter"><code><a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="type">librdf_list</span></a> *list</code></em>,
167 <em class="parameter"><code><span class="type">void</span> *data</code></em>);</pre>
168 <p>
169 Add a data item to the start of a librdf_list.
170 </p>
171 <p>
172 if <a class="link" href="redland-list.html#librdf-list-shift" title="librdf_list_shift ()"><code class="function">librdf_list_shift()</code></a> is called after this, it will return the value
173 added here.
174 </p>
175 <div class="variablelist"><table border="0">
176 <col align="left" valign="top">
177 <tbody>
178 <tr>
179 <td><p><span class="term"><em class="parameter"><code>list</code></em> :</span></p></td>
180 <td>
181 <a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="type">librdf_list</span></a> object</td>
182 </tr>
183 <tr>
184 <td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
185 <td>the data value</td>
186 </tr>
187 <tr>
188 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
189 <td>non 0 on failure</td>
190 </tr>
191 </tbody>
192 </table></div>
193 </div>
194 <hr>
195 <div class="refsect2">
196 <a name="librdf-list-shift"></a><h3>librdf_list_shift ()</h3>
197 <pre class="programlisting"><span class="returnvalue">void</span> * librdf_list_shift (<em class="parameter"><code><a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="type">librdf_list</span></a> *list</code></em>);</pre>
198 <p>
199 Remove and return the data at the start of the list.
200 </p>
201 <div class="variablelist"><table border="0">
202 <col align="left" valign="top">
203 <tbody>
204 <tr>
205 <td><p><span class="term"><em class="parameter"><code>list</code></em> :</span></p></td>
206 <td>
207 <a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="type">librdf_list</span></a> object</td>
208 </tr>
209 <tr>
210 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
211 <td>the data object or NULL if the list is empty</td>
212 </tr>
213 </tbody>
214 </table></div>
215 </div>
216 <hr>
217 <div class="refsect2">
218 <a name="librdf-list-pop"></a><h3>librdf_list_pop ()</h3>
219 <pre class="programlisting"><span class="returnvalue">void</span> * librdf_list_pop (<em class="parameter"><code><a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="type">librdf_list</span></a> *list</code></em>);</pre>
220 <p>
221 Remove and return the data at the end of the list.
222 </p>
223 <div class="variablelist"><table border="0">
224 <col align="left" valign="top">
225 <tbody>
226 <tr>
227 <td><p><span class="term"><em class="parameter"><code>list</code></em> :</span></p></td>
228 <td>
229 <a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="type">librdf_list</span></a> object</td>
230 </tr>
231 <tr>
232 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
233 <td>the data object or NULL if the list is empty</td>
234 </tr>
235 </tbody>
236 </table></div>
237 </div>
238 <hr>
239 <div class="refsect2">
240 <a name="librdf-list-remove"></a><h3>librdf_list_remove ()</h3>
241 <pre class="programlisting"><span class="returnvalue">void</span> * librdf_list_remove (<em class="parameter"><code><a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="type">librdf_list</span></a> *list</code></em>,
242 <em class="parameter"><code><span class="type">void</span> *data</code></em>);</pre>
243 <p>
244 Remove a data item from an librdf_list.
245 </p>
246 <p>
247 The search is done using the 'equals' function which may be set
248 by <a class="link" href="redland-list.html#librdf-list-set-equals" title="librdf_list_set_equals ()"><code class="function">librdf_list_set_equals()</code></a> or by straight comparison of pointers
249 if not set.
250 </p>
251 <div class="variablelist"><table border="0">
252 <col align="left" valign="top">
253 <tbody>
254 <tr>
255 <td><p><span class="term"><em class="parameter"><code>list</code></em> :</span></p></td>
256 <td>
257 <a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="type">librdf_list</span></a> object</td>
258 </tr>
259 <tr>
260 <td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
261 <td>the data item</td>
262 </tr>
263 <tr>
264 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
265 <td>the data stored or NULL on failure (not found or list empty)</td>
266 </tr>
267 </tbody>
268 </table></div>
269 </div>
270 <hr>
271 <div class="refsect2">
272 <a name="librdf-list-contains"></a><h3>librdf_list_contains ()</h3>
273 <pre class="programlisting"><span class="returnvalue">int</span> librdf_list_contains (<em class="parameter"><code><a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="type">librdf_list</span></a> *list</code></em>,
274 <em class="parameter"><code><span class="type">void</span> *data</code></em>);</pre>
275 <p>
276 Check for presence of data item in list.
277 </p>
278 <p>
279 The search is done using the 'equals' function which may be set
280 by <a class="link" href="redland-list.html#librdf-list-set-equals" title="librdf_list_set_equals ()"><code class="function">librdf_list_set_equals()</code></a> or by straight comparison of pointers
281 if not set.
282 </p>
283 <div class="variablelist"><table border="0">
284 <col align="left" valign="top">
285 <tbody>
286 <tr>
287 <td><p><span class="term"><em class="parameter"><code>list</code></em> :</span></p></td>
288 <td>
289 <a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="type">librdf_list</span></a> object</td>
290 </tr>
291 <tr>
292 <td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
293 <td>the data value</td>
294 </tr>
295 <tr>
296 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
297 <td>non 0 if item was found</td>
298 </tr>
299 </tbody>
300 </table></div>
301 </div>
302 <hr>
303 <div class="refsect2">
304 <a name="librdf-list-size"></a><h3>librdf_list_size ()</h3>
305 <pre class="programlisting"><span class="returnvalue">int</span> librdf_list_size (<em class="parameter"><code><a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="type">librdf_list</span></a> *list</code></em>);</pre>
306 <p>
307 Return the length of the list.
308 </p>
309 <div class="variablelist"><table border="0">
310 <col align="left" valign="top">
311 <tbody>
312 <tr>
313 <td><p><span class="term"><em class="parameter"><code>list</code></em> :</span></p></td>
314 <td>
315 <a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="type">librdf_list</span></a> object</td>
316 </tr>
317 <tr>
318 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
319 <td>length of the list</td>
320 </tr>
321 </tbody>
322 </table></div>
323 </div>
324 <hr>
325 <div class="refsect2">
326 <a name="librdf-list-set-equals"></a><h3>librdf_list_set_equals ()</h3>
327 <pre class="programlisting"><span class="returnvalue">void</span> librdf_list_set_equals (<em class="parameter"><code><a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="type">librdf_list</span></a> *list</code></em>,
328 <em class="parameter"><code><span class="type">int</span> (*equals) (void* data1, void *data2)</code></em>);</pre>
329 <p>
330 Set the equals function for the list.
331 </p>
332 <p>
333 The function given is used when comparing items in the list
334 during searches such as those done in <a class="link" href="redland-list.html#librdf-list-remove" title="librdf_list_remove ()"><code class="function">librdf_list_remove()</code></a> or
335 <a class="link" href="redland-list.html#librdf-list-contains" title="librdf_list_contains ()"><code class="function">librdf_list_contains()</code></a>.
336 </p>
337 <div class="variablelist"><table border="0">
338 <col align="left" valign="top">
339 <tbody>
340 <tr>
341 <td><p><span class="term"><em class="parameter"><code>list</code></em> :</span></p></td>
342 <td>
343 <a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="type">librdf_list</span></a> object</td>
344 </tr>
345 <tr>
346 <td><p><span class="term"><em class="parameter"><code>equals</code></em> :</span></p></td>
347 <td>the equals function</td>
348 </tr>
349 </tbody>
350 </table></div>
351 </div>
352 <hr>
353 <div class="refsect2">
354 <a name="librdf-list-get-iterator"></a><h3>librdf_list_get_iterator ()</h3>
355 <pre class="programlisting"><a class="link" href="redland-iterator.html#librdf-iterator" title="librdf_iterator"><span class="returnvalue">librdf_iterator</span></a> * librdf_list_get_iterator (<em class="parameter"><code><a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="type">librdf_list</span></a> *list</code></em>);</pre>
356 <p>
357 Get an iterator for the list.
358 </p>
359 <div class="variablelist"><table border="0">
360 <col align="left" valign="top">
361 <tbody>
362 <tr>
363 <td><p><span class="term"><em class="parameter"><code>list</code></em> :</span></p></td>
364 <td>
365 <a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="type">librdf_list</span></a> object</td>
366 </tr>
367 <tr>
368 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
369 <td>a new <a class="link" href="redland-iterator.html#librdf-iterator" title="librdf_iterator"><span class="type">librdf_iterator</span></a> object or NULL on failure</td>
370 </tr>
371 </tbody>
372 </table></div>
373 </div>
374 <hr>
375 <div class="refsect2">
376 <a name="librdf-list-foreach"></a><h3>librdf_list_foreach ()</h3>
377 <pre class="programlisting"><span class="returnvalue">void</span> librdf_list_foreach (<em class="parameter"><code><a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="type">librdf_list</span></a> *list</code></em>,
378 <em class="parameter"><code><span class="type">void</span> (*fn) (void *, void *)</code></em>,
379 <em class="parameter"><code><span class="type">void</span> *user_data</code></em>);</pre>
380 <p>
381 Apply a function for each data item in a librdf_list.
382 </p>
383 <div class="variablelist"><table border="0">
384 <col align="left" valign="top">
385 <tbody>
386 <tr>
387 <td><p><span class="term"><em class="parameter"><code>list</code></em> :</span></p></td>
388 <td>
389 <a class="link" href="redland-list.html#librdf-list" title="librdf_list"><span class="type">librdf_list</span></a> object</td>
390 </tr>
391 <tr>
392 <td><p><span class="term"><em class="parameter"><code>fn</code></em> :</span></p></td>
393 <td>pointer to function to apply that takes data pointer and user data parameters</td>
394 </tr>
395 <tr>
396 <td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
397 <td>user data for applied function</td>
398 </tr>
399 </tbody>
400 </table></div>
401 </div>
402 </div>
403 </div>
404 <div class="footer">
405 <hr>
406 Generated by GTK-Doc V1.18</div>
407 </body>
408 </html>