📄 glib-key-value-file-parser.html
字号:
specified in <em class="parameter"><code>search_dirs</code></em>, loads the file into <em class="parameter"><code>key_file</code></em> andreturns the file's full path in <em class="parameter"><code>full_path</code></em>. If the file could notbe loaded then an <code class="literal">error</code> is set to either a <a class="link" href="glib-File-Utilities.html#GFileError"><span class="type">GFileError</span></a> or<a class="link" href="glib-Key-value-file-parser.html#GKeyFileError"><span class="type">GKeyFileError</span></a>.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>key_file</code></em> :</span></p></td><td> an empty <a class="link" href="glib-Key-value-file-parser.html#GKeyFile"><span class="type">GKeyFile</span></a> struct</td></tr><tr><td><p><span class="term"><em class="parameter"><code>file</code></em> :</span></p></td><td> a relative path to a filename to open and parse</td></tr><tr><td><p><span class="term"><em class="parameter"><code>search_dirs</code></em> :</span></p></td><td> <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated array of directories to search</td></tr><tr><td><p><span class="term"><em class="parameter"><code>full_path</code></em> :</span></p></td><td> return location for a string containing the full path of the file, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td><td> flags from <a class="link" href="glib-Key-value-file-parser.html#GKeyFileFlags"><span class="type">GKeyFileFlags</span></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td><td> return location for a <a class="link" href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if a key file could be loaded, <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise</td></tr></tbody></table></div><p class="since">Since 2.14</p></div><hr><div class="refsect2" lang="en"><a name="id3175389"></a><h3><a name="g-key-file-to-data"></a>g_key_file_to_data ()</h3><a class="indexterm" name="id3175404"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar">gchar</a>* g_key_file_to_data (<a class="link" href="glib-Key-value-file-parser.html#GKeyFile">GKeyFile</a> *key_file, <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> *length, <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);</pre><p>This function outputs <em class="parameter"><code>key_file</code></em> as a string.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>key_file</code></em> :</span></p></td><td> a <a class="link" href="glib-Key-value-file-parser.html#GKeyFile"><span class="type">GKeyFile</span></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>length</code></em> :</span></p></td><td> return location for the length of the returned string, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td><td> return location for a <a class="link" href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> a newly allocated string holding the contents of the <a class="link" href="glib-Key-value-file-parser.html#GKeyFile"><span class="type">GKeyFile</span></a> </td></tr></tbody></table></div><p class="since">Since 2.6</p></div><hr><div class="refsect2" lang="en"><a name="id3175566"></a><h3><a name="g-key-file-get-start-group"></a>g_key_file_get_start_group ()</h3><a class="indexterm" name="id3175582"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar">gchar</a>* g_key_file_get_start_group (<a class="link" href="glib-Key-value-file-parser.html#GKeyFile">GKeyFile</a> *key_file);</pre><p>Returns the name of the start group of the file.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>key_file</code></em> :</span></p></td><td> a <a class="link" href="glib-Key-value-file-parser.html#GKeyFile"><span class="type">GKeyFile</span></a></td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> The start group of the key file.</td></tr></tbody></table></div><p class="since">Since 2.6</p></div><hr><div class="refsect2" lang="en"><a name="id3175657"></a><h3><a name="g-key-file-get-groups"></a>g_key_file_get_groups ()</h3><a class="indexterm" name="id3175672"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar">gchar</a>** g_key_file_get_groups (<a class="link" href="glib-Key-value-file-parser.html#GKeyFile">GKeyFile</a> *key_file, <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> *length);</pre><p>Returns all groups in the key file loaded with <em class="parameter"><code>key_file</code></em>. The array of returned groups will be <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated, so <em class="parameter"><code>length</code></em> may optionally be <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>key_file</code></em> :</span></p></td><td> a <a class="link" href="glib-Key-value-file-parser.html#GKeyFile"><span class="type">GKeyFile</span></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>length</code></em> :</span></p></td><td> return location for the number of returned groups, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> a newly-allocated <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated array of strings. Use <a class="link" href="glib-String-Utility-Functions.html#g-strfreev"><code class="function">g_strfreev()</code></a> to free it.</td></tr></tbody></table></div><p class="since">Since 2.6</p></div><hr><div class="refsect2" lang="en"><a name="id3175834"></a><h3><a name="g-key-file-get-keys"></a>g_key_file_get_keys ()</h3><a class="indexterm" name="id3175850"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar">gchar</a>** g_key_file_get_keys (<a class="link" href="glib-Key-value-file-parser.html#GKeyFile">GKeyFile</a> *key_file, const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *group_name, <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> *length, <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);</pre><p>Returns all keys for the group name <em class="parameter"><code>group_name</code></em>. The array ofreturned keys will be <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated, so <em class="parameter"><code>length</code></em> mayoptionally be <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. In the event that the <em class="parameter"><code>group_name</code></em> cannotbe found, <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> is returned and <em class="parameter"><code>error</code></em> is set to<a class="link" href="glib-Key-value-file-parser.html#G-KEY-FILE-ERROR-GROUP-NOT-FOUND:CAPS"><span class="type">G_KEY_FILE_ERROR_GROUP_NOT_FOUND</span></a>.</p><p></p><div class="variablelist"><table border="0"><c
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -