📄 glib-key-value-file-parser.html
字号:
<div class="refsect2" lang="en"><a name="id3085127"></a><h3><a name="g-key-file-get-locale-string"></a>g_key_file_get_locale_string ()</h3><a class="indexterm" name="id3085137"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>* g_key_file_get_locale_string (<a href="glib-Key-value-file-parser.html#GKeyFile">GKeyFile</a> *key_file, const <a href="glib-Basic-Types.html#gchar">gchar</a> *group_name, const <a href="glib-Basic-Types.html#gchar">gchar</a> *key, const <a href="glib-Basic-Types.html#gchar">gchar</a> *locale, <a href="glib-Error-Reporting.html#GError">GError</a> **error);</pre><p>Returns the value associated with <em class="parameter"><code>key</code></em> under <em class="parameter"><code>group_name</code></em>translated in the given <em class="parameter"><code>locale</code></em> if available. If <em class="parameter"><code>locale</code></em> is<code class="literal">NULL</code> then the current locale is assumed. </p><p>If <em class="parameter"><code>key</code></em> cannot be found then <code class="literal">NULL</code> is returned and <em class="parameter"><code>error</code></em> is set to<span class="type">G_KEY_FILE_ERROR_KEY_NOT_FOUND</span>. If the value associatedwith <em class="parameter"><code>key</code></em> cannot be interpreted or no suitable translation canbe found then the untranslated value is returned.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>key_file</code></em> :</span></td><td> a <a href="glib-Key-value-file-parser.html#GKeyFile"><span class="type">GKeyFile</span></a></td></tr><tr><td><span class="term"><em class="parameter"><code>group_name</code></em> :</span></td><td> a group name</td></tr><tr><td><span class="term"><em class="parameter"><code>key</code></em> :</span></td><td> a key</td></tr><tr><td><span class="term"><em class="parameter"><code>locale</code></em> :</span></td><td> a locale or <code class="literal">NULL</code></td></tr><tr><td><span class="term"><em class="parameter"><code>error</code></em> :</span></td><td> 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"><span class="emphasis"><em>Returns</em></span> :</span></td><td> a newly allocated string or <code class="literal">NULL</code> if the specified key cannot be found.</td></tr></tbody></table></div><p>Since 2.6</p></div><hr><div class="refsect2" lang="en"><a name="id3085363"></a><h3><a name="g-key-file-get-boolean"></a>g_key_file_get_boolean ()</h3><a class="indexterm" name="id3085372"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gboolean">gboolean</a> g_key_file_get_boolean (<a href="glib-Key-value-file-parser.html#GKeyFile">GKeyFile</a> *key_file, const <a href="glib-Basic-Types.html#gchar">gchar</a> *group_name, const <a href="glib-Basic-Types.html#gchar">gchar</a> *key, <a href="glib-Error-Reporting.html#GError">GError</a> **error);</pre><p>Returns the value associated with <em class="parameter"><code>key</code></em> under <em class="parameter"><code>group_name</code></em> as aboolean. </p><p>If <em class="parameter"><code>key</code></em> cannot be found then the return value is undefined and<em class="parameter"><code>error</code></em> is set to <span class="type">G_KEY_FILE_ERROR_KEY_NOT_FOUND</span>. Likewise, ifthe value associated with <em class="parameter"><code>key</code></em> cannot be interpreted as a booleanthen the return value is also undefined and <em class="parameter"><code>error</code></em> is set to<span class="type">G_KEY_FILE_ERROR_INVALID_VALUE</span>.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>key_file</code></em> :</span></td><td> a <a href="glib-Key-value-file-parser.html#GKeyFile"><span class="type">GKeyFile</span></a></td></tr><tr><td><span class="term"><em class="parameter"><code>group_name</code></em> :</span></td><td> a group name</td></tr><tr><td><span class="term"><em class="parameter"><code>key</code></em> :</span></td><td> a key</td></tr><tr><td><span class="term"><em class="parameter"><code>error</code></em> :</span></td><td> return location for 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> the value associated with the key as a boolean</td></tr></tbody></table></div><p>Since 2.6</p></div><hr><div class="refsect2" lang="en"><a name="id3085555"></a><h3><a name="g-key-file-get-integer"></a>g_key_file_get_integer ()</h3><a class="indexterm" name="id3085563"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gint">gint</a> g_key_file_get_integer (<a href="glib-Key-value-file-parser.html#GKeyFile">GKeyFile</a> *key_file, const <a href="glib-Basic-Types.html#gchar">gchar</a> *group_name, const <a href="glib-Basic-Types.html#gchar">gchar</a> *key, <a href="glib-Error-Reporting.html#GError">GError</a> **error);</pre><p>Returns the value associated with <em class="parameter"><code>key</code></em> under <em class="parameter"><code>group_name</code></em> as aninteger. If <em class="parameter"><code>group_name</code></em> is <code class="literal">NULL</code>, the start_group is used.</p><p>If <em class="parameter"><code>key</code></em> cannot be found then the return value is undefined and<em class="parameter"><code>error</code></em> is set to <span class="type">G_KEY_FILE_ERROR_KEY_NOT_FOUND</span>. Likewise, ifthe value associated with <em class="parameter"><code>key</code></em> cannot be interpreted as an integerthen the return value is also undefined and <em class="parameter"><code>error</code></em> is set to<span class="type">G_KEY_FILE_ERROR_INVALID_VALUE</span>.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>key_file</code></em> :</span></td><td> a <a href="glib-Key-value-file-parser.html#GKeyFile"><span class="type">GKeyFile</span></a></td></tr><tr><td><span class="term"><em class="parameter"><code>group_name</code></em> :</span></td><td> a group name</td></tr><tr><td><span class="term"><em class="parameter"><code>key</code></em> :</span></td><td> a key</td></tr><tr><td><span class="term"><em class="parameter"><code>error</code></em> :</span></td><td> return location for 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> the value associated with the key as an integer.</td></tr></tbody></table></div><p>Since 2.6</p></div><hr><div class="refsect2" lang="en"><a name="id3085756"></a><h3><a name="g-key-file-get-string-list"></a>g_key_file_get_string_list ()</h3><a class="indexterm" name="id3085765"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>** g_key_file_get_string_list (<a href="glib-Key-value-file-parser.html#GKeyFile">GKeyFile</a> *key_file, const <a href="glib-Basic-Types.html#gchar">gchar</a> *group_name, const <a href="glib-Basic-Types.html#gchar">gchar</a> *key, <a href="glib-Basic-Types.html#gsize">gsize</a> *length, <a href="glib-Error-Reporting.html#GError">GError</a> **error);</pre><p>Returns the values associated with <em class="parameter"><code>key</code></em> under <em class="parameter"><code>group_name</code></em>.</p><p>In the event the key cannot be found, <code class="literal">NULL</code> is returned and<em class="parameter"><code>error</code></em> is set to <span class="type">G_KEY_FILE_ERROR_KEY_NOT_FOUND</span>. In theevent that the <em class="parameter"><code>group_name</code></em> cannot be found, <code class="literal">NULL</code> is returnedand <em class="parameter"><code>error</code></em> is set to <span class="type">G_KEY_FILE_ERROR_GROUP_NOT_FOUND</span>.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>key_file</code></em> :</span></td><td> a <a href="glib-Key-value-file-parser.html#GKeyFile"><span class="type">GKeyFile</span></a></td></tr><tr><td><span class="term"><em class="parameter"><code>group_name</code></em> :</span></td><td> a group name</td></tr><tr><td><span class="term"><em class="parameter"><code>key</code></em> :</span></td><td> a key</td></tr><tr><td><span class="term"><em class="parameter"><code>length</code></em> :</span></td><td> return location for the number of returned strings, or <code class="literal">NULL</code></td></tr><tr><td><span class="term"><em class="parameter"><code>error</code></em> :</span></td><td> 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"><span class="emphasis"><em>Returns</em></span> :</span></td><td> a <code class="literal">NULL</code>-terminated string array or <code class="literal">NULL</code> if the specified key cannot be found. The array should be freed with <a href="glib-String-Utility-Functions.html#g-strfreev"><code class="function">g_strfreev()</code></a>.</td></tr></tbody></table></div><p>Since 2.6</p></div><hr><div class="refsect2" lang="en"><a name="id3086002"></a><h3><a name="g-key-file-get-locale-string-list"></a>g_key_file_get_locale_string_list ()</h3><a class="indexterm" name="id3086013"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>** g_key_file_get_locale_string_list (<a href="glib-Key-value-file-parser.html#GKeyFile">GKeyFile</a> *key_file, const <a href="glib-Basic-Types.html#gchar">gchar</a> *group_name, const
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -