KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17
System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64
User : nobody ( 99)
PHP Version : 5.2.17
Disable Function : NONE
Directory :  /usr/share/gtk-doc/html/glib/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/share/gtk-doc/html/glib/glib-Quarks.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Quarks</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
<link rel="start" href="index.html" title="GLib Reference Manual">
<link rel="up" href="glib-data-types.html" title="GLib Data Types">
<link rel="prev" href="glib-N-ary-Trees.html" title="N-ary Trees">
<link rel="next" href="glib-Keyed-Data-Lists.html" title="Keyed Data Lists">
<meta name="generator" content="GTK-Doc V1.6 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="glib.html" title="GLib Overview">
<link rel="chapter" href="glib-fundamentals.html" title="GLib Fundamentals">
<link rel="chapter" href="glib-core.html" title="GLib Core Application Support">
<link rel="chapter" href="glib-utilities.html" title="GLib Utilities">
<link rel="chapter" href="glib-data-types.html" title="GLib Data Types">
<link rel="chapter" href="tools.html" title="GLib Tools">
<link rel="index" href="ix01.html" title="Index">
<link rel="index" href="ix02.html" title="Index of deprecated symbols">
<link rel="index" href="ix03.html" title="Index of new symbols in 2.2">
<link rel="index" href="ix04.html" title="Index of new symbols in 2.4">
<link rel="index" href="ix05.html" title="Index of new symbols in 2.6">
<link rel="index" href="ix06.html" title="Index of new symbols in 2.8">
<link rel="index" href="ix07.html" title="Index of new symbols in 2.10">
<link rel="index" href="ix08.html" title="Index of new symbols in 2.12">
</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-N-ary-Trees.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="glib-data-types.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-Keyed-Data-Lists.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id3292109" class="shortcut">Top</a>
                  &#160;|&#160;
                  <a href="#id3292263" class="shortcut">Description</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="glib-Quarks"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id3292109"></a><span class="refentrytitle">Quarks</span>
</h2>
<p>Quarks &#8212; a 2-way association between a string and a unique integer identifier.</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">

#include &lt;glib.h&gt;


typedef     <a href="glib-Quarks.html#GQuark">GQuark</a>;
<a href="glib-Quarks.html#GQuark">GQuark</a>      <a href="glib-Quarks.html#g-quark-from-string">g_quark_from_string</a>             (const <a href="glib-Basic-Types.html#gchar">gchar</a> *string);
<a href="glib-Quarks.html#GQuark">GQuark</a>      <a href="glib-Quarks.html#g-quark-from-static-string">g_quark_from_static_string</a>      (const <a href="glib-Basic-Types.html#gchar">gchar</a> *string);
const <a href="glib-Basic-Types.html#gchar">gchar</a>* <a href="glib-Quarks.html#g-quark-to-string">g_quark_to_string</a>              (<a href="glib-Quarks.html#GQuark">GQuark</a> quark);
<a href="glib-Quarks.html#GQuark">GQuark</a>      <a href="glib-Quarks.html#g-quark-try-string">g_quark_try_string</a>              (const <a href="glib-Basic-Types.html#gchar">gchar</a> *string);
const <a href="glib-Basic-Types.html#gchar">gchar</a>* <a href="glib-Quarks.html#g-intern-string">g_intern_string</a>                (const <a href="glib-Basic-Types.html#gchar">gchar</a> *string);
const <a href="glib-Basic-Types.html#gchar">gchar</a>* <a href="glib-Quarks.html#g-intern-static-string">g_intern_static_string</a>         (const <a href="glib-Basic-Types.html#gchar">gchar</a> *string);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id3292263"></a><h2>Description</h2>
<p>
Quarks are associations between strings and integer identifiers.
Given either the string or the <a href="glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> identifier it is possible to
retrieve the other.
</p>
<p>
Quarks are used for both
Datasets and
Keyed Data Lists.
</p>
<p>
To create a new quark from a string, use <a href="glib-Quarks.html#g-quark-from-string"><code class="function">g_quark_from_string()</code></a> or
<a href="glib-Quarks.html#g-quark-from-static-string"><code class="function">g_quark_from_static_string()</code></a>.
</p>
<p>
To find the string corresponding to a given <a href="glib-Quarks.html#GQuark"><span class="type">GQuark</span></a>, use <a href="glib-Quarks.html#g-quark-to-string"><code class="function">g_quark_to_string()</code></a>.
</p>
<p>
To find the <a href="glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> corresponding to a given string, use <a href="glib-Quarks.html#g-quark-try-string"><code class="function">g_quark_try_string()</code></a>.
</p>
<p>
Another use for the string pool maintained for the quark functions is string
interning, using <a href="glib-Quarks.html#g-intern-string"><code class="function">g_intern_string()</code></a> or <a href="glib-Quarks.html#g-intern-static-string"><code class="function">g_intern_static_string()</code></a>. An interned string 
is a canonical representation for a string. One important advantage of interned strings 
is that they can be compared for equality by a simple pointer comparision, rather than 
using <code class="function">strcmp()</code>. 
</p>
</div>
<div class="refsect1" lang="en">
<a name="id3292419"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id3292430"></a><h3>
<a name="GQuark"></a>GQuark</h3>
<a class="indexterm" name="id3292442"></a><pre class="programlisting">typedef guint32 GQuark;
</pre>
<p>
A GQuark is an integer which uniquely identifies a particular string.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3292458"></a><h3>
<a name="g-quark-from-string"></a>g_quark_from_string ()</h3>
<a class="indexterm" name="id3292471"></a><pre class="programlisting"><a href="glib-Quarks.html#GQuark">GQuark</a>      g_quark_from_string             (const <a href="glib-Basic-Types.html#gchar">gchar</a> *string);</pre>
<p>
Gets the <a href="glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> identifying the given string.
If the string does not currently have an associated <a href="glib-Quarks.html#GQuark"><span class="type">GQuark</span></a>, a new
<a href="glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> is created, using a copy of the string.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>string</code></em>&#160;:</span></td>
<td>a string.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td>the <a href="glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> identifying the string.


