glib-Automatic-String-Completion.html   [plain text]


<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Automatic String Completion</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="GLib Reference Manual"><link rel="up" href="glib-utilities.html" title="GLib Utilities"><link rel="previous" href="glib-Lexical-Scanner.html" title="Lexical Scanner"><link rel="next" href="glib-Timers.html" title="Timers"><link rel="chapter" href="glib.html" title="GLib Overview"><link rel="refentry" href="glib-building.html" title="Compiling the GLib package"><link rel="refentry" href="glib-cross-compiling.html" title="Cross-compiling the GLib package"><link rel="refentry" href="glib-compiling.html" title="Compiling GLib Applications"><link rel="refentry" href="glib-running.html" title="Running GLib Applications"><link rel="refentry" href="glib-changes.html" title="Changes to GLib"><link rel="refentry" href="glib-resources.html" title="Mailing lists and bug reports"><link rel="chapter" href="glib-fundamentals.html" title="GLib Fundamentals"><link rel="refentry" href="glib-Basic-Types.html" title="Basic Types"><link rel="refentry" href="glib-Limits-of-Basic-Types.html" title="Limits of Basic Types"><link rel="refentry" href="glib-Standard-Macros.html" title="Standard Macros"><link rel="refentry" href="glib-Type-Conversion-Macros.html" title="Type Conversion Macros"><link rel="refentry" href="glib-Byte-Order-Macros.html" title="Byte Order Macros"><link rel="refentry" href="glib-Numerical-Definitions.html" title="Numerical Definitions"><link rel="refentry" href="glib-Miscellaneous-Macros.html" title="Miscellaneous Macros"><link rel="refentry" href="glib-Atomic-Operations.html" title="Atomic Operations"><link rel="chapter" href="glib-core.html" title="GLib Core Application Support"><link rel="refentry" href="glib-The-Main-Event-Loop.html" title="The Main Event Loop"><link rel="refentry" href="glib-Threads.html" title="
Threads"><link rel="refentry" href="glib-Thread-Pools.html" title="Thread Pools"><link rel="refentry" href="glib-Asynchronous-Queues.html" title="Asynchronous Queues"><link rel="refentry" href="glib-Dynamic-Loading-of-Modules.html" title="Dynamic Loading of Modules"><link rel="refentry" href="glib-Memory-Allocation.html" title="Memory Allocation"><link rel="refentry" href="glib-IO-Channels.html" title="IO Channels"><link rel="refentry" href="glib-Error-Reporting.html" title="Error Reporting"><link rel="refentry" href="glib-Warnings-and-Assertions.html" title="Message Output and Debugging Functions"><link rel="refentry" href="glib-Message-Logging.html" title="Message Logging"><link rel="chapter" href="glib-utilities.html" title="GLib Utilities"><link rel="refentry" href="glib-String-Utility-Functions.html" title="String Utility Functions"><link rel="refentry" href="glib-Character-Set-Conversion.html" title="Character Set Conversion"><link rel="refentry" href="glib-Unicode-Manipulation.html" title="Unicode Manipulation"><link rel="refentry" href="glib-I18N.html" title="Internationalization"><link rel="refentry" href="glib-Date-and-Time-Functions.html" title="Date and Time Functions"><link rel="refentry" href="glib-Random-Numbers.html" title="Random Numbers"><link rel="refentry" href="glib-Hook-Functions.html" title="Hook Functions"><link rel="refentry" href="glib-Miscellaneous-Utility-Functions.html" title="Miscellaneous Utility Functions"><link rel="refentry" href="glib-Lexical-Scanner.html" title="Lexical Scanner"><link rel="refentry" href="glib-Automatic-String-Completion.html" title="Automatic String Completion"><link rel="refentry" href="glib-Timers.html" title="Timers"><link rel="refentry" href="glib-Spawning-Processes.html" title="Spawning Processes"><link rel="refentry" href="glib-File-Utilities.html" title="File Utilities"><link rel="refentry" href="glib-Shell-related-Utilities.html" title="Shell-related Utilities"><link rel="refentry" href="glib-Glob-style-pattern-matching.html" title="Glob-style pattern matching"><link rel="refentry" href="glib-Simple-XML-Subset-Parser.html" title="Simple XML Subset Parser"><link rel="refentry" href="glib-Windows-Compatability-Functions.html" title="Windows Compatibility Functions"><link rel="chapter" href="glib-data-types.html" title="GLib Data Types"><link rel="refentry" href="glib-Memory-Chunks.html" title="Memory Chunks"><link rel="refentry" href="glib-Doubly-Linked-Lists.html" title="Doubly-Linked Lists"><link rel="refentry" href="glib-Singly-Linked-Lists.html" title="Singly-Linked Lists"><link rel="refentry" href="glib-Double-ended-Queues.html" title="Double-ended Queues"><link rel="refentry" href="glib-Trash-Stacks.html" title="Trash Stacks"><link rel="refentry" href="glib-Hash-Tables.html" title="Hash Tables"><link rel="refentry" href="glib-Strings.html" title="Strings"><link rel="refentry" href="glib-String-Chunks.html" title="String Chunks"><link rel="refentry" href="glib-Arrays.html" title="Arrays"><link rel="refentry" href="glib-Pointer-Arrays.html" title="Pointer Arrays"><link rel="refentry" href="glib-Byte-Arrays.html" title="Byte Arrays"><link rel="refentry" href="glib-Balanced-Binary-Trees.html" title="Balanced Binary Trees"><link rel="refentry" href="glib-N-ary-Trees.html" title="N-ary Trees"><link rel="refentry" href="glib-Quarks.html" title="Quarks"><link rel="refentry" href="glib-Keyed-Data-Lists.html" title="Keyed Data Lists"><link rel="refentry" href="glib-Datasets.html" title="Datasets"><link rel="refentry" href="glib-Relations-and-Tuples.html" title="Relations and Tuples"><link rel="refentry" href="glib-Caches.html" title="Caches"><link rel="refentry" href="glib-Memory-Allocators.html" title="Memory Allocators"><link rel="chapter" href="tools.html" title="GLib Tools"><link rel="refentry" href="glib-gettextize.html" title="glib-gettextize"><link rel="index" href="ix01.html" title="Index"><link rel="section" href="glib-Automatic-String-Completion.html#id3199553" title="Description"><link rel="section" href="glib-Automatic-String-Completion.html#id3199706" title="Details"><meta name="generator" content="GTK-Doc V1.2 (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" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="glib-Lexical-Scanner.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="glib-utilities.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="glib-Timers.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr></table><div class="refentry" lang="en"><a name="glib-Automatic-String-Completion"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2><span class="refentrytitle">Automatic String Completion</span></h2><p>Automatic String Completion &#8212; support for automatic completion using a group of target strings.</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">

