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

📄 glib-key-value-file-parser.html

📁 glid编写实例
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<li><p><code class="filename">.ini</code> files use the ';' character to begin comments, key files use the '#' character.</p></li><li><p>Key files allow only comments before the first group.</p></li><li><p>Key files are always encoded in UTF-8.</p></li><li><p>Key and Group names are case-sensitive, for example a group called<code class="literal">[GROUP]</code> is a different group from <code class="literal">[group]</code>.</p></li></ul></div><p></p></div><div class="refsect1" lang="en"><a name="id3082009"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id3082015"></a><h3><a name="GKeyFile"></a>GKeyFile</h3><a class="indexterm" name="id2768517"></a><pre class="programlisting">typedef struct _GKeyFile GKeyFile;</pre><p>The <span class="structname">GKeyFile</span> struct contains only private fieldsand should not be used directly.</p></div><hr><div class="refsect2" lang="en"><a name="id2768537"></a><h3><a name="G-KEY-FILE-ERROR:CAPS"></a>G_KEY_FILE_ERROR</h3><a class="indexterm" name="id2768545"></a><pre class="programlisting">#define G_KEY_FILE_ERROR g_key_file_error_quark()</pre><p>Error domain for key file parsing. Errors in this domain willbe from the <a href="glib-Key-value-file-parser.html#GKeyFileError"><span class="type">GKeyFileError</span></a> enumeration. See <a href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a> for information on error domains.</p></div><hr><div class="refsect2" lang="en"><a name="id2768579"></a><h3><a name="GKeyFileError"></a>enum GKeyFileError</h3><a class="indexterm" name="id2768589"></a><pre class="programlisting">typedef enum{  G_KEY_FILE_ERROR_UNKNOWN_ENCODING,  G_KEY_FILE_ERROR_PARSE,  G_KEY_FILE_ERROR_NOT_FOUND,  G_KEY_FILE_ERROR_KEY_NOT_FOUND,  G_KEY_FILE_ERROR_GROUP_NOT_FOUND,  G_KEY_FILE_ERROR_INVALID_VALUE} GKeyFileError;</pre><p>Error codes returned by key file parsing.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><code class="literal">G_KEY_FILE_ERROR_UNKNOWN_ENCODING</code></span></td><td>the text being parsed was in an unknown encoding</td></tr><tr><td><span class="term"><code class="literal">G_KEY_FILE_ERROR_PARSE</code></span></td><td>document was ill-formed</td></tr><tr><td><span class="term"><code class="literal">G_KEY_FILE_ERROR_NOT_FOUND</code></span></td><td>the file was not found</td></tr><tr><td><span class="term"><code class="literal">G_KEY_FILE_ERROR_KEY_NOT_FOUND</code></span></td><td>a requested key was not found</td></tr><tr><td><span class="term"><code class="literal">G_KEY_FILE_ERROR_GROUP_NOT_FOUND</code></span></td><td>a requested group was not found</td></tr><tr><td><span class="term"><code class="literal">G_KEY_FILE_ERROR_INVALID_VALUE</code></span></td><td>a value could not be parsed</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3082924"></a><h3><a name="GKeyFileFlags"></a>enum GKeyFileFlags</h3><a class="indexterm" name="id3082933"></a><pre class="programlisting">typedef enum{  G_KEY_FILE_NONE              = 0,  G_KEY_FILE_KEEP_COMMENTS     = 1 &lt;&lt; 0,  G_KEY_FILE_KEEP_TRANSLATIONS = 1 &lt;&lt; 1} GKeyFileFlags;</pre><p>Flags which influence the parsing.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><code class="literal">G_KEY_FILE_NONE</code></span></td><td>No flags, default behaviour</td></tr><tr><td><span class="term"><code class="literal">G_KEY_FILE_KEEP_COMMENTS</code></span></td><td>Use this flag if you plan to write the (possibly modified)  contents of the key file back to a file; otherwise all comments will be lost when  the key file is written back.</td></tr><tr><td><span class="term"><code class="literal">G_KEY_FILE_KEEP_TRANSLATIONS</code></span></td><td>Use this flag if you plan to write the (possibly modified)  contents of the key file back to a file; otherwise only the translations for the current  language will be written back.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3083003"></a><h3><a name="g-key-file-new"></a>g_key_file_new ()</h3><a class="indexterm" name="id3083011"></a><pre class="programlisting"><a href="glib-Key-value-file-parser.html#GKeyFile">GKeyFile</a>*   g_key_file_new                  (void);</pre><p>Creates a new empty <a href="glib-Key-value-file-parser.html#GKeyFile"><span class="type">GKeyFile</span></a> object. Use <a href="glib-Key-value-file-parser.html#g-key-file-load-from-file"><code class="function">g_key_file_load_from_file()</code></a>,<a href="glib-Key-value-file-parser.html#g-key-file-load-from-data"><code class="function">g_key_file_load_from_data()</code></a> or <a href="glib-Key-value-file-parser.html#g-key-file-load-from-data-dirs"><code class="function">g_key_file_load_from_data_dirs()</code></a> toread an existing key file.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td><td> an empty <a href="glib-Key-value-file-parser.html#GKeyFile"><span class="type">GKeyFile</span></a>.</td></tr></tbody></table></div><p>Since  2.6</p></div><hr><div class="refsect2" lang="en"><a name="id3083091"></a><h3><a name="g-key-file-free"></a>g_key_file_free ()</h3><a class="indexterm" name="id3083099"></a><pre class="programlisting">void        g_key_file_free                 (<a href="glib-Key-value-file-parser.html#GKeyFile">GKeyFile</a> *key_file);</pre><p>Frees a <a href="glib-Key-value-file-parser.html#GKeyFile"><span class="type">GKeyFile</span></a>.</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>&#160;:</span></td><td> a <a href="glib-Key-value-file-parser.html#GKeyFile"><span class="type">GKeyFile</span></a></td></tr></tbody></table></div><p>Since  2.6</p></div><hr><div class="refsect2" lang="en"><a name="id3083160"></a><h3><a name="g-key-file-set-list-separator"></a>g_key_file_set_list_separator ()</h3><a class="indexterm" name="id3083170"></a><pre class="programlisting">void        g_key_file_set_list_separator   (<a href="glib-Key-value-file-parser.html#GKeyFile">GKeyFile</a> *key_file,                                             <a href="glib-Basic-Types.html#gchar">gchar</a> separator);</pre><p>Sets the character which is used to separatevalues in lists. Typically ';' or ',' are usedas separators. The default list separator is ';'.</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>&#160;:</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>separator</code></em>&#160;:</span></td><td> the separator</td></tr></tbody></table></div><p>Since  2.6</p></div><hr><div class="refsect2" lang="en"><a name="id3083246"></a><h3><a name="g-key-file-load-from-file"></a>g_key_file_load_from_file ()</h3><a class="indexterm" name="id3083256"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gboolean">gboolean</a>    g_key_file_load_from_file       (<a href="glib-Key-value-file-parser.html#GKeyFile">GKeyFile</a> *key_file,                                             const <a href="glib-Basic-Types.html#gchar">gchar</a> *file,                                             <a href="glib-Key-value-file-parser.html#GKeyFileFlags">GKeyFileFlags</a> flags,                                             <a href="glib-Error-Reporting.html#GError">GError</a> **error);</pre><p>Loads a key file into an empty <a href="glib-Key-value-file-parser.html#GKeyFile"><span class="type">GKeyFile</span></a> structure.If the file could not be loaded then <code class="literal">error</code> is set to either a <a href="glib-File-Utilities.html#GFileError"><span class="type">GFileError</span></a> or <a 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><span class="term"><em class="parameter"><code>key_file</code></em>&#160;:</span></td><td> an empty <a href="glib-Key-value-file-parser.html#GKeyFile"><span class="type">GKeyFile</span></a> struct</td></tr><tr><td><span class="term"><em class="parameter"><code>file</code></em>&#160;:</span></td><td> the path of a filename to load, in the GLib file name encoding</td></tr><tr><td><span class="term"><em class="parameter"><code>flags</code></em>&#160;:</span></td><td> flags from <a href="glib-Key-value-file-parser.html#GKeyFileFlags"><span class="type">GKeyFileFlags</span></a></td></tr><tr><td>

⌨️ 快捷键说明

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