00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __G_KEY_FILE_H__
00025 #define __G_KEY_FILE_H__
00026
00027 #include <_ansi.h>
00028 #include <glib/gerror.h>
00029
00030 G_BEGIN_DECLS
00031
00032 typedef enum
00033 {
00034 G_KEY_FILE_ERROR_UNKNOWN_ENCODING,
00035 G_KEY_FILE_ERROR_PARSE,
00036 G_KEY_FILE_ERROR_NOT_FOUND,
00037 G_KEY_FILE_ERROR_KEY_NOT_FOUND,
00038 G_KEY_FILE_ERROR_GROUP_NOT_FOUND,
00039 G_KEY_FILE_ERROR_INVALID_VALUE
00040 } GKeyFileError;
00041
00042 #define G_KEY_FILE_ERROR g_key_file_error_quark()
00043
00044 IMPORT_C GQuark g_key_file_error_quark (void);
00045
00046 typedef struct _GKeyFile GKeyFile;
00047
00048 typedef enum
00049 {
00050 G_KEY_FILE_NONE = 0,
00051 G_KEY_FILE_KEEP_COMMENTS = 1 << 0,
00052 G_KEY_FILE_KEEP_TRANSLATIONS = 1 << 1
00053 } GKeyFileFlags;
00054
00055 IMPORT_C GKeyFile *g_key_file_new (void);
00056 IMPORT_C void g_key_file_free (GKeyFile *key_file);
00057 IMPORT_C void g_key_file_set_list_separator (GKeyFile *key_file,
00058 gchar separator);
00059 IMPORT_C gboolean g_key_file_load_from_file (GKeyFile *key_file,
00060 const gchar *file,
00061 GKeyFileFlags flags,
00062 GError **error);
00063 IMPORT_C gboolean g_key_file_load_from_data (GKeyFile *key_file,
00064 const gchar *data,
00065 gsize length,
00066 GKeyFileFlags flags,
00067 GError **error);
00068 IMPORT_C gboolean g_key_file_load_from_data_dirs (GKeyFile *key_file,
00069 const gchar *file,
00070 gchar **full_path,
00071 GKeyFileFlags flags,
00072 GError **error);
00073 IMPORT_C gchar *g_key_file_to_data (GKeyFile *key_file,
00074 gsize *length,
00075 GError **error) G_GNUC_MALLOC;
00076 IMPORT_C gchar *g_key_file_get_start_group (GKeyFile *key_file) G_GNUC_MALLOC;
00077 IMPORT_C gchar **g_key_file_get_groups (GKeyFile *key_file,
00078 gsize *length) G_GNUC_MALLOC;
00079 IMPORT_C gchar **g_key_file_get_keys (GKeyFile *key_file,
00080 const gchar *group_name,
00081 gsize *length,
00082 GError **error) G_GNUC_MALLOC;
00083 IMPORT_C gboolean g_key_file_has_group (GKeyFile *key_file,
00084 const gchar *group_name);
00085 IMPORT_C gboolean g_key_file_has_key (GKeyFile *key_file,
00086 const gchar *group_name,
00087 const gchar *key,
00088 GError **error);
00089 IMPORT_C gchar *g_key_file_get_value (GKeyFile *key_file,
00090 const gchar *group_name,
00091 const gchar *key,
00092 GError **error) G_GNUC_MALLOC;
00093 IMPORT_C void g_key_file_set_value (GKeyFile *key_file,
00094 const gchar *group_name,
00095 const gchar *key,
00096 const gchar *value);
00097 IMPORT_C gchar *g_key_file_get_string (GKeyFile *key_file,
00098 const gchar *group_name,
00099 const gchar *key,
00100 GError **error) G_GNUC_MALLOC;
00101 IMPORT_C void g_key_file_set_string (GKeyFile *key_file,
00102 const gchar *group_name,
00103 const gchar *key,
00104 const gchar *string);
00105 IMPORT_C gchar *g_key_file_get_locale_string (GKeyFile *key_file,
00106 const gchar *group_name,
00107 const gchar *key,
00108 const gchar *locale,
00109 GError **error) G_GNUC_MALLOC;
00110 IMPORT_C void g_key_file_set_locale_string (GKeyFile *key_file,
00111 const gchar *group_name,
00112 const gchar *key,
00113 const gchar *locale,
00114 const gchar *string);
00115 IMPORT_C gboolean g_key_file_get_boolean (GKeyFile *key_file,
00116 const gchar *group_name,
00117 const gchar *key,
00118 GError **error);
00119 IMPORT_C void g_key_file_set_boolean (GKeyFile *key_file,
00120 const gchar *group_name,
00121 const gchar *key,
00122 gboolean value);
00123 IMPORT_C gint g_key_file_get_integer (GKeyFile *key_file,
00124 const gchar *group_name,
00125 const gchar *key,
00126 GError **error);
00127 IMPORT_C void g_key_file_set_integer (GKeyFile *key_file,
00128 const gchar *group_name,
00129 const gchar *key,
00130 gint value);
00131 IMPORT_C gchar **g_key_file_get_string_list (GKeyFile *key_file,
00132 const gchar *group_name,
00133 const gchar *key,
00134 gsize *length,
00135 GError **error) G_GNUC_MALLOC;
00136 IMPORT_C void g_key_file_set_string_list (GKeyFile *key_file,
00137 const gchar *group_name,
00138 const gchar *key,
00139 const gchar * const list[],
00140 gsize length);
00141 IMPORT_C gchar **g_key_file_get_locale_string_list (GKeyFile *key_file,
00142 const gchar *group_name,
00143 const gchar *key,
00144 const gchar *locale,
00145 gsize *length,
00146 GError **error) G_GNUC_MALLOC;
00147 IMPORT_C void g_key_file_set_locale_string_list (GKeyFile *key_file,
00148 const gchar *group_name,
00149 const gchar *key,
00150 const gchar *locale,
00151 const gchar * const list[],
00152 gsize length);
00153 IMPORT_C gboolean *g_key_file_get_boolean_list (GKeyFile *key_file,
00154 const gchar *group_name,
00155 const gchar *key,
00156 gsize *length,
00157 GError **error) G_GNUC_MALLOC;
00158 IMPORT_C void g_key_file_set_boolean_list (GKeyFile *key_file,
00159 const gchar *group_name,
00160 const gchar *key,
00161 gboolean list[],
00162 gsize length);
00163 IMPORT_C gint *g_key_file_get_integer_list (GKeyFile *key_file,
00164 const gchar *group_name,
00165 const gchar *key,
00166 gsize *length,
00167 GError **error) G_GNUC_MALLOC;
00168 IMPORT_C void g_key_file_set_integer_list (GKeyFile *key_file,
00169 const gchar *group_name,
00170 const gchar *key,
00171 gint list[],
00172 gsize length);
00173 IMPORT_C void g_key_file_set_comment (GKeyFile *key_file,
00174 const gchar *group_name,
00175 const gchar *key,
00176 const gchar *comment,
00177 GError **error);
00178 IMPORT_C gchar *g_key_file_get_comment (GKeyFile *key_file,
00179 const gchar *group_name,
00180 const gchar *key,
00181 GError **error) G_GNUC_MALLOC;
00182
00183 IMPORT_C void g_key_file_remove_comment (GKeyFile *key_file,
00184 const gchar *group_name,
00185 const gchar *key,
00186 GError **error);
00187 IMPORT_C void g_key_file_remove_key (GKeyFile *key_file,
00188 const gchar *group_name,
00189 const gchar *key,
00190 GError **error);
00191 IMPORT_C void g_key_file_remove_group (GKeyFile *key_file,
00192 const gchar *group_name,
00193 GError **error);
00194
00195 G_END_DECLS
00196
00197 #endif