</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3292561"></a><h3>
<a name="g-quark-from-static-string"></a>g_quark_from_static_string ()</h3>
<a class="indexterm" name="id3292575"></a><pre class="programlisting"><a href="glib-Quarks.html#GQuark">GQuark</a>      g_quark_from_static_string      (const <a href="glib-Basic-Types.html#gchar">gchar</a> *string);</pre>
<p>
Gets the <a href="glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> identifying the given (static) string.
If the string does not currently have an associated <a href="glib-Quarks.html#GQuark"><span class="type">GQuark</span></a>, a new
<a href="glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> is created, linked to the given string.
</p>
<p>
Note that this function is identical to <a href="glib-Quarks.html#g-quark-from-string"><code class="function">g_quark_from_string()</code></a> except
that if a new <a href="glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> is created the string itself is used rather than
a copy. This saves memory, but can only be used if the string will
<span class="emphasis"><em>always</em></span> exist. It can be used with statically
allocated strings in the main program, but not with statically 
allocated memory in dynamically loaded modules, if you expect to
ever unload the module again (e.g. do not use this function in
GTK+ theme engines).
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>string</code></em>&#160;:</span></td>
<td>a string.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td>the <a href="glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> identifying the string.


</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3292698"></a><h3>
<a name="g-quark-to-string"></a>g_quark_to_string ()</h3>
<a class="indexterm" name="id3292711"></a><pre class="programlisting">const <a href="glib-Basic-Types.html#gchar">gchar</a>* g_quark_to_string              (<a href="glib-Quarks.html#GQuark">GQuark</a> quark);</pre>
<p>
Gets the string associated with the given <a href="glib-Quarks.html#GQuark"><span class="type">GQuark</span></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>quark</code></em>&#160;:</span></td>
<td>a <a href="glib-Quarks.html#GQuark"><span class="type">GQuark</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td>the string associated with the <a href="glib-Quarks.html#GQuark"><span class="type">GQuark</span></a>.


</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3292793"></a><h3>
<a name="g-quark-try-string"></a>g_quark_try_string ()</h3>
<a class="indexterm" name="id3292807"></a><pre class="programlisting"><a href="glib-Quarks.html#GQuark">GQuark</a>      g_quark_try_string              (const <a href="glib-Basic-Types.html#gchar">gchar</a> *string);</pre>
<p>
Gets the <a href="glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> associated with the given string, or 0 if the string has
no associated <a href="glib-Quarks.html#GQuark"><span class="type">GQuark</span></a>.
</p>
<p>
If you want the GQuark to be created if it doesn't already exist, use
<a href="glib-Quarks.html#g-quark-from-string"><code class="function">g_quark_from_string()</code></a> or <a href="glib-Quarks.html#g-quark-from-static-string"><code class="function">g_quark_from_static_string()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>string</code></em>&#160;:</span></td>
<td>a string.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td>the <a href="glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> associated with the string, or 0 if there is no
<a href="glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> associated with the string.


</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3292924"></a><h3>
<a name="g-intern-string"></a>g_intern_string ()</h3>
<a class="indexterm" name="id3292938"></a><pre class="programlisting">const <a href="glib-Basic-Types.html#gchar">gchar</a>* g_intern_string                (const <a href="glib-Basic-Types.html#gchar">gchar</a> *string);</pre>
<p>
Returns a canonical representation for <em class="parameter"><code>string</code></em>. Interned strings can
be compared for equality by comparing the pointers, instead of using <code class="function">strcmp()</code>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>string</code></em>&#160;:</span></td>
<td> a string
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> a canonical representation for the string

</td>
</tr>
</tbody>
</table></div>
<p>Since  2.10
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3293023"></a><h3>
<a name="g-intern-static-string"></a>g_intern_static_string ()</h3>
<a class="indexterm" name="id3293039"></a><pre class="programlisting">const <a href="glib-Basic-Types.html#gchar">gchar</a>* g_intern_static_string         (const <a href="glib-Basic-Types.html#gchar">gchar</a> *string);</pre>
<p>
Returns a canonical representation for <em class="parameter"><code>string</code></em>. Interned strings can
be compared for equality by comparing the pointers, instead of using <code class="function">strcmp()</code>.
<a href="glib-Quarks.html#g-intern-static-string"><code class="function">g_intern_static_string()</code></a> does not copy the string, therefore <em class="parameter"><code>string</code></em> must
not be freed or modified.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>string</code></em>&#160;:</span></td>
<td> a static string
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> a canonical representation for the string

</td>
</tr>
</tbody>
</table></div>
<p>Since  2.10
</p>
</div>
</div>
</div>
</body>
</html>

Anon7 - 2021