2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU Library General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
16 #if !defined(_GHB_VALUES_H_)
17 #define _GHB_VALUES_H_
20 #include <glib-object.h>
23 #define GHB_DICT HB_VALUE_TYPE_DICT
24 #define GHB_ARRAY HB_VALUE_TYPE_ARRAY
25 #define GHB_STRING HB_VALUE_TYPE_STRING
26 #define GHB_INT HB_VALUE_TYPE_INT
27 #define GHB_DOUBLE HB_VALUE_TYPE_DOUBLE
28 #define GHB_NULL HB_VALUE_TYPE_NULL
29 #define GHB_BOOL HB_VALUE_TYPE_BOOL
31 typedef hb_value_t GhbValue
;
32 typedef hb_value_type_t GhbType
;
33 typedef hb_dict_iter_t GhbDictIter
;
35 #define ghb_dict_new hb_dict_init
36 #define ghb_dict_get hb_dict_get
37 #define ghb_dict_set hb_dict_set
38 #define ghb_dict_remove hb_dict_remove
39 #define ghb_dict_iter_init hb_dict_iter_init
40 #define ghb_dict_iter_next hb_dict_iter_next_ex
42 #define ghb_value_incref hb_value_incref
43 #define ghb_value_decref hb_value_decref
44 #define ghb_value_free hb_value_free
45 #define ghb_value_type hb_value_type
46 #define ghb_value_dup hb_value_dup
48 #define ghb_array_new hb_value_array_init
49 #define ghb_array_get hb_value_array_get
50 #define ghb_array_insert hb_value_array_insert
51 #define ghb_array_append hb_value_array_append
52 #define ghb_array_remove hb_value_array_remove
53 #define ghb_array_replace hb_value_array_set
54 #define ghb_array_len hb_value_array_len
55 #define ghb_array_copy hb_value_array_copy
56 #define ghb_array_reset hb_value_array_clear
58 #define ghb_value_get_int hb_value_get_int
59 #define ghb_value_get_double hb_value_get_double
60 #define ghb_value_get_bool hb_value_get_bool
61 #define ghb_value_get_string hb_value_get_string
62 #define ghb_value_get_string_xform hb_value_get_string_xform
64 #define ghb_value_xform hb_value_xform
66 #define ghb_string_value_new hb_value_string
67 #define ghb_int_value_new hb_value_int
68 #define ghb_double_value_new hb_value_double
69 #define ghb_bool_value_new hb_value_bool
71 #define ghb_json_write(file,val) hb_value_write_file_json(val,file)
72 #define ghb_json_write_file(path,val) hb_value_write_json(val,path)
73 #define ghb_json_parse hb_value_json
74 #define ghb_json_parse_file hb_value_read_json
76 gint
ghb_value_cmp(const GhbValue
*vala
, const GhbValue
*valb
);
77 void ghb_string_value_set(GhbValue
*gval
, const gchar
*str
);
79 GhbValue
* ghb_string_value(const gchar
*str
);
80 GhbValue
* ghb_int_value(gint64 ival
);
81 GhbValue
* ghb_double_value(gdouble dval
);
82 GhbValue
* ghb_boolean_value(gboolean bval
);
84 void debug_show_value(GhbValue
*gval
);
85 void debug_show_type(GhbType tp
);
87 void ghb_dict_copy(GhbValue
*dst
, const GhbValue
*src
);
89 void ghb_dict_set_string(GhbValue
*dict
, const gchar
*key
, const gchar
*sval
);
90 void ghb_dict_set_double(GhbValue
*dict
, const gchar
*key
, gdouble dval
);
91 void ghb_dict_set_int(GhbValue
*dict
, const gchar
*key
, gint64 ival
);
92 void ghb_dict_set_bool(GhbValue
*dict
, const gchar
*key
, gboolean bval
);
94 GhbValue
* ghb_dict_get_value(const GhbValue
*dict
, const gchar
*key
);
95 gboolean
ghb_dict_get_bool(const GhbValue
*dict
, const gchar
*key
);
96 gint64
ghb_dict_get_int(const GhbValue
*dict
, const gchar
*key
);
97 gdouble
ghb_dict_get_double(const GhbValue
*dict
, const gchar
*key
);
98 gchar
* ghb_dict_get_string_xform(const GhbValue
*dict
, const gchar
*key
);
99 const gchar
* ghb_dict_get_string(const GhbValue
*dict
, const gchar
*key
);
101 #endif // _GHB_VALUES_H_