#include &lt;glib.h&gt;


struct      <a href="glib-Automatic-String-Completion.html#GCompletion">GCompletion</a>;
<a href="glib-Automatic-String-Completion.html#GCompletion">GCompletion</a>* <a href="glib-Automatic-String-Completion.html#g-completion-new">g_completion_new</a>               (<a href="glib-Automatic-String-Completion.html#GCompletionFunc">GCompletionFunc</a> func);
<a href="glib-Basic-Types.html#gchar">gchar</a>*      (<a href="glib-Automatic-String-Completion.html#GCompletionFunc">*GCompletionFunc</a>)              (<a href="glib-Basic-Types.html#gpointer">gpointer</a>);
void        <a href="glib-Automatic-String-Completion.html#g-completion-add-items">g_completion_add_items</a>          (<a href="glib-Automatic-String-Completion.html#GCompletion">GCompletion</a> *cmp,
                                             <a href="glib-Doubly-Linked-Lists.html#GList">GList</a> *items);
void        <a href="glib-Automatic-String-Completion.html#g-completion-remove-items">g_completion_remove_items</a>       (<a href="glib-Automatic-String-Completion.html#GCompletion">GCompletion</a> *cmp,
                                             <a href="glib-Doubly-Linked-Lists.html#GList">GList</a> *items);
