libxrdeveloper's documentation
xr-value.h
Go to the documentation of this file.
1 /*
2  * Copyright 2006-2008 Ondrej Jirman <ondrej.jirman@zonio.net>
3  *
4  * This file is part of libxr.
5  *
6  * Libxr is free software: you can redistribute it and/or modify it under the
7  * terms of the GNU Lesser General Public License as published by the Free
8  * Software Foundation, either version 2 of the License, or (at your option) any
9  * later version.
10  *
11  * Libxr is distributed in the hope that it will be useful, but WITHOUT ANY
12  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
13  * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14  * details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with libxr. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
37 #ifndef __XR_VALUE_H__
38 #define __XR_VALUE_H__
39 
40 #include "xr-lib.h"
41 
54 };
55 
58 typedef struct _xr_value xr_value;
59 
62 typedef struct _xr_blob xr_blob;
63 
66 struct _xr_blob
67 {
68  char* buf;
69  int len;
70  char refs;
71 };
72 
73 G_BEGIN_DECLS
74 
87 xr_blob* xr_blob_new(char* buf, int len);
88 
93 void xr_blob_unref(xr_blob* blob);
94 
101 xr_blob* xr_blob_ref(xr_blob* blob);
102 
110 
117 void xr_value_unref(xr_value* val);
118 
125 xr_value* xr_value_string_new(const char* val);
126 
133 xr_value* xr_value_int_new(int val);
134 
141 xr_value* xr_value_bool_new(int val);
142 
149 xr_value* xr_value_double_new(double val);
150 
157 xr_value* xr_value_time_new(const char* val);
158 
168 
180 gboolean xr_value_to_int(xr_value* val, int* nval);
181 
195 gboolean xr_value_to_string(xr_value* val, char** nval);
196 
208 gboolean xr_value_to_bool(xr_value* val, int* nval);
209 
221 gboolean xr_value_to_double(xr_value* val, double* nval);
222 
236 gboolean xr_value_to_time(xr_value* val, char** nval);
237 
252 gboolean xr_value_to_blob(xr_value* val, xr_blob** nval);
253 
262 gboolean xr_value_to_value(xr_value* val, xr_value** nval);
263 
270 int xr_value_get_type(xr_value* val);
271 
277 
284 void xr_value_array_append(xr_value* arr, xr_value* val);
285 
293 GSList* xr_value_get_items(xr_value* arr);
294 
300 
307 void xr_value_struct_set_member(xr_value* str, const char* name, xr_value* val);
308 
318 xr_value* xr_value_get_member(xr_value* str, const char* name);
319 
327 GSList* xr_value_get_members(xr_value* str);
328 
335 const char* xr_value_get_member_name(xr_value* mem);
336 
344 
356 gboolean xr_value_is_error_retval(xr_value* val, int* errcode, char** errmsg);
357 
364 void xr_value_dump(xr_value* v, GString* string, int indent);
365 
366 G_END_DECLS
367 
368 #endif
Documentation for libxr, Sat Nov 1 2014 21:06:15.