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