void        <a href="glib-Automatic-String-Completion.html#g-completion-clear-items">g_completion_clear_items</a>        (<a href="glib-Automatic-String-Completion.html#GCompletion">GCompletion</a> *cmp);
<a href="glib-Doubly-Linked-Lists.html#GList">GList</a>*      <a href="glib-Automatic-String-Completion.html#g-completion-complete">g_completion_complete</a>           (<a href="glib-Automatic-String-Completion.html#GCompletion">GCompletion</a> *cmp,
                                             const <a href="glib-Basic-Types.html#gchar">gchar</a> *prefix,
                                             <a href="glib-Basic-Types.html#gchar">gchar</a> **new_prefix);
<a href="glib-Doubly-Linked-Lists.html#GList">GList</a>*      <a href="glib-Automatic-String-Completion.html#g-completion-complete-utf8">g_completion_complete_utf8</a>      (<a href="glib-Automatic-String-Completion.html#GCompletion">GCompletion</a> *cmp,
                                             const <a href="glib-Basic-Types.html#gchar">gchar</a> *prefix,
                                             <a href="glib-Basic-Types.html#gchar">gchar</a> **new_prefix);
void        <a href="glib-Automatic-String-Completion.html#g-completion-set-compare">g_completion_set_compare</a>        (<a href="glib-Automatic-String-Completion.html#GCompletion">GCompletion</a> *cmp,
                                             <a href="glib-Automatic-String-Completion.html#GCompletionStrncmpFunc">GCompletionStrncmpFunc</a> strncmp_func);
<a href="glib-Basic-Types.html#gint">gint</a>        (<a href="glib-Automatic-String-Completion.html#GCompletionStrncmpFunc">*GCompletionStrncmpFunc</a>)       (const <a href="glib-Basic-Types.html#gchar">gchar</a> *s1,
                                             const <a href="glib-Basic-Types.html#gchar">gchar</a> *s2,
                                             <a href="glib-Basic-Types.html#gsize">gsize</a> n);
void        <a href="glib-Automatic-String-Completion.html#g-completion-free">g_completion_free</a>               (<a href="glib-Automatic-String-Completion.html#GCompletion">GCompletion</a> *cmp);
</pre></div><div class="refsect1" lang="en"><a name="id3199553"></a><h2>Description</h2><p>
<a href="glib-Automatic-String-Completion.html#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 href="glib-Automatic-String-Completion.html#GCompletion"><span class="type">GCompletion</span></a> is created using <a href="glib-Automatic-String-Completion.html#g-completion-new"><tt class="function">g_completion_new()</tt></a>.
Target items are added and removed with
<a href="glib-Automatic-String-Completion.html#g-completion-add-items"><tt class="function">g_completion_add_items()</tt></a>, <a href="glib-Automatic-String-Completion.html#g-completion-remove-items"><tt class="function">g_completion_remove_items()</tt></a> and
<a href="glib-Automatic-String-Completion.html#g-completion-clear-items"><tt class="function">g_completion_clear_items()</tt></a>.
A completion attempt is requested with <a href="glib-Automatic-String-Completion.html#g-completion-complete"><tt class="function">g_completion_complete()</tt></a>.
When no longer needed, the <a href="glib-Automatic-String-Completion.html#GCompletion"><span class="type">GCompletion</span></a> is freed with <a href="glib-Automatic-String-Completion.html#g-completion-free"><tt class="function">g_completion_free()</tt></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 href="glib-Automatic-String-Completion.html#GCompletionFunc"><span class="type">GCompletionFunc</span></a> in <a href="glib-Automatic-String-Completion.html#g-completion-new"><tt class="function">g_completion_new()</tt></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 href="glib-Automatic-String-Completion.html#GCompletionStrncmpFunc"><span class="type">GCompletionStrncmpFunc</span></a> in <a href="glib-Automatic-String-Completion.html#g-completion-set-compare"><tt class="function">g_completion_set_compare()</tt></a>.
</p></div><div class="refsect1" lang="en"><a name="id3199706"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id3199712"></a><h3><a name="GCompletion"></a>struct GCompletion</h3><a class="indexterm" name="id3199723"></a><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"><col align="left" valign="top"><tbody><tr><td><span class="term"><a href="glib-Doubly-Linked-Lists.html#GList">GList</a> *<i class="structfield"><tt>items</tt></i></span></td><td>list of target items (strings or data structures).
</td></tr><tr><td><span class="term"><a href="glib-Automatic-String-Completion.html#GCompletionFunc">GCompletionFunc</a> <i class="structfield"><tt>func</tt></i></span></td><td>function which is called to get the string associated with a target 
  item. It is <tt class="literal">NULL</tt> if the target items are strings.
