summaryrefstree
path: root/usr/share/gtk-doc/html/glib/glib-Automatic-String-Completion.html
blob: dac6ee53d56caa186bfebb20e5ad555c9cd744ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Automatic String Completion</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="index.html" title="GLib Reference Manual">
<link rel="up" href="deprecated.html" title="Deprecated APIs">
<link rel="prev" href="glib-Relations-and-Tuples.html" title="Relations and Tuples">
<link rel="next" href="tools.html" title="GLib Tools">
<meta name="generator" content="GTK-Doc V1.19 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="glib-Relations-and-Tuples.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="deprecated.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GLib Reference Manual</th>
<td><a accesskey="n" href="tools.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#glib-Automatic-String-Completion.synopsis" class="shortcut">Top</a>
                   | 
                  <a href="#glib-Automatic-String-Completion.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry">
<a name="glib-Automatic-String-Completion"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="glib-Automatic-String-Completion.top_of_page"></a>Automatic String Completion</span></h2>
<p>Automatic String Completion — support for automatic completion using a group
                    of target strings</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="glib-Automatic-String-Completion.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#include &lt;glib.h&gt;

struct              <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="struct GCompletion">GCompletion</a>;
<a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="struct GCompletion"><span class="returnvalue">GCompletion</span></a> *       <a class="link" href="glib-Automatic-String-Completion.html#g-completion-new" title="g_completion_new ()">g_completion_new</a>                    (<em class="parameter"><code><a class="link" href="glib-Automatic-String-Completion.html#GCompletionFunc" title="GCompletionFunc ()"><span class="type">GCompletionFunc</span></a> func</code></em>);
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *             (<a class="link" href="glib-Automatic-String-Completion.html#GCompletionFunc" title="GCompletionFunc ()">*GCompletionFunc</a>)                  (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> Param1</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Automatic-String-Completion.html#g-completion-add-items" title="g_completion_add_items ()">g_completion_add_items</a>              (<em class="parameter"><code><a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="struct GCompletion"><span class="type">GCompletion</span></a> *cmp</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="type">GList</span></a> *items</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Automatic-String-Completion.html#g-completion-remove-items" title="g_completion_remove_items ()">g_completion_remove_items</a>           (<em class="parameter"><code><a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="struct GCompletion"><span class="type">GCompletion</span></a> *cmp</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="type">GList</span></a> *items</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Automatic-String-Completion.html#g-completion-clear-items" title="g_completion_clear_items ()">g_completion_clear_items</a>            (<em class="parameter"><code><a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="struct GCompletion"><span class="type">GCompletion</span></a> *cmp</code></em>);
<a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="returnvalue">GList</span></a> *             <a class="link" href="glib-Automatic-String-Completion.html#g-completion-complete" title="g_completion_complete ()">g_completion_complete</a>               (<em class="parameter"><code><a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="struct GCompletion"><span class="type">GCompletion</span></a> *cmp</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *prefix</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> **new_prefix</code></em>);
<a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="returnvalue">GList</span></a> *             <a class="link" href="glib-Automatic-String-Completion.html#g-completion-complete-utf8" title="g_completion_complete_utf8 ()">g_completion_complete_utf8</a>          (<em class="parameter"><code><a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="struct GCompletion"><span class="type">GCompletion</span></a> *cmp</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *prefix</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> **new_prefix</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Automatic-String-Completion.html#g-completion-set-compare" title="g_completion_set_compare ()">g_completion_set_compare</a>            (<em class="parameter"><code><a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="struct GCompletion"><span class="type">GCompletion</span></a> *cmp</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Automatic-String-Completion.html#GCompletionStrncmpFunc" title="GCompletionStrncmpFunc ()"><span class="type">GCompletionStrncmpFunc</span></a> strncmp_func</code></em>);
<a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a>                (<a class="link" href="glib-Automatic-String-Completion.html#GCompletionStrncmpFunc" title="GCompletionStrncmpFunc ()">*GCompletionStrncmpFunc</a>)           (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *s1</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *s2</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> n</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Automatic-String-Completion.html#g-completion-free" title="g_completion_free ()">g_completion_free</a>                   (<em class="parameter"><code><a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="struct GCompletion"><span class="type">GCompletion</span></a> *cmp</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="glib-Automatic-String-Completion.description"></a><h2>Description</h2>
<p>
<a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="struct GCompletion"><span class="type">GCompletion</span></a> provides support for automatic completion of a string
using any group of target strings. It is typically used for file
name completion as is common in many UNIX shells.
</p>
<p>
A <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="struct GCompletion"><span class="type">GCompletion</span></a> is created using <a class="link" href="glib-Automatic-String-Completion.html#g-completion-new" title="g_completion_new ()"><code class="function">g_completion_new()</code></a>. Target items are
added and removed with <a class="link" href="glib-Automatic-String-Completion.html#g-completion-add-items" title="g_completion_add_items ()"><code class="function">g_completion_add_items()</code></a>,
<a class="link" href="glib-Automatic-String-Completion.html#g-completion-remove-items" title="g_completion_remove_items ()"><code class="function">g_completion_remove_items()</code></a> and <a class="link" href="glib-Automatic-String-Completion.html#g-completion-clear-items" title="g_completion_clear_items ()"><code class="function">g_completion_clear_items()</code></a>. A
completion attempt is requested with <a class="link" href="glib-Automatic-String-Completion.html#g-completion-complete" title="g_completion_complete ()"><code class="function">g_completion_complete()</code></a> or
<a class="link" href="glib-Automatic-String-Completion.html#g-completion-complete-utf8" title="g_completion_complete_utf8 ()"><code class="function">g_completion_complete_utf8()</code></a>. When no longer needed, the
<a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="struct GCompletion"><span class="type">GCompletion</span></a> is freed with <a class="link" href="glib-Automatic-String-Completion.html#g-completion-free" title="g_completion_free ()"><code class="function">g_completion_free()</code></a>.
</p>
<p>
Items in the completion can be simple strings (e.g. filenames), or
pointers to arbitrary data structures. If data structures are used
you must provide a <a class="link" href="glib-Automatic-String-Completion.html#GCompletionFunc" title="GCompletionFunc ()"><span class="type">GCompletionFunc</span></a> in <a class="link" href="glib-Automatic-String-Completion.html#g-completion-new" title="g_completion_new ()"><code class="function">g_completion_new()</code></a>, which
retrieves the item's string from the data structure. You can change
the way in which strings are compared by setting a different
<a class="link" href="glib-Automatic-String-Completion.html#GCompletionStrncmpFunc" title="GCompletionStrncmpFunc ()"><span class="type">GCompletionStrncmpFunc</span></a> in <a class="link" href="glib-Automatic-String-Completion.html#g-completion-set-compare" title="g_completion_set_compare ()"><code class="function">g_completion_set_compare()</code></a>.
</p>
<p>
GCompletion has been marked as deprecated, since this API is rarely
used and not very actively maintained.
</p>
</div>
<div class="refsect1">
<a name="glib-Automatic-String-Completion.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="GCompletion"></a><h3>struct GCompletion</h3>
<pre class="programlisting">struct GCompletion {
  GList* items;
  GCompletionFunc func;
 
  gchar* prefix;
  GList* cache;
  GCompletionStrncmpFunc strncmp_func;
};
</pre>
<p>
The data structure used for automatic completion.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="type">GList</span></a> *<em class="structfield"><code><a name="GCompletion.items"></a>items</code></em>;</span></p></td>
<td>list of target items (strings or data structures).</td>
</tr>
<tr>
<td><p><span class="term"><a class="link" href="glib-Automatic-String-Completion.html#GCompletionFunc" title="GCompletionFunc ()"><span class="type">GCompletionFunc</span></a> <em class="structfield"><code><a name="GCompletion.func"></a>func</code></em>;</span></p></td>
<td>function which is called to get the string associated with a
target item. It is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if the target items are strings.</td>
</tr>
<tr>
<td><p><span class="term"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *<em class="structfield"><code><a name="GCompletion.prefix"></a>prefix</code></em>;</span></p></td>
<td>the last prefix passed to <a class="link" href="glib-Automatic-String-Completion.html#g-completion-complete" title="g_completion_complete ()"><code class="function">g_completion_complete()</code></a> or
<a class="link" href="glib-Automatic-String-Completion.html#g-completion-complete-utf8" title="g_completion_complete_utf8 ()"><code class="function">g_completion_complete_utf8()</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="type">GList</span></a> *<em class="structfield"><code><a name="GCompletion.cache"></a>cache</code></em>;</span></p></td>
<td>the list of items which begin with <em class="parameter"><code>prefix</code></em>.</td>
</tr>
<tr>
<td><p><span class="term"><a class="link" href="glib-Automatic-String-Completion.html#GCompletionStrncmpFunc" title="GCompletionStrncmpFunc ()"><span class="type">GCompletionStrncmpFunc</span></a> <em class="structfield"><code><a name="GCompletion.strncmp-func"></a>strncmp_func</code></em>;</span></p></td>
<td>The function to use when comparing strings.  Use
<a class="link" href="glib-Automatic-String-Completion.html#g-completion-set-compare" title="g_completion_set_compare ()"><code class="function">g_completion_set_compare()</code></a> to modify this function.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-completion-new"></a><h3>g_completion_new ()</h3>
<pre class="programlisting"><a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="struct GCompletion"><span class="returnvalue">GCompletion</span></a> *       g_completion_new                    (<em class="parameter"><code><a class="link" href="glib-Automatic-String-Completion.html#GCompletionFunc" title="GCompletionFunc ()"><span class="type">GCompletionFunc</span></a> func</code></em>);</pre>
<p>
Creates a new <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="struct GCompletion"><span class="type">GCompletion</span></a>.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>func</code></em> :</span></p></td>
<td>the function to be called to return the string representing
an item in the <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="struct GCompletion"><span class="type">GCompletion</span></a>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if strings are going to
be used as the <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="struct GCompletion"><span class="type">GCompletion</span></a> items.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the new <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="struct GCompletion"><span class="type">GCompletion</span></a>.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="GCompletionFunc"></a><h3>GCompletionFunc ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *             (*GCompletionFunc)                  (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> Param1</code></em>);</pre>
<p>
Specifies the type of the function passed to <a class="link" href="glib-Automatic-String-Completion.html#g-completion-new" title="g_completion_new ()"><code class="function">g_completion_new()</code></a>. It
should return the string corresponding to the given target item.
This is used when you use data structures as <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="struct GCompletion"><span class="type">GCompletion</span></a> items.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>Param1</code></em> :</span></p></td>
<td>the completion item.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the string corresponding to the item.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-completion-add-items"></a><h3>g_completion_add_items ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_completion_add_items              (<em class="parameter"><code><a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="struct GCompletion"><span class="type">GCompletion</span></a> *cmp</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="type">GList</span></a> *items</code></em>);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">g_completion_add_items</code> has been deprecated since version 2.26 and should not be used in newly-written code. Rarely used API</p>
</div>
<p>
Adds items to the <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="struct GCompletion"><span class="type">GCompletion</span></a>.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>cmp</code></em> :</span></p></td>
<td>the <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="struct GCompletion"><span class="type">GCompletion</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>items</code></em> :</span></p></td>
<td>the list of items to add. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-completion-remove-items"></a><h3>g_completion_remove_items ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_completion_remove_items           (<em class="parameter"><code><a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="struct GCompletion"><span class="type">GCompletion</span></a> *cmp</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="type">GList</span></a> *items</code></em>);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">g_completion_remove_items</code> has been deprecated since version 2.26 and should not be used in newly-written code. Rarely used API</p>
</div>
<p>
Removes items from a <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="struct GCompletion"><span class="type">GCompletion</span></a>. The items are not freed, so if the memory
was dynamically allocated, free <em class="parameter"><code>items</code></em> with <a class="link" href="glib-Doubly-Linked-Lists.html#g-list-free-full" title="g_list_free_full ()"><code class="function">g_list_free_full()</code></a> after calling
this function.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>cmp</code></em> :</span></p></td>
<td>the <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="struct GCompletion"><span class="type">GCompletion</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>items</code></em> :</span></p></td>
<td>the items to remove. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-completion-clear-items"></a><h3>g_completion_clear_items ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_completion_clear_items            (<em class="parameter"><code><a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="struct GCompletion"><span class="type">GCompletion</span></a> *cmp</code></em>);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">g_completion_clear_items</code> has been deprecated since version 2.26 and should not be used in newly-written code. Rarely used API</p>
</div>
<p>
Removes all items from the <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="struct GCompletion"><span class="type">GCompletion</span></a>. The items are not freed, so if the
memory was dynamically allocated, it should be freed after calling this
function.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>cmp</code></em> :</span></p></td>
<td>the <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="struct GCompletion"><span class="type">GCompletion</span></a>.</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-completion-complete"></a><h3>g_completion_complete ()</h3>
<pre class="programlisting"><a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="returnvalue">GList</span></a> *             g_completion_complete               (<em class="parameter"><code><a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="struct GCompletion"><span class="type">GCompletion</span></a> *cmp</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *prefix</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> **new_prefix</code></em>);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">g_completion_complete</code> has been deprecated since version 2.26 and should not be used in newly-written code. Rarely used API</p>
</div>
<p>
Attempts to complete the string <em class="parameter"><code>prefix</code></em> using the <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="struct GCompletion"><span class="type">GCompletion</span></a>
target items.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>cmp</code></em> :</span></p></td>
<td>the <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="struct GCompletion"><span class="type">GCompletion</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>prefix</code></em> :</span></p></td>
<td>the prefix string, typically typed by the user, which is
compared with each of the items.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>new_prefix</code></em> :</span></p></td>
<td>if non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>, returns the longest prefix which is
common to all items that matched <em class="parameter"><code>prefix</code></em>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if
no items matched <em class="parameter"><code>prefix</code></em>.  This string should be freed
when no longer needed.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the list of items whose strings begin with
<em class="parameter"><code>prefix</code></em>. This should not be changed. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-completion-complete-utf8"></a><h3>g_completion_complete_utf8 ()</h3>
<pre class="programlisting"><a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="returnvalue">GList</span></a> *             g_completion_complete_utf8          (<em class="parameter"><code><a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="struct GCompletion"><span class="type">GCompletion</span></a> *cmp</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *prefix</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> **new_prefix</code></em>);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">g_completion_complete_utf8</code> has been deprecated since version 2.26 and should not be used in newly-written code. Rarely used API</p>
</div>
<p>
Attempts to complete the string <em class="parameter"><code>prefix</code></em> using the <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="struct GCompletion"><span class="type">GCompletion</span></a> target items.
In contrast to <a class="link" href="glib-Automatic-String-Completion.html#g-completion-complete" title="g_completion_complete ()"><code class="function">g_completion_complete()</code></a>, this function returns the largest common
prefix that is a valid UTF-8 string, omitting a possible common partial 
character.
</p>
<p>
You should use this function instead of <a class="link" href="glib-Automatic-String-Completion.html#g-completion-complete" title="g_completion_complete ()"><code class="function">g_completion_complete()</code></a> if your 
items are UTF-8 strings.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>cmp</code></em> :</span></p></td>
<td>the <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="struct GCompletion"><span class="type">GCompletion</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>prefix</code></em> :</span></p></td>
<td>the prefix string, typically used by the user, which is compared
with each of the items</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>new_prefix</code></em> :</span></p></td>
<td>if non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>, returns the longest prefix which is common to all
items that matched <em class="parameter"><code>prefix</code></em>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if no items matched <em class="parameter"><code>prefix</code></em>.
This string should be freed when no longer needed.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the list of items whose strings begin with <em class="parameter"><code>prefix</code></em>. This should
not be changed. <span class="annotation">[<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> utf8][<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.4</p>
</div>
<hr>
<div class="refsect2">
<a name="g-completion-set-compare"></a><h3>g_completion_set_compare ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_completion_set_compare            (<em class="parameter"><code><a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="struct GCompletion"><span class="type">GCompletion</span></a> *cmp</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Automatic-String-Completion.html#GCompletionStrncmpFunc" title="GCompletionStrncmpFunc ()"><span class="type">GCompletionStrncmpFunc</span></a> strncmp_func</code></em>);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">g_completion_set_compare</code> has been deprecated since version 2.26 and should not be used in newly-written code. Rarely used API</p>
</div>
<p>
Sets the function to use for string comparisons. The default string
comparison function is <code class="function">strncmp()</code>.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>cmp</code></em> :</span></p></td>
<td>a <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="struct GCompletion"><span class="type">GCompletion</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>strncmp_func</code></em> :</span></p></td>
<td>the string comparison function.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="GCompletionStrncmpFunc"></a><h3>GCompletionStrncmpFunc ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a>                (*GCompletionStrncmpFunc)           (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *s1</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *s2</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> n</code></em>);</pre>
<p>
Specifies the type of the function passed to
<a class="link" href="glib-Automatic-String-Completion.html#g-completion-set-compare" title="g_completion_set_compare ()"><code class="function">g_completion_set_compare()</code></a>. This is used when you use strings as
<a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="struct GCompletion"><span class="type">GCompletion</span></a> items.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>s1</code></em> :</span></p></td>
<td>string to compare with <em class="parameter"><code>s2</code></em>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>s2</code></em> :</span></p></td>
<td>string to compare with <em class="parameter"><code>s1</code></em>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>n</code></em> :</span></p></td>
<td>maximal number of bytes to compare.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>an integer less than, equal to, or greater than zero if
the first <em class="parameter"><code>n</code></em> bytes of <em class="parameter"><code>s1</code></em> is found, respectively, to be
less than, to match, or to be greater than the first <em class="parameter"><code>n</code></em>
bytes of <em class="parameter"><code>s2</code></em>.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-completion-free"></a><h3>g_completion_free ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_completion_free                   (<em class="parameter"><code><a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="struct GCompletion"><span class="type">GCompletion</span></a> *cmp</code></em>);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">g_completion_free</code> has been deprecated since version 2.26 and should not be used in newly-written code. Rarely used API</p>
</div>
<p>
Frees all memory used by the <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="struct GCompletion"><span class="type">GCompletion</span></a>. The items are not freed, so if
the memory was dynamically allocated, it should be freed after calling this
function.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>cmp</code></em> :</span></p></td>
<td>the <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="struct GCompletion"><span class="type">GCompletion</span></a>.</td>
</tr></tbody>
</table></div>
</div>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.19</div>
</body>
</html>