clean code and changed version nro.
[irreco.git] / irreco / src / util / irreco_keyfile.h
blobc9577a6529c4d48484612783e4c709c00959765f
1 /*
2 * irreco - Ir Remote Control
3 * Copyright (C) 2007 Arto Karppinen (arto.karppinen@iki.fi)
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 /**
21 * @addtogroup IrrecoKeyFile
22 * @{
25 /**
26 * @file
27 * Header file of @ref IrrecoKeyFile.
30 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
31 /* Typedef */
32 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
34 * Make sure that typedefs are available before we include anything elese.
36 * This makes sure that whatever other structures that depend on structures
37 * defined in this file will compile OK recardles of header inclusion order.
39 #ifndef __IRRECO_KEYFILE_H_TYPEDEF__
40 #define __IRRECO_KEYFILE_H_TYPEDEF__
41 typedef struct _IrrecoKeyFile IrrecoKeyFile;
42 #endif /* __IRRECO_KEYFILE_H_TYPEDEF__ */
46 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
47 /* Include */
48 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
49 #ifndef __IRRECO_KEYFILE_H__
50 #define __IRRECO_KEYFILE_H__
51 #include "irreco_util.h"
55 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
56 /* Datatypes */
57 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
58 struct _IrrecoKeyFile {
59 const gchar *file; /* Path to keyfile. */
60 const gchar *dir; /* Directory where the keyfile is located. */
61 GKeyFile *keyfile;
62 const gchar *group; /* Group where to read values.*/
67 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
68 /* Prototypes */
69 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
70 gboolean irreco_gkeyfile_write_to_file(GKeyFile * keyfile,
71 const gchar * file);
72 gboolean irreco_gkeyfile_write_to_config_file(GKeyFile * keyfile,
73 const gchar * app_name,
74 const gchar * file);
75 void irreco_gkeyfile_set_string(GKeyFile * keyfile,
76 const gchar * group,
77 const gchar * key,
78 const gchar * string);
79 void irreco_gkeyfile_set_guint(GKeyFile * keyfile,
80 const gchar * group,
81 const gchar * key,
82 guint value);
83 void irreco_gkeyfile_set_glong(GKeyFile * keyfile,
84 const gchar * group,
85 const gchar * key,
86 glong value);
87 void irreco_gkeyfile_set_gfloat(GKeyFile *keyfile,
88 const gchar *group,
89 const gchar *key,
90 gfloat value);
91 IrrecoKeyFile *irreco_keyfile_create(const gchar *dir, const gchar *file,
92 const gchar *group);
93 void irreco_keyfile_destroy(IrrecoKeyFile* keyfile);
94 gboolean irreco_keyfile_set_group(IrrecoKeyFile* keyfile, const gchar *group);
95 const gchar *irreco_keyfile_get_group(IrrecoKeyFile* keyfile);
96 gboolean irreco_keyfile_get_str(IrrecoKeyFile* keyfile, const gchar *key,
97 gchar ** value);
98 gboolean irreco_keyfile_get_path(IrrecoKeyFile* keyfile, const gchar *key,
99 gchar ** value);
100 gboolean irreco_keyfile_get_int(IrrecoKeyFile* keyfile, const gchar *key,
101 gint * value);
102 gboolean irreco_keyfile_get_uint(IrrecoKeyFile* keyfile, const gchar *key,
103 guint * value);
104 gboolean irreco_keyfile_get_uint16(IrrecoKeyFile* keyfile, const gchar *key,
105 guint16 * value);
106 gboolean irreco_keyfile_get_glong(IrrecoKeyFile* keyfile, const gchar *key,
107 glong * value);
108 gboolean irreco_keyfile_get_double(IrrecoKeyFile* keyfile, const gchar *key,
109 gdouble * value);
110 gboolean irreco_keyfile_get_float(IrrecoKeyFile* keyfile, const gchar *key,
111 gfloat * value);
112 gboolean irreco_keyfile_get_bool(IrrecoKeyFile* keyfile, const gchar *key,
113 gboolean * value);
115 gboolean irreco_keyfile_get_keys(IrrecoKeyFile* keyfile, const gchar *group, gsize **length, gchar ***keys);
117 gboolean irreco_keyfile_get_gkeyfile(IrrecoKeyFile* keyfile, GKeyFile **gkeyfile);
118 #endif /* __IRRECO_KEYFILE_H__ */
120 /** @} */