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
Array.
Definition: xr-value.h:45
XML-RPC Library Setup API.
xr_value * xr_value_double_new(double val)
Create new xr_value node of type XRV_DOUBLE.
int xr_value_get_type(xr_value *val)
Get type of xr_value node.
gboolean xr_value_is_error_retval(xr_value *val, int *errcode, char **errmsg)
Check if given node is stadard XML-RPC error struct.
gboolean xr_value_to_time(xr_value *val, char **nval)
Extract xr_value of type XRV_TIME into the native language type.
Struct.
Definition: xr-value.h:46
xr_value * xr_value_string_new(const char *val)
Create new xr_value node of type XRV_STRING.
Boolean.
Definition: xr-value.h:50
void xr_value_array_append(xr_value *arr, xr_value *val)
Add value to the array node.
String.
Definition: xr-value.h:49
struct _xr_value xr_value
Opaque data structure that holds information about particular node.
Definition: xr-value.h:58
xr_value * xr_value_ref(xr_value *val)
Take reference to the node.
void xr_value_unref(xr_value *val)
Unref xr_value node.
gboolean xr_value_to_blob(xr_value *val, xr_blob **nval)
Extract xr_value of type XRV_BLOB into the native language type.
gboolean xr_value_to_double(xr_value *val, double *nval)
Extract xr_value of type XRV_DOUBLE into the native language type.
xr_value * xr_value_struct_new()
Create new struct xr_value node.
const char * xr_value_get_member_name(xr_value *mem)
Get name of the struct member from the XRV_MEMBER node.
xr_value * xr_value_array_new()
Create new array xr_value node.
char * buf
Buffer.
Definition: xr-value.h:68
gboolean xr_value_to_string(xr_value *val, char **nval)
Extract xr_value of type XRV_STRING into the native language type.
xr_value * xr_value_get_member_value(xr_value *mem)
Get value of the struct member from the XRV_MEMBER node.
GSList * xr_value_get_members(xr_value *str)
Get list of XRV_MEMBER nodes from the struct node.
xr_value * xr_value_blob_new(xr_blob *val)
Create new xr_value node of type XRV_BLOB.
gboolean xr_value_to_int(xr_value *val, int *nval)
Extract xr_value of type XRV_INT into the native language type.
void xr_blob_unref(xr_blob *blob)
Free blob.
Blob (base64).
Definition: xr-value.h:53
GSList * xr_value_get_items(xr_value *arr)
Get list of items from the array node.
xr_value * xr_value_get_member(xr_value *str, const char *name)
Get member value from the struct node.
Struct member.
Definition: xr-value.h:47
Integer.
Definition: xr-value.h:48
xr_blob * xr_blob_ref(xr_blob *blob)
Take reference to blbo.
char refs
Number of references.
Definition: xr-value.h:70
void xr_value_struct_set_member(xr_value *str, const char *name, xr_value *val)
Set struct member value.
void xr_value_dump(xr_value *v, GString *string, int indent)
Debugging function that dumps node tree to the string.
gboolean xr_value_to_bool(xr_value *val, int *nval)
Extract xr_value of type XRV_BOOLEAN into the native language type.
xr_value * xr_value_bool_new(int val)
Create new xr_value node of type XRV_BOOLEAN.
_xr_value_node_type
Value Node Types.
Definition: xr-value.h:44
xr_value * xr_value_time_new(const char *val)
Create new xr_value node of type XRV_TIME.
int len
Buffer length.
Definition: xr-value.h:69
xr_value * xr_value_int_new(int val)
Create new xr_value node of type XRV_INT.
Type used to pass blobs around in the user code.
Definition: xr-value.h:66
Double.
Definition: xr-value.h:51
gboolean xr_value_to_value(xr_value *val, xr_value **nval)
Just a convenience interface to xr_value_ref.
G_BEGIN_DECLS xr_blob * xr_blob_new(char *buf, int len)
Create new blob.
Time.
Definition: xr-value.h:52
Documentation for libxr, Wed Apr 27 2016 22:07:49.