📄 glib-error-reporting.html
字号:
<a name="id2925797"></a><h3><a name="g-error-new-literal"></a>g_error_new_literal ()</h3><a class="indexterm" name="id2925808"></a><pre class="programlisting"><a href="glib-Error-Reporting.html#GError">GError</a>* g_error_new_literal (<a href="glib-Quarks.html#GQuark">GQuark</a> domain, <a href="glib-Basic-Types.html#gint">gint</a> code, const <a href="glib-Basic-Types.html#gchar">gchar</a> *message);</pre><p>Creates a new <a href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a>; unlike <a href="glib-Error-Reporting.html#g-error-new"><code class="function">g_error_new()</code></a>, <em class="parameter"><code>message</code></em> is nota <code class="function">printf()</code>-style format string. Use this function if <em class="parameter"><code>message</code></em> contains text you don't have control over, that could include <code class="function">printf()</code> escape sequences.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>domain</code></em> :</span></td><td> error domain</td></tr><tr><td><span class="term"><em class="parameter"><code>code</code></em> :</span></td><td> error code</td></tr><tr><td><span class="term"><em class="parameter"><code>message</code></em> :</span></td><td> error message</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> a new <a href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2925971"></a><h3><a name="g-error-free"></a>g_error_free ()</h3><a class="indexterm" name="id2925981"></a><pre class="programlisting">void g_error_free (<a href="glib-Error-Reporting.html#GError">GError</a> *error);</pre><p>Frees a <a href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a> and associated resources.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>error</code></em> :</span></td><td> a <a href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2926046"></a><h3><a name="g-error-copy"></a>g_error_copy ()</h3><a class="indexterm" name="id2926057"></a><pre class="programlisting"><a href="glib-Error-Reporting.html#GError">GError</a>* g_error_copy (const <a href="glib-Error-Reporting.html#GError">GError</a> *error);</pre><p>Makes a copy of <em class="parameter"><code>error</code></em>.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>error</code></em> :</span></td><td> a <a href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a></td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> a new <a href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2926138"></a><h3><a name="g-error-matches"></a>g_error_matches ()</h3><a class="indexterm" name="id2926149"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gboolean">gboolean</a> g_error_matches (const <a href="glib-Error-Reporting.html#GError">GError</a> *error, <a href="glib-Quarks.html#GQuark">GQuark</a> domain, <a href="glib-Basic-Types.html#gint">gint</a> code);</pre><p>Returns <code class="literal">TRUE</code> if <em class="parameter"><code>error</code></em> matches <em class="parameter"><code>domain</code></em> and <em class="parameter"><code>code</code></em>, <code class="literal">FALSE</code>otherwise.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>error</code></em> :</span></td><td> a <a href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a></td></tr><tr><td><span class="term"><em class="parameter"><code>domain</code></em> :</span></td><td> an error domain</td></tr><tr><td><span class="term"><em class="parameter"><code>code</code></em> :</span></td><td> an error code</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> whether <em class="parameter"><code>error</code></em> has <em class="parameter"><code>domain</code></em> and <em class="parameter"><code>code</code></em></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2926307"></a><h3><a name="g-set-error"></a>g_set_error ()</h3><a class="indexterm" name="id2926318"></a><pre class="programlisting">void g_set_error (<a href="glib-Error-Reporting.html#GError">GError</a> **err, <a href="glib-Quarks.html#GQuark">GQuark</a> domain, <a href="glib-Basic-Types.html#gint">gint</a> code, const <a href="glib-Basic-Types.html#gchar">gchar</a> *format, ...);</pre><p>Does nothing if <em class="parameter"><code>err</code></em> is <code class="literal">NULL</code>; if <em class="parameter"><code>err</code></em> is non-<code class="literal">NULL</code>, then *<em class="parameter"><code>err</code></em> mustbe <code class="literal">NULL</code>. A new <a href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a> is created and assigned to *<em class="parameter"><code>err</code></em>.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>err</code></em> :</span></td><td> a return location for a <a href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <code class="literal">NULL</code></td></tr><tr><td><span class="term"><em class="parameter"><code>domain</code></em> :</span></td><td> error domain</td></tr><tr><td><span class="term"><em class="parameter"><code>code</code></em> :</span></td><td> error code </td></tr><tr><td><span class="term"><em class="parameter"><code>format</code></em> :</span></td><td> <code class="function">printf()</code>-style format</td></tr><tr><td><span class="term"><em class="parameter"><code>...</code></em> :</span></td><td> args for <em class="parameter"><code>format</code></em> </td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2926525"></a><h3><a name="g-propagate-error"></a>g_propagate_error ()</h3><a class="indexterm" name="id2926536"></a><pre class="programlisting">void g_propagate_error (<a href="glib-Error-Reporting.html#GError">GError</a> **dest, <a href="glib-Error-Reporting.html#GError">GError</a> *src);</pre><p>If <em class="parameter"><code>dest</code></em> is <code class="literal">NULL</code>, free <em class="parameter"><code>src</code></em>; otherwise,moves <em class="parameter"><code>src</code></em> into *<em class="parameter"><code>dest</code></em>. *<em class="parameter"><code>dest</code></em> must be <code class="literal">NULL</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>dest</code></em> :</span></td><td> error return location</td></tr><tr><td><span class="term"><em class="parameter"><code>src</code></em> :</span></td><td> error to move into the return location</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2926649"></a><h3><a name="g-clear-error"></a>g_clear_error ()</h3><a class="indexterm" name="id2926659"></a><pre class="programlisting">void g_clear_error (<a href="glib-Error-Reporting.html#GError">GError</a> **err);</pre><p>If <em class="parameter"><code>err</code></em> is <code class="literal">NULL</code>, does nothing. If <em class="parameter"><code>err</code></em> is non-<code class="literal">NULL</code>,calls <a href="glib-Error-Reporting.html#g-error-free"><code class="function">g_error_free()</code></a> on *<em class="parameter"><code>err</code></em> and sets *<em class="parameter"><code>err</code></em> to <code class="literal">NULL</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>err</code></em> :</span></td><td> a <a href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a> return location</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-IO-Channels.html"><b><< IO Channels</b></a></td><td align="right"><a accesskey="n" href="glib-Warnings-and-Assertions.html"><b>Message Output and Debugging Functions >></b></a></td></tr></table></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -