⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 glib-quarks.html

📁 glid编写实例
💻 HTML
字号:
<html xmlns:cf="http://docbook.sourceforge.net/xmlns/chunkfast/1.0"><head><meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"><title>Quarks</title><meta name="generator" content="DocBook XSL Stylesheets V1.69.0"><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.4 (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"></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-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></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><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);</pre></div><div class="refsect1" lang="en"><a name="id3190347"></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 toretrieve the other.</p><p>Quarks are used for bothDatasets andKeyed 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></div><div class="refsect1" lang="en"><a name="id3190459"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id3190464"></a><h3><a name="GQuark"></a>GQuark</h3><a class="indexterm" name="id3190474"></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="id3190490"></a><h3><a name="g-quark-from-string"></a>g_quark_from_string ()</h3><a class="indexterm" name="id3190501"></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="id3190591"></a><h3><a name="g-quark-from-static-string"></a>g_quark_from_static_string ()</h3><a class="indexterm" name="id3190603"></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> exceptthat if a new <a href="glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> is created the string itself is used rather thana 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 staticallyallocated strings in the main program, but not with statically allocated memory in dynamically loaded modules, if you expect toever unload the module again (e.g. do not use this function inGTK+ 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="id3190726"></a><h3><a name="g-quark-to-string"></a>g_quark_to_string ()</h3><a class="indexterm" name="id3190737"></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="id3190819"></a><h3><a name="g-quark-try-string"></a>g_quark_try_string ()</h3><a class="indexterm" name="id3190829"></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 hasno 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></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-N-ary-Trees.html"><b>&lt;&lt;&#160;N-ary Trees</b></a></td><td align="right"><a accesskey="n" href="glib-Keyed-Data-Lists.html"><b>Keyed Data Lists&#160;&gt;&gt;</b></a></td></tr></table></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -