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

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

📁 最新gtk中文资料集
💻 HTML
📖 第 1 页 / 共 5 页
字号:
                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *group_name,                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *key,                                                         <a class="link" href="glib-Basic-Types.html#gint">gint</a> value);void                <a class="link" href="glib-Key-value-file-parser.html#g-key-file-set-double">g_key_file_set_double</a>               (<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,                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *key,                                                         <a class="link" href="glib-Basic-Types.html#gdouble">gdouble</a> value);void                <a class="link" href="glib-Key-value-file-parser.html#g-key-file-set-string-list">g_key_file_set_string_list</a>          (<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,                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *key,                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> * const list[],                                                         <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> length);void                <a class="link" href="glib-Key-value-file-parser.html#g-key-file-set-locale-string-list">g_key_file_set_locale_string_list</a>   (<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,                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *key,                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *locale,                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> * const list[],                                                         <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> length);void                <a class="link" href="glib-Key-value-file-parser.html#g-key-file-set-boolean-list">g_key_file_set_boolean_list</a>         (<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,                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *key,                                                         <a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> list[],                                                         <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> length);void                <a class="link" href="glib-Key-value-file-parser.html#g-key-file-set-integer-list">g_key_file_set_integer_list</a>         (<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,                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *key,                                                         <a class="link" href="glib-Basic-Types.html#gint">gint</a> list[],                                                         <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> length);void                <a class="link" href="glib-Key-value-file-parser.html#g-key-file-set-double-list">g_key_file_set_double_list</a>          (<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,                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *key,                                                         <a class="link" href="glib-Basic-Types.html#gdouble">gdouble</a> list[],                                                         <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> length);<a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a>            <a class="link" href="glib-Key-value-file-parser.html#g-key-file-set-comment">g_key_file_set_comment</a>              (<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,                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *key,                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *comment,                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);<a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a>            <a class="link" href="glib-Key-value-file-parser.html#g-key-file-remove-group">g_key_file_remove_group</a>             (<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-Error-Reporting.html#GError">GError</a> **error);<a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a>            <a class="link" href="glib-Key-value-file-parser.html#g-key-file-remove-key">g_key_file_remove_key</a>               (<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,                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *key,                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);<a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a>            <a class="link" href="glib-Key-value-file-parser.html#g-key-file-remove-comment">g_key_file_remove_comment</a>           (<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,                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *key,                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);#define             <a class="link" href="glib-Key-value-file-parser.html#G-KEY-FILE-DESKTOP-GROUP:CAPS">G_KEY_FILE_DESKTOP_GROUP</a>#define             <a class="link" href="glib-Key-value-file-parser.html#G-KEY-FILE-DESKTOP-KEY-TYPE:CAPS">G_KEY_FILE_DESKTOP_KEY_TYPE</a>#define             <a class="link" href="glib-Key-value-file-parser.html#G-KEY-FILE-DESKTOP-KEY-VERSION:CAPS">G_KEY_FILE_DESKTOP_KEY_VERSION</a>#define             <a class="link" href="glib-Key-value-file-parser.html#G-KEY-FILE-DESKTOP-KEY-NAME:CAPS">G_KEY_FILE_DESKTOP_KEY_NAME</a>#define             <a class="link" href="glib-Key-value-file-parser.html#G-KEY-FILE-DESKTOP-KEY-GENERIC-NAME:CAPS">G_KEY_FILE_DESKTOP_KEY_GENERIC_NAME</a>#define             <a class="link" href="glib-Key-value-file-parser.html#G-KEY-FILE-DESKTOP-KEY-NO-DISPLAY:CAPS">G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY</a>#define             <a class="link" href="glib-Key-value-file-parser.html#G-KEY-FILE-DESKTOP-KEY-COMMENT:CAPS">G_KEY_FILE_DESKTOP_KEY_COMMENT</a>#define             <a class="link" href="glib-Key-value-file-parser.html#G-KEY-FILE-DESKTOP-KEY-ICON:CAPS">G_KEY_FILE_DESKTOP_KEY_ICON</a>#define             <a class="link" href="glib-Key-value-file-parser.html#G-KEY-FILE-DESKTOP-KEY-HIDDEN:CAPS">G_KEY_FILE_DESKTOP_KEY_HIDDEN</a>#define             <a class="link" href="glib-Key-value-file-parser.html#G-KEY-FILE-DESKTOP-KEY-ONLY-SHOW-IN:CAPS">G_KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN</a>#define             <a class="link" href="glib-Key-value-file-parser.html#G-KEY-FILE-DESKTOP-KEY-NOT-SHOW-IN:CAPS">G_KEY_FILE_DESKTOP_KEY_NOT_SHOW_IN</a>#define             <a class="link" href="glib-Key-value-file-parser.html#G-KEY-FILE-DESKTOP-KEY-TRY-EXEC:CAPS">G_KEY_FILE_DESKTOP_KEY_TRY_EXEC</a>#define             <a class="link" href="glib-Key-value-file-parser.html#G-KEY-FILE-DESKTOP-KEY-EXEC:CAPS">G_KEY_FILE_DESKTOP_KEY_EXEC</a>#define             <a class="link" href="glib-Key-value-file-parser.html#G-KEY-FILE-DESKTOP-KEY-PATH:CAPS">G_KEY_FILE_DESKTOP_KEY_PATH</a>#define             <a class="link" href="glib-Key-value-file-parser.html#G-KEY-FILE-DESKTOP-KEY-TERMINAL:CAPS">G_KEY_FILE_DESKTOP_KEY_TERMINAL</a>#define             <a class="link" href="glib-Key-value-file-parser.html#G-KEY-FILE-DESKTOP-KEY-MIME-TYPE:CAPS">G_KEY_FILE_DESKTOP_KEY_MIME_TYPE</a>#define             <a class="link" href="glib-Key-value-file-parser.html#G-KEY-FILE-DESKTOP-KEY-CATEGORIES:CAPS">G_KEY_FILE_DESKTOP_KEY_CATEGORIES</a>#define             <a class="link" href="glib-Key-value-file-parser.html#G-KEY-FILE-DESKTOP-KEY-STARTUP-NOTIFY:CAPS">G_KEY_FILE_DESKTOP_KEY_STARTUP_NOTIFY</a>#define             <a class="link" href="glib-Key-value-file-parser.html#G-KEY-FILE-DESKTOP-KEY-STARTUP-WM-CLASS:CAPS">G_KEY_FILE_DESKTOP_KEY_STARTUP_WM_CLASS</a>#define             <a class="link" href="glib-Key-value-file-parser.html#G-KEY-FILE-DESKTOP-KEY-URL:CAPS">G_KEY_FILE_DESKTOP_KEY_URL</a>#define             <a class="link" href="glib-Key-value-file-parser.html#G-KEY-FILE-DESKTOP-TYPE-APPLICATION:CAPS">G_KEY_FILE_DESKTOP_TYPE_APPLICATION</a>#define             <a class="link" href="glib-Key-value-file-parser.html#G-KEY-FILE-DESKTOP-TYPE-LINK:CAPS">G_KEY_FILE_DESKTOP_TYPE_LINK</a>#define             <a class="link" href="glib-Key-value-file-parser.html#G-KEY-FILE-DESKTOP-TYPE-DIRECTORY:CAPS">G_KEY_FILE_DESKTOP_TYPE_DIRECTORY</a></pre></div><div class="refsect1" lang="en"><a name="id3173362"></a><h2>Description</h2><p><a class="link" href="glib-Key-value-file-parser.html#GKeyFile"><span class="type">GKeyFile</span></a> lets you parse, edit or create files containing groups ofkey-value pairs, which we call <em class="firstterm">key files</em> for lack of a better name. Several freedesktop.org specifications usekey files now, e.g the <a class="ulink" href="http://freedesktop.org/Standards/desktop-entry-spec" target="_top">DesktopEntry Specification</a> and the<a class="ulink" href="http://freedesktop.org/Standards/icon-theme-spec" target="_top">IconTheme Specification</a>. </p><p>The syntax of key files is described in detail in the <a class="ulink" href="http://freedesktop.org/Standards/desktop-entry-spec" target="_top">DesktopEntry Specification</a>, here is a quick summary: Key filesconsists of groups of key-value pairs, interspersed with comments.</p><div class="informalexample"><pre class="programlisting"># this is just an example# there can be comments before the first group[First Group]Name=Key File Example\tthis value shows\nescaping# localized strings are stored in multiple key-value pairsWelcome=HelloWelcome[de]=HalloWelcome[fr]=BonjourWelcome[it]=Ciao[Another Group]Numbers=2;20;-200;0Booleans=true;false;true;true</pre></div><p>Lines beginning with a '#' and blank lines are considered comments.</p><p>Groups are started by a header line containing the group name enclosedin '[' and ']', and ended implicitly by the start of the next group orthe end of the file. Each key-value pair must be contained in a group.</p><p>Key-value pairs generally have the form <code class="literal">key=value</code>, with the exception of localized strings, which have the form <code class="literal">key[locale]=value</code>. Space before and after the '=' character are ignored. Newline, tab, carriage return and backslash characters in value are escaped as \n, \t, \r, and \\, respectively. To preserve leading spaces in values, these can also be escaped as \s.</p><p>Key files can store strings (possibly with localized variants), integers,booleans and lists of these. Lists are separated by a separator character,typically ';' or ','. To use the list separator character in a value ina list, it has to be escaped by prefixing it with a backslash.</p><p>This syntax is obviously inspired by the <code class="filename">.ini</code> files commonly met on Windows, but there are some important differences:</p><div class="itemizedlist"><ul type="disc"><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 do not allow for ungrouped keys meaning only comments can precede 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><li><p><code class="filename">.ini</code> files don't have a strongly typed boolean entry type, they onlyhave <code class="literal">GetProfileInt</code>. In <span class="structname">GKeyFile</span> only<code class="literal">true</code> and <code class="literal">false</code> (in lower case) are allowed.</p></li></ul></div><p></p><p>Note that in contrast to the<a class="ulink" href="http://freedesktop.org/Standards/desktop-entry-spec" target="_top">DesktopEntry Specification</a>, groups in key files may contain the samekey multiple times; the last entry wins. Key files may also containmultiple groups with the same name; they are merged together.Another difference is that keys and group names in key files are notrestricted to ASCII characters.</p></div><div class="refsect1" lang="en"><a name="id3173573"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id3173583"></a><h3><a name="GKeyFile"></a>GKeyFile</h3><a class="indexterm" name="id3173596"></a><pre class="programlisting">typedef struct _GKeyFile GKeyFile;</pre>

⌨️ 快捷键说明

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