1 gkeyfile.h |
1 /* gkeyfile.h - desktop entry file parser |
|
2 * |
|
3 * Copyright 2004 Red Hat, Inc. |
|
4 * |
|
5 * Ray Strode <halfline@hawaii.rr.com> |
|
6 * Portions copyright (c) 2006 Nokia Corporation. All rights reserved. |
|
7 * |
|
8 * GLib is free software; you can redistribute it and/or modify it |
|
9 * under the terms of the GNU Lesser General Public License as |
|
10 * published by the Free Software Foundation; either version 2 of the |
|
11 * License, or (at your option) any later version. |
|
12 * |
|
13 * GLib is distributed in the hope that it will be useful, |
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
16 * Lesser General Public License for more details. |
|
17 * |
|
18 * You should have received a copy of the GNU Lesser General Public |
|
19 * License along with GLib; see the file COPYING.LIB. If not, |
|
20 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
|
21 * Boston, MA 02111-1307, USA. |
|
22 */ |
|
23 |
|
24 #ifndef __G_KEY_FILE_H__ |
|
25 #define __G_KEY_FILE_H__ |
|
26 |
|
27 #include <_ansi.h> |
|
28 #include <glib/gerror.h> |
|
29 |
|
30 G_BEGIN_DECLS |
|
31 |
|
32 typedef enum |
|
33 { |
|
34 G_KEY_FILE_ERROR_UNKNOWN_ENCODING, |
|
35 G_KEY_FILE_ERROR_PARSE, |
|
36 G_KEY_FILE_ERROR_NOT_FOUND, |
|
37 G_KEY_FILE_ERROR_KEY_NOT_FOUND, |
|
38 G_KEY_FILE_ERROR_GROUP_NOT_FOUND, |
|
39 G_KEY_FILE_ERROR_INVALID_VALUE |
|
40 } GKeyFileError; |
|
41 |
|
42 #define G_KEY_FILE_ERROR g_key_file_error_quark() |
|
43 |
|
44 IMPORT_C GQuark g_key_file_error_quark (void); |
|
45 |
|
46 typedef struct _GKeyFile GKeyFile; |
|
47 |
|
48 typedef enum |
|
49 { |
|
50 G_KEY_FILE_NONE = 0, |
|
51 G_KEY_FILE_KEEP_COMMENTS = 1 << 0, |
|
52 G_KEY_FILE_KEEP_TRANSLATIONS = 1 << 1 |
|
53 } GKeyFileFlags; |
|
54 |
|
55 IMPORT_C GKeyFile *g_key_file_new (void); |
|
56 IMPORT_C void g_key_file_free (GKeyFile *key_file); |
|
57 IMPORT_C void g_key_file_set_list_separator (GKeyFile *key_file, |
|
58 gchar separator); |
|
59 IMPORT_C gboolean g_key_file_load_from_file (GKeyFile *key_file, |
|
60 const gchar *file, |
|
61 GKeyFileFlags flags, |
|
62 GError **error); |
|
63 IMPORT_C gboolean g_key_file_load_from_data (GKeyFile *key_file, |
|
64 const gchar *data, |
|
65 gsize length, |
|
66 GKeyFileFlags flags, |
|
67 GError **error); |
|
68 IMPORT_C gboolean g_key_file_load_from_data_dirs (GKeyFile *key_file, |
|
69 const gchar *file, |
|
70 gchar **full_path, |
|
71 GKeyFileFlags flags, |
|
72 GError **error); |
|
73 IMPORT_C gchar *g_key_file_to_data (GKeyFile *key_file, |
|
74 gsize *length, |
|
75 GError **error) G_GNUC_MALLOC; |
|
76 IMPORT_C gchar *g_key_file_get_start_group (GKeyFile *key_file) G_GNUC_MALLOC; |
|
77 IMPORT_C gchar **g_key_file_get_groups (GKeyFile *key_file, |
|
78 gsize *length) G_GNUC_MALLOC; |
|
79 IMPORT_C gchar **g_key_file_get_keys (GKeyFile *key_file, |
|
80 const gchar *group_name, |
|
81 gsize *length, |
|
82 GError **error) G_GNUC_MALLOC; |
|
83 IMPORT_C gboolean g_key_file_has_group (GKeyFile *key_file, |
|
84 const gchar *group_name); |
|
85 IMPORT_C gboolean g_key_file_has_key (GKeyFile *key_file, |
|
86 const gchar *group_name, |
|
87 const gchar *key, |
|
88 GError **error); |
|
89 IMPORT_C gchar *g_key_file_get_value (GKeyFile *key_file, |
|
90 const gchar *group_name, |
|
91 const gchar *key, |
|
92 GError **error) G_GNUC_MALLOC; |
|
93 IMPORT_C void g_key_file_set_value (GKeyFile *key_file, |
|
94 const gchar *group_name, |
|
95 const gchar *key, |
|
96 const gchar *value); |
|
97 IMPORT_C gchar *g_key_file_get_string (GKeyFile *key_file, |
|
98 const gchar *group_name, |
|
99 const gchar *key, |
|
100 GError **error) G_GNUC_MALLOC; |
|
101 IMPORT_C void g_key_file_set_string (GKeyFile *key_file, |
|
102 const gchar *group_name, |
|
103 const gchar *key, |
|
104 const gchar *string); |
|
105 IMPORT_C gchar *g_key_file_get_locale_string (GKeyFile *key_file, |
|
106 const gchar *group_name, |
|
107 const gchar *key, |
|
108 const gchar *locale, |
|
109 GError **error) G_GNUC_MALLOC; |
|
110 IMPORT_C void g_key_file_set_locale_string (GKeyFile *key_file, |
|
111 const gchar *group_name, |
|
112 const gchar *key, |
|
113 const gchar *locale, |
|
114 const gchar *string); |
|
115 IMPORT_C gboolean g_key_file_get_boolean (GKeyFile *key_file, |
|
116 const gchar *group_name, |
|
117 const gchar *key, |
|
118 GError **error); |
|
119 IMPORT_C void g_key_file_set_boolean (GKeyFile *key_file, |
|
120 const gchar *group_name, |
|
121 const gchar *key, |
|
122 gboolean value); |
|
123 IMPORT_C gint g_key_file_get_integer (GKeyFile *key_file, |
|
124 const gchar *group_name, |
|
125 const gchar *key, |
|
126 GError **error); |
|
127 IMPORT_C void g_key_file_set_integer (GKeyFile *key_file, |
|
128 const gchar *group_name, |
|
129 const gchar *key, |
|
130 gint value); |
|
131 IMPORT_C gchar **g_key_file_get_string_list (GKeyFile *key_file, |
|
132 const gchar *group_name, |
|
133 const gchar *key, |
|
134 gsize *length, |
|
135 GError **error) G_GNUC_MALLOC; |
|
136 IMPORT_C void g_key_file_set_string_list (GKeyFile *key_file, |
|
137 const gchar *group_name, |
|
138 const gchar *key, |
|
139 const gchar * const list[], |
|
140 gsize length); |
|
141 IMPORT_C gchar **g_key_file_get_locale_string_list (GKeyFile *key_file, |
|
142 const gchar *group_name, |
|
143 const gchar *key, |
|
144 const gchar *locale, |
|
145 gsize *length, |
|
146 GError **error) G_GNUC_MALLOC; |
|
147 IMPORT_C void g_key_file_set_locale_string_list (GKeyFile *key_file, |
|
148 const gchar *group_name, |
|
149 const gchar *key, |
|
150 const gchar *locale, |
|
151 const gchar * const list[], |
|
152 gsize length); |
|
153 IMPORT_C gboolean *g_key_file_get_boolean_list (GKeyFile *key_file, |
|
154 const gchar *group_name, |
|
155 const gchar *key, |
|
156 gsize *length, |
|
157 GError **error) G_GNUC_MALLOC; |
|
158 IMPORT_C void g_key_file_set_boolean_list (GKeyFile *key_file, |
|
159 const gchar *group_name, |
|
160 const gchar *key, |
|
161 gboolean list[], |
|
162 gsize length); |
|
163 IMPORT_C gint *g_key_file_get_integer_list (GKeyFile *key_file, |
|
164 const gchar *group_name, |
|
165 const gchar *key, |
|
166 gsize *length, |
|
167 GError **error) G_GNUC_MALLOC; |
|
168 IMPORT_C void g_key_file_set_integer_list (GKeyFile *key_file, |
|
169 const gchar *group_name, |
|
170 const gchar *key, |
|
171 gint list[], |
|
172 gsize length); |
|
173 IMPORT_C void g_key_file_set_comment (GKeyFile *key_file, |
|
174 const gchar *group_name, |
|
175 const gchar *key, |
|
176 const gchar *comment, |
|
177 GError **error); |
|
178 IMPORT_C gchar *g_key_file_get_comment (GKeyFile *key_file, |
|
179 const gchar *group_name, |
|
180 const gchar *key, |
|
181 GError **error) G_GNUC_MALLOC; |
|
182 |
|
183 IMPORT_C void g_key_file_remove_comment (GKeyFile *key_file, |
|
184 const gchar *group_name, |
|
185 const gchar *key, |
|
186 GError **error); |
|
187 IMPORT_C void g_key_file_remove_key (GKeyFile *key_file, |
|
188 const gchar *group_name, |
|
189 const gchar *key, |
|
190 GError **error); |
|
191 IMPORT_C void g_key_file_remove_group (GKeyFile *key_file, |
|
192 const gchar *group_name, |
|
193 GError **error); |
|
194 |
|
195 G_END_DECLS |
|
196 |
|
197 #endif /* __G_KEY_FILE_H__ */ |