</td></tr><tr><td><span class="term"><a href="glib-Basic-Types.html#gchar">gchar</a> *<i class="structfield"><tt>prefix</tt></i></span></td><td>the last prefix passed to <a href="glib-Automatic-String-Completion.html#g-completion-complete"><tt class="function">g_completion_complete()</tt></a>.
</td></tr><tr><td><span class="term"><a href="glib-Doubly-Linked-Lists.html#GList">GList</a> *<i class="structfield"><tt>cache</tt></i></span></td><td>the list of items which begin with <i class="parameter"><tt>prefix</tt></i>.
</td></tr><tr><td><span class="term"><a href="glib-Automatic-String-Completion.html#GCompletionStrncmpFunc">GCompletionStrncmpFunc</a> <i class="structfield"><tt>strncmp_func</tt></i></span></td><td>

</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3199866"></a><h3><a name="g-completion-new"></a>g_completion_new ()</h3><a class="indexterm" name="id3199877"></a><pre class="programlisting"><a href="glib-Automatic-String-Completion.html#GCompletion">GCompletion</a>* g_completion_new               (<a href="glib-Automatic-String-Completion.html#GCompletionFunc">GCompletionFunc</a> func);</pre><p>
Creates a new <a href="glib-Automatic-String-Completion.html#GCompletion"><span class="type">GCompletion</span></a>.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>func</tt></i> :</span></td><td>the function to be called to return the string representing an item
in the <a href="glib-Automatic-String-Completion.html#GCompletion"><span class="type">GCompletion</span></a>, or <tt class="literal">NULL</tt> if strings are going to be used as the
<a href="glib-Automatic-String-Completion.html#GCompletion"><span class="type">GCompletion</span></a> items.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the new <a href="glib-Automatic-String-Completion.html#GCompletion"><span class="type">GCompletion</span></a>.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3199973"></a><h3><a name="GCompletionFunc"></a>GCompletionFunc ()</h3><a class="indexterm" name="id3199984"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>*      (*GCompletionFunc)              (<a href="glib-Basic-Types.html#gpointer">gpointer</a>);</pre><p>
Specifies the type of the function passed to <a href="glib-Automatic-String-Completion.html#g-completion-new"><tt class="function">g_completion_new()</tt></a>.
It should return the string corresponding to the given target item.
This is used when you use data structures as <a href="glib-Automatic-String-Completion.html#GCompletion"><span class="type">GCompletion</span></a> items.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>Param1</tt></i> :</span></td><td>the completion item.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the string corresponding to the item.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3200062"></a><h3><a name="g-completion-add-items"></a>g_completion_add_items ()</h3><a class="indexterm" name="id3200074"></a><pre class="programlisting">void        g_completion_add_items          (<a href="glib-Automatic-String-Completion.html#GCompletion">GCompletion</a> *cmp,
                                             <a href="glib-Doubly-Linked-Lists.html#GList">GList</a> *items);</pre><p>
