Initial commit
[platform/upstream/glib2.0.git] / docs / reference / glib / html / glib-Automatic-String-Completion.html
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>Automatic String Completion</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
7 <link rel="home" href="index.html" title="GLib Reference Manual">
8 <link rel="up" href="glib-utilities.html" title="GLib Utilities">
9 <link rel="prev" href="glib-Lexical-Scanner.html" title="Lexical Scanner">
10 <link rel="next" href="glib-Timers.html" title="Timers">
11 <meta name="generator" content="GTK-Doc V1.13 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
13 <link rel="chapter" href="glib.html" title="GLib Overview">
14 <link rel="chapter" href="glib-fundamentals.html" title="GLib Fundamentals">
15 <link rel="chapter" href="glib-core.html" title="GLib Core Application Support">
16 <link rel="chapter" href="glib-utilities.html" title="GLib Utilities">
17 <link rel="chapter" href="glib-data-types.html" title="GLib Data Types">
18 <link rel="chapter" href="tools.html" title="GLib Tools">
19 <link rel="index" href="api-index-full.html" title="Index">
20 <link rel="index" href="api-index-deprecated.html" title="Index of deprecated symbols">
21 <link rel="index" href="api-index-2-2.html" title="Index of new symbols in 2.2">
22 <link rel="index" href="api-index-2-4.html" title="Index of new symbols in 2.4">
23 <link rel="index" href="api-index-2-6.html" title="Index of new symbols in 2.6">
24 <link rel="index" href="api-index-2-8.html" title="Index of new symbols in 2.8">
25 <link rel="index" href="api-index-2-10.html" title="Index of new symbols in 2.10">
26 <link rel="index" href="api-index-2-12.html" title="Index of new symbols in 2.12">
27 <link rel="index" href="api-index-2-14.html" title="Index of new symbols in 2.14">
28 <link rel="index" href="api-index-2-16.html" title="Index of new symbols in 2.16">
29 <link rel="index" href="api-index-2-18.html" title="Index of new symbols in 2.18">
30 <link rel="index" href="api-index-2-20.html" title="Index of new symbols in 2.20">
31 <link rel="index" href="api-index-2-22.html" title="Index of new symbols in 2.22">
32 <link rel="index" href="api-index-2-24.html" title="Index of new symbols in 2.24">
33 </head>
34 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
35 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
36 <tr valign="middle">
37 <td><a accesskey="p" href="glib-Lexical-Scanner.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
38 <td><a accesskey="u" href="glib-utilities.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
39 <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
40 <th width="100%" align="center">GLib Reference Manual</th>
41 <td><a accesskey="n" href="glib-Timers.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
42 </tr>
43 <tr><td colspan="5" class="shortcuts">
44 <a href="#glib-Automatic-String-Completion.synopsis" class="shortcut">Top</a>
45                    | 
46                   <a href="#glib-Automatic-String-Completion.description" class="shortcut">Description</a>
47 </td></tr>
48 </table>
49 <div class="refentry" title="Automatic String Completion">
50 <a name="glib-Automatic-String-Completion"></a><div class="titlepage"></div>
51 <div class="refnamediv"><table width="100%"><tr>
52 <td valign="top">
53 <h2><span class="refentrytitle"><a name="glib-Automatic-String-Completion.top_of_page"></a>Automatic String Completion</span></h2>
54 <p>Automatic String Completion — support for automatic completion using a group
55                     of target strings</p>
56 </td>
57 <td valign="top" align="right"></td>
58 </tr></table></div>
59 <div class="refsynopsisdiv" title="Synopsis">
60 <a name="glib-Automatic-String-Completion.synopsis"></a><h2>Synopsis</h2>
61 <pre class="synopsis">
62 #include &lt;glib.h&gt;
63
64                     <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="GCompletion">GCompletion</a>;
65 <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="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>                    (<a class="link" href="glib-Automatic-String-Completion.html#GCompletionFunc" title="GCompletionFunc ()"><span class="returnvalue">GCompletionFunc</span></a> func);
66 <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>)                  (<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> );
67 <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>              (<a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="GCompletion"><span class="returnvalue">GCompletion</span></a> *cmp,
68                                                          <a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="GList"><span class="returnvalue">GList</span></a> *items);
69 <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>           (<a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="GCompletion"><span class="returnvalue">GCompletion</span></a> *cmp,
70                                                          <a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="GList"><span class="returnvalue">GList</span></a> *items);
71 <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>            (<a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="GCompletion"><span class="returnvalue">GCompletion</span></a> *cmp);
72 <a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="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>               (<a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="GCompletion"><span class="returnvalue">GCompletion</span></a> *cmp,
73                                                          const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *prefix,
74                                                          <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> **new_prefix);
75 <a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="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>          (<a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="GCompletion"><span class="returnvalue">GCompletion</span></a> *cmp,
76                                                          const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *prefix,
77                                                          <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> **new_prefix);
78 <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>            (<a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="GCompletion"><span class="returnvalue">GCompletion</span></a> *cmp,
79                                                          <a class="link" href="glib-Automatic-String-Completion.html#GCompletionStrncmpFunc" title="GCompletionStrncmpFunc ()"><span class="returnvalue">GCompletionStrncmpFunc</span></a> strncmp_func);
80 <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>)           (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *s1,
81                                                          const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *s2,
82                                                          <a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="returnvalue">gsize</span></a> n);
83 <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>                   (<a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="GCompletion"><span class="returnvalue">GCompletion</span></a> *cmp);
84 </pre>
85 </div>
86 <div class="refsect1" title="Description">
87 <a name="glib-Automatic-String-Completion.description"></a><h2>Description</h2>
88 <p>
89 <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="GCompletion"><span class="type">GCompletion</span></a> provides support for automatic completion of a string
90 using any group of target strings. It is typically used for file
91 name completion as is common in many UNIX shells.
92 </p>
93 <p>
94 A <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="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
95 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>,
96 <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
97 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
98 <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
99 <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="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>.
100 </p>
101 <p>
102 Items in the completion can be simple strings (e.g. filenames), or
103 pointers to arbitrary data structures. If data structures are used
104 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
105 retrieves the item's string from the data structure. You can change
106 the way in which strings are compared by setting a different
107 <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>
108 </div>
109 <div class="refsect1" title="Details">
110 <a name="glib-Automatic-String-Completion.details"></a><h2>Details</h2>
111 <div class="refsect2" title="GCompletion">
112 <a name="GCompletion"></a><h3>GCompletion</h3>
113 <pre class="programlisting">typedef struct {
114   GList* items;
115   GCompletionFunc func;
116  
117   gchar* prefix;
118   GList* cache;
119   GCompletionStrncmpFunc strncmp_func;
120 } GCompletion;
121 </pre>
122 <p>
123 The data structure used for automatic completion.</p>
124 <div class="variablelist"><table border="0">
125 <col align="left" valign="top">
126 <tbody>
127 <tr>
128 <td><p><span class="term"><a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="GList"><span class="type">GList</span></a> *<em class="structfield"><code><a name="GCompletion.items"></a>items</code></em>;</span></p></td>
129 <td> list of target items (strings or data structures).
130 </td>
131 </tr>
132 <tr>
133 <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>
134 <td> function which is called to get the string associated with a
135        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.
136 </td>
137 </tr>
138 <tr>
139 <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>
140 <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
141          <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>.
142 </td>
143 </tr>
144 <tr>
145 <td><p><span class="term"><a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="GList"><span class="type">GList</span></a> *<em class="structfield"><code><a name="GCompletion.cache"></a>cache</code></em>;</span></p></td>
146 <td> the list of items which begin with <em class="parameter"><code>prefix</code></em>.
147 </td>
148 </tr>
149 <tr>
150 <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>
151 <td> The function to use when comparing strings.  Use
152                <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.
153 </td>
154 </tr>
155 </tbody>
156 </table></div>
157 </div>
158 <hr>
159 <div class="refsect2" title="g_completion_new ()">
160 <a name="g-completion-new"></a><h3>g_completion_new ()</h3>
161 <pre class="programlisting"><a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="GCompletion"><span class="returnvalue">GCompletion</span></a>*        g_completion_new                    (<a class="link" href="glib-Automatic-String-Completion.html#GCompletionFunc" title="GCompletionFunc ()"><span class="returnvalue">GCompletionFunc</span></a> func);</pre>
162 <p>
163 Creates a new <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="GCompletion"><span class="type">GCompletion</span></a>.</p>
164 <div class="variablelist"><table border="0">
165 <col align="left" valign="top">
166 <tbody>
167 <tr>
168 <td><p><span class="term"><em class="parameter"><code>func</code></em> :</span></p></td>
169 <td> the function to be called to return the string representing
170        an item in the <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="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
171        be used as the <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="GCompletion"><span class="type">GCompletion</span></a> items.
172 </td>
173 </tr>
174 <tr>
175 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
176 <td> the new <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="GCompletion"><span class="type">GCompletion</span></a>.
177 </td>
178 </tr>
179 </tbody>
180 </table></div>
181 </div>
182 <hr>
183 <div class="refsect2" title="GCompletionFunc ()">
184 <a name="GCompletionFunc"></a><h3>GCompletionFunc ()</h3>
185 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *             (*GCompletionFunc)                  (<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> );</pre>
186 <p>
187 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
188 should return the string corresponding to the given target item.
189 This is used when you use data structures as <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="GCompletion"><span class="type">GCompletion</span></a> items.</p>
190 <div class="variablelist"><table border="0">
191 <col align="left" valign="top">
192 <tbody>
193 <tr>
194 <td><p><span class="term"><em class="parameter"><code>Param1</code></em> :</span></p></td>
195 <td> the completion item.
196 </td>
197 </tr>
198 <tr>
199 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
200 <td> the string corresponding to the item.
201 </td>
202 </tr>
203 </tbody>
204 </table></div>
205 </div>
206 <hr>
207 <div class="refsect2" title="g_completion_add_items ()">
208 <a name="g-completion-add-items"></a><h3>g_completion_add_items ()</h3>
209 <pre class="programlisting"><span class="returnvalue">void</span>                g_completion_add_items              (<a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="GCompletion"><span class="returnvalue">GCompletion</span></a> *cmp,
210                                                          <a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="GList"><span class="returnvalue">GList</span></a> *items);</pre>
211 <p>
212 Adds items to the <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="GCompletion"><span class="type">GCompletion</span></a>.</p>
213 <div class="variablelist"><table border="0">
214 <col align="left" valign="top">
215 <tbody>
216 <tr>
217 <td><p><span class="term"><em class="parameter"><code>cmp</code></em> :</span></p></td>
218 <td> the <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="GCompletion"><span class="type">GCompletion</span></a>.
219 </td>
220 </tr>
221 <tr>
222 <td><p><span class="term"><em class="parameter"><code>items</code></em> :</span></p></td>
223 <td> the list of items to add.
224 </td>
225 </tr>
226 </tbody>
227 </table></div>
228 </div>
229 <hr>
230 <div class="refsect2" title="g_completion_remove_items ()">
231 <a name="g-completion-remove-items"></a><h3>g_completion_remove_items ()</h3>
232 <pre class="programlisting"><span class="returnvalue">void</span>                g_completion_remove_items           (<a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="GCompletion"><span class="returnvalue">GCompletion</span></a> *cmp,
233                                                          <a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="GList"><span class="returnvalue">GList</span></a> *items);</pre>
234 <p>
235 Removes items from a <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="GCompletion"><span class="type">GCompletion</span></a>.</p>
236 <div class="variablelist"><table border="0">
237 <col align="left" valign="top">
238 <tbody>
239 <tr>
240 <td><p><span class="term"><em class="parameter"><code>cmp</code></em> :</span></p></td>
241 <td> the <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="GCompletion"><span class="type">GCompletion</span></a>.
242 </td>
243 </tr>
244 <tr>
245 <td><p><span class="term"><em class="parameter"><code>items</code></em> :</span></p></td>
246 <td> the items to remove.
247 </td>
248 </tr>
249 </tbody>
250 </table></div>
251 </div>
252 <hr>
253 <div class="refsect2" title="g_completion_clear_items ()">
254 <a name="g-completion-clear-items"></a><h3>g_completion_clear_items ()</h3>
255 <pre class="programlisting"><span class="returnvalue">void</span>                g_completion_clear_items            (<a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="GCompletion"><span class="returnvalue">GCompletion</span></a> *cmp);</pre>
256 <p>
257 Removes all items from the <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="GCompletion"><span class="type">GCompletion</span></a>.</p>
258 <div class="variablelist"><table border="0">
259 <col align="left" valign="top">
260 <tbody><tr>
261 <td><p><span class="term"><em class="parameter"><code>cmp</code></em> :</span></p></td>
262 <td> the <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="GCompletion"><span class="type">GCompletion</span></a>.
263 </td>
264 </tr></tbody>
265 </table></div>
266 </div>
267 <hr>
268 <div class="refsect2" title="g_completion_complete ()">
269 <a name="g-completion-complete"></a><h3>g_completion_complete ()</h3>
270 <pre class="programlisting"><a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="GList"><span class="returnvalue">GList</span></a>*              g_completion_complete               (<a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="GCompletion"><span class="returnvalue">GCompletion</span></a> *cmp,
271                                                          const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *prefix,
272                                                          <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> **new_prefix);</pre>
273 <p>
274 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="GCompletion"><span class="type">GCompletion</span></a>
275 target items.</p>
276 <div class="variablelist"><table border="0">
277 <col align="left" valign="top">
278 <tbody>
279 <tr>
280 <td><p><span class="term"><em class="parameter"><code>cmp</code></em> :</span></p></td>
281 <td> the <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="GCompletion"><span class="type">GCompletion</span></a>.
282 </td>
283 </tr>
284 <tr>
285 <td><p><span class="term"><em class="parameter"><code>prefix</code></em> :</span></p></td>
286 <td> the prefix string, typically typed by the user, which is
287          compared with each of the items.
288 </td>
289 </tr>
290 <tr>
291 <td><p><span class="term"><em class="parameter"><code>new_prefix</code></em> :</span></p></td>
292 <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
293              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
294              no items matched <em class="parameter"><code>prefix</code></em>.  This string should be freed
295              when no longer needed.
296 </td>
297 </tr>
298 <tr>
299 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
300 <td> the list of items whose strings begin with <em class="parameter"><code>prefix</code></em>. This
301           should not be changed.
302 </td>
303 </tr>
304 </tbody>
305 </table></div>
306 </div>
307 <hr>
308 <div class="refsect2" title="g_completion_complete_utf8 ()">
309 <a name="g-completion-complete-utf8"></a><h3>g_completion_complete_utf8 ()</h3>
310 <pre class="programlisting"><a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="GList"><span class="returnvalue">GList</span></a>*              g_completion_complete_utf8          (<a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="GCompletion"><span class="returnvalue">GCompletion</span></a> *cmp,
311                                                          const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *prefix,
312                                                          <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> **new_prefix);</pre>
313 <p>
314 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="GCompletion"><span class="type">GCompletion</span></a> target items.
315 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
316 prefix that is a valid UTF-8 string, omitting a possible common partial 
317 character.
318 </p>
319 <p>
320 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 
321 items are UTF-8 strings.</p>
322 <div class="variablelist"><table border="0">
323 <col align="left" valign="top">
324 <tbody>
325 <tr>
326 <td><p><span class="term"><em class="parameter"><code>cmp</code></em> :</span></p></td>
327 <td> the <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="GCompletion"><span class="type">GCompletion</span></a>
328 </td>
329 </tr>
330 <tr>
331 <td><p><span class="term"><em class="parameter"><code>prefix</code></em> :</span></p></td>
332 <td> the prefix string, typically used by the user, which is compared
333    with each of the items
334 </td>
335 </tr>
336 <tr>
337 <td><p><span class="term"><em class="parameter"><code>new_prefix</code></em> :</span></p></td>
338 <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
339    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>.
340    This string should be freed when no longer needed.
341 </td>
342 </tr>
343 <tr>
344 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
345 <td> the list of items whose strings begin with <em class="parameter"><code>prefix</code></em>. This should
346 not be changed.
347
348 </td>
349 </tr>
350 </tbody>
351 </table></div>
352 <p class="since">Since 2.4</p>
353 </div>
354 <hr>
355 <div class="refsect2" title="g_completion_set_compare ()">
356 <a name="g-completion-set-compare"></a><h3>g_completion_set_compare ()</h3>
357 <pre class="programlisting"><span class="returnvalue">void</span>                g_completion_set_compare            (<a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="GCompletion"><span class="returnvalue">GCompletion</span></a> *cmp,
358                                                          <a class="link" href="glib-Automatic-String-Completion.html#GCompletionStrncmpFunc" title="GCompletionStrncmpFunc ()"><span class="returnvalue">GCompletionStrncmpFunc</span></a> strncmp_func);</pre>
359 <p>
360 Sets the function to use for string comparisons. The default string
361 comparison function is <code class="function">strncmp()</code>.</p>
362 <div class="variablelist"><table border="0">
363 <col align="left" valign="top">
364 <tbody>
365 <tr>
366 <td><p><span class="term"><em class="parameter"><code>cmp</code></em> :</span></p></td>
367 <td> a <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="GCompletion"><span class="type">GCompletion</span></a>.
368 </td>
369 </tr>
370 <tr>
371 <td><p><span class="term"><em class="parameter"><code>strncmp_func</code></em> :</span></p></td>
372 <td> the string comparison function.
373 </td>
374 </tr>
375 </tbody>
376 </table></div>
377 </div>
378 <hr>
379 <div class="refsect2" title="GCompletionStrncmpFunc ()">
380 <a name="GCompletionStrncmpFunc"></a><h3>GCompletionStrncmpFunc ()</h3>
381 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a>                (*GCompletionStrncmpFunc)           (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *s1,
382                                                          const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *s2,
383                                                          <a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="returnvalue">gsize</span></a> n);</pre>
384 <p>
385 Specifies the type of the function passed to
386 <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
387 <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="GCompletion"><span class="type">GCompletion</span></a> items.</p>
388 <div class="variablelist"><table border="0">
389 <col align="left" valign="top">
390 <tbody>
391 <tr>
392 <td><p><span class="term"><em class="parameter"><code>s1</code></em> :</span></p></td>
393 <td> string to compare with <em class="parameter"><code>s2</code></em>.
394 </td>
395 </tr>
396 <tr>
397 <td><p><span class="term"><em class="parameter"><code>s2</code></em> :</span></p></td>
398 <td> string to compare with <em class="parameter"><code>s1</code></em>.
399 </td>
400 </tr>
401 <tr>
402 <td><p><span class="term"><em class="parameter"><code>n</code></em> :</span></p></td>
403 <td> maximal number of bytes to compare.
404 </td>
405 </tr>
406 <tr>
407 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
408 <td> an integer less than, equal to, or greater than zero if
409           the first <em class="parameter"><code>n</code></em> bytes of <em class="parameter"><code>s1</code></em> is found, respectively, to be
410           less than, to match, or to be greater than the first <em class="parameter"><code>n</code></em>
411           bytes of <em class="parameter"><code>s2</code></em>.
412 </td>
413 </tr>
414 </tbody>
415 </table></div>
416 </div>
417 <hr>
418 <div class="refsect2" title="g_completion_free ()">
419 <a name="g-completion-free"></a><h3>g_completion_free ()</h3>
420 <pre class="programlisting"><span class="returnvalue">void</span>                g_completion_free                   (<a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="GCompletion"><span class="returnvalue">GCompletion</span></a> *cmp);</pre>
421 <p>
422 Frees all memory used by the <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="GCompletion"><span class="type">GCompletion</span></a>.</p>
423 <div class="variablelist"><table border="0">
424 <col align="left" valign="top">
425 <tbody><tr>
426 <td><p><span class="term"><em class="parameter"><code>cmp</code></em> :</span></p></td>
427 <td> the <a class="link" href="glib-Automatic-String-Completion.html#GCompletion" title="GCompletion"><span class="type">GCompletion</span></a>.
428 </td>
429 </tr></tbody>
430 </table></div>
431 </div>
432 </div>
433 </div>
434 <div class="footer">
435 <hr>
436           Generated by GTK-Doc V1.13</div>
437 </body>
438 </html>