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

📄 glib-string-chunks.html

📁 glid编写实例
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<tr><td><span class="term"><em class="parameter"><code>chunk</code></em>&#160;:</span></td><td>a <a href="glib-String-Chunks.html#GStringChunk"><span class="type">GStringChunk</span></a>.</td></tr><tr><td><span class="term"><em class="parameter"><code>string</code></em>&#160;:</span></td><td>the string to add.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td><td>a pointer to the copy of <em class="parameter"><code>string</code></em> within the <a href="glib-String-Chunks.html#GStringChunk"><span class="type">GStringChunk</span></a>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3155259"></a><h3><a name="g-string-chunk-insert-const"></a>g_string_chunk_insert_const ()</h3><a class="indexterm" name="id3155270"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>*      g_string_chunk_insert_const     (<a href="glib-String-Chunks.html#GStringChunk">GStringChunk</a> *chunk,                                             const <a href="glib-Basic-Types.html#gchar">gchar</a> *string);</pre><p>Adds a copy of <em class="parameter"><code>string</code></em> to the <a href="glib-String-Chunks.html#GStringChunk"><span class="type">GStringChunk</span></a>, unless the same string hasalready been added to the <a href="glib-String-Chunks.html#GStringChunk"><span class="type">GStringChunk</span></a> with <a href="glib-String-Chunks.html#g-string-chunk-insert-const"><code class="function">g_string_chunk_insert_const()</code></a>.</p><p>This function is useful if you need to copy a large number of stringsbut do not want to waste space storing duplicates. But you must rememberthat there may be several pointers to the same string, and so any changesmade to the strings should be done very carefully.</p><p>Note that <a href="glib-String-Chunks.html#g-string-chunk-insert-const"><code class="function">g_string_chunk_insert_const()</code></a> will not return a pointer to a stringadded with <a href="glib-String-Chunks.html#g-string-chunk-insert"><code class="function">g_string_chunk_insert()</code></a>, even if they do match.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>chunk</code></em>&#160;:</span></td><td>a <a href="glib-String-Chunks.html#GStringChunk"><span class="type">GStringChunk</span></a>.</td></tr><tr><td><span class="term"><em class="parameter"><code>string</code></em>&#160;:</span></td><td>the string to add.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td><td>a pointer to the new or existing copy of <em class="parameter"><code>string</code></em> within the<a href="glib-String-Chunks.html#GStringChunk"><span class="type">GStringChunk</span></a>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3155441"></a><h3><a name="g-string-chunk-insert-len"></a>g_string_chunk_insert_len ()</h3><a class="indexterm" name="id3155452"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>*      g_string_chunk_insert_len       (<a href="glib-String-Chunks.html#GStringChunk">GStringChunk</a> *chunk,                                             const <a href="glib-Basic-Types.html#gchar">gchar</a> *string,                                             <a href="glib-Basic-Types.html#gssize">gssize</a> len);</pre><p>Adds a copy of the first <em class="parameter"><code>len</code></em> bytes of <em class="parameter"><code>string</code></em> to the <a href="glib-String-Chunks.html#GStringChunk"><span class="type">GStringChunk</span></a>. Thecopy is nul-terminated.</p><p>The characters in the string can be changed, if necessary, though youshould not change anything after the end of the string.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>chunk</code></em>&#160;:</span></td><td> a <a href="glib-String-Chunks.html#GStringChunk"><span class="type">GStringChunk</span></a></td></tr><tr><td><span class="term"><em class="parameter"><code>string</code></em>&#160;:</span></td><td> bytes to insert</td></tr><tr><td><span class="term"><em class="parameter"><code>len</code></em>&#160;:</span></td><td> number of bytes of <em class="parameter"><code>string</code></em> to insert, or -1 to insert a     nul-terminated string. </td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td><td> a pointer to the copy of <em class="parameter"><code>string</code></em> within the <a href="glib-String-Chunks.html#GStringChunk"><span class="type">GStringChunk</span></a></td></tr></tbody></table></div><p>Since  2.4</p></div><hr><div class="refsect2" lang="en"><a name="id3155615"></a><h3><a name="g-string-chunk-free"></a>g_string_chunk_free ()</h3><a class="indexterm" name="id3155627"></a><pre class="programlisting">void        g_string_chunk_free             (<a href="glib-String-Chunks.html#GStringChunk">GStringChunk</a> *chunk);</pre><p>Frees all memory allocated by the <a href="glib-String-Chunks.html#GStringChunk"><span class="type">GStringChunk</span></a>.After calling <a href="glib-String-Chunks.html#g-string-chunk-free"><code class="function">g_string_chunk_free()</code></a> it is not safe toaccess any of the strings which were contained within it.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>chunk</code></em>&#160;:</span></td><td>a <a href="glib-String-Chunks.html#GStringChunk"><span class="type">GStringChunk</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-Strings.html"><b>&lt;&lt;&#160;Strings</b></a></td><td align="right"><a accesskey="n" href="glib-Arrays.html"><b>Arrays&#160;&gt;&gt;</b></a></td></tr></table></body></html>

⌨️ 快捷键说明

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