Adds items to the <a href="glib-Automatic-String-Completion.html#GCompletion"><span class="type">GCompletion</span></a>.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cmp</tt></i> :</span></td><td>the <a href="glib-Automatic-String-Completion.html#GCompletion"><span class="type">GCompletion</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>items</tt></i> :</span></td><td>the list of items to add.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3200158"></a><h3><a name="g-completion-remove-items"></a>g_completion_remove_items ()</h3><a class="indexterm" name="id3200170"></a><pre class="programlisting">void        g_completion_remove_items       (<a href="glib-Automatic-String-Completion.html#GCompletion">GCompletion</a> *cmp,
                                             <a href="glib-Doubly-Linked-Lists.html#GList">GList</a> *items);</pre><p>
Removes items from a <a href="glib-Automatic-String-Completion.html#GCompletion"><span class="type">GCompletion</span></a>.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cmp</tt></i> :</span></td><td>the <a href="glib-Automatic-String-Completion.html#GCompletion"><span class="type">GCompletion</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>items</tt></i> :</span></td><td>the items to remove.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3200253"></a><h3><a name="g-completion-clear-items"></a>g_completion_clear_items ()</h3><a class="indexterm" name="id3200265"></a><pre class="programlisting">void        g_completion_clear_items        (<a href="glib-Automatic-String-Completion.html#GCompletion">GCompletion</a> *cmp);</pre><p>
Removes all items from the <a href="glib-Automatic-String-Completion.html#GCompletion"><span class="type">GCompletion</span></a>.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cmp</tt></i> :</span></td><td>the <a href="glib-Automatic-String-Completion.html#GCompletion"><span class="type">GCompletion</span></a>.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3200327"></a><h3><a name="g-completion-complete"></a>g_completion_complete ()</h3><a class="indexterm" name="id3200339"></a><pre class="programlisting"><a href="glib-Doubly-Linked-Lists.html#GList">GList</a>*      g_completion_complete           (<a href="glib-Automatic-String-Completion.html#GCompletion">GCompletion</a> *cmp,
                                             const <a href="glib-Basic-Types.html#gchar">gchar</a> *prefix,
                                             <a href="glib-Basic-Types.html#gchar">gchar</a> **new_prefix);</pre><p>
Attempts to complete the string <i class="parameter"><tt>prefix</tt></i> using the <a href="glib-Automatic-String-Completion.html#GCompletion"><span class="type">GCompletion</span></a> target items.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cmp</tt></i> :</span></td><td>the <a href="glib-Automatic-String-Completion.html#GCompletion"><span class="type">GCompletion</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>prefix</tt></i> :</span></td><td>the prefix string, typically typed by the user, which is compared
with each of the items.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>new_prefix</tt></i> :</span></td><td>if non-<tt class="literal">NULL</tt>, returns the longest prefix which is common to all
items that matched <i class="parameter"><tt>prefix</tt></i>, or <tt class="literal">NULL</tt> if no items matched <i class="parameter"><tt>prefix</tt></i>.
This string should be freed when no longer needed.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the list of items whose strings begin with <i class="parameter"><tt>prefix</tt></i>. This should
not be changed.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3200495"></a><h3><a name="g-completion-complete-utf8"></a>g_completion_complete_utf8 ()</h3><a class="indexterm" name="id3200507"></a><pre class="programlisting"><a href="glib-Doubly-Linked-Lists.html#GList">GList</a>*      g_completion_complete_utf8      (<a href="glib-Automatic-String-Completion.html#GCompletion">GCompletion</a> *cmp,
                                             const <a href="glib-Basic-Types.html#gchar">gchar</a> *prefix,
                                             <a href="glib-Basic-Types.html#gchar">gchar</a> **new_prefix);</pre><p>
Attempts to complete the string <i class="parameter"><tt>prefix</tt></i> using the <a href="glib-Automatic-String-Completion.html#GCompletion"><span class="type">GCompletion</span></a> target items.
In contrast to <a href="glib-Automatic-String-Completion.html#g-completion-complete"><tt class="function">g_completion_complete()</tt></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 href="glib-Automatic-String-Completion.html#g-completion-complete"><tt class="function">g_completion_complete()</tt></a> if your 
items are UTF-8 strings.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cmp</tt></i> :</span></td><td> the <a href="glib-Automatic-String-Completion.html#GCompletion"><span class="type">GCompletion</span></a>
</td></tr><tr><td><span class="term"><i class="parameter"><tt>prefix</tt></i> :</span></td><td> the prefix string, typically used by the user, which is compared
   with each of the items
</td></tr><tr><td><span class="term"><i class="parameter"><tt>new_prefix</tt></i> :</span></td><td> if non-<tt class="literal">NULL</tt>, returns the longest prefix which is common to all
   items that matched <i class="parameter"><tt>prefix</tt></i>, or <tt class="literal">NULL</tt> if no items matched <i class="parameter"><tt>prefix</tt></i>.
   This string should be freed when no longer needed.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> the list of items whose strings begin with <i class="parameter"><tt>prefix</tt></i>. This should
not be changed.

</td></tr></tbody></table></div><p>Since  2.4
</p></div><hr><div class="refsect2" lang="en"><a name="id3200700"></a><h3><a name="g-completion-set-compare"></a>g_completion_set_compare ()</h3><a class="indexterm" name="id3200711"></a><pre class="programlisting">void        g_completion_set_compare        (<a href="glib-Automatic-String-Completion.html#GCompletion">GCompletion</a> *cmp,
                                             <a href="glib-Automatic-String-Completion.html#GCompletionStrncmpFunc">GCompletionStrncmpFunc</a> strncmp_func);</pre><p>
Sets the function to use for string comparisons. The default
string comparison function is <tt class="function"><tt class="function">strncmp()</tt></tt>.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cmp</tt></i> :</span></td><td>a <a href="glib-Automatic-String-Completion.html#GCompletion"><span class="type">GCompletion</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>strncmp_func</tt></i> :</span></td><td>the string comparison function.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3200804"></a><h3><a name="GCompletionStrncmpFunc"></a>GCompletionStrncmpFunc ()</h3><a class="indexterm" name="id3200816"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gint">gint</a>        (*GCompletionStrncmpFunc)       (const <a href="glib-Basic-Types.html#gchar">gchar</a> *s1,
                                             const <a href="glib-Basic-Types.html#gchar">gchar</a> *s2,
                                             <a href="glib-Basic-Types.html#gsize">gsize</a> n);</pre><p>
Specifies the type of the function passed to <a href="glib-Automatic-String-Completion.html#g-completion-set-compare"><tt class="function">g_completion_set_compare()</tt></a>.
This is used when you use strings as <a href="glib-Automatic-String-Completion.html#GCompletion"><span class="type">GCompletion</span></a> items.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>s1</tt></i> :</span></td><td>string to compare with <i class="parameter"><tt>s2</tt></i>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>s2</tt></i> :</span></td><td>string to compare with <i class="parameter"><tt>s1</tt></i>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>n</tt></i> :</span></td><td>maximal number of bytes to compare.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>an integer less than, equal to, or greater than zero if the 
first <i class="parameter"><tt>n</tt></i> bytes of <i class="parameter"><tt>s1</tt></i> is found, respectively, to be less than, to match, 
or to be greater than the first <i class="parameter"><tt>n</tt></i> bytes of <i class="parameter"><tt>s2</tt></i>.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3200972"></a><h3><a name="g-completion-free"></a>g_completion_free ()</h3><a class="indexterm" name="id3200983"></a><pre class="programlisting">void        g_completion_free               (<a href="glib-Automatic-String-Completion.html#GCompletion">GCompletion</a> *cmp);</pre><p>
Frees all memory used by the <a href="glib-Automatic-String-Completion.html#GCompletion"><span class="type">GCompletion</span></a>.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cmp</tt></i> :</span></td><td>the <a href="glib-Automatic-String-Completion.html#GCompletion"><span class="type">GCompletion</span></a>.


</td></tr></tbody></table></div></div></div></div><table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"><td align="left"><a accesskey="p" href="glib-Lexical-Scanner.html"><b>&lt;&lt; Lexical Scanner</b></a></td><td align="right"><a accesskey="n" href="glib-Timers.html"><b>Timers &gt;&gt;</b></a></td></tr></table></body></html>