XMMS2
xmmsv_general.h
Go to the documentation of this file.
1 /* XMMS2 - X Music Multiplexer System
2  * Copyright (C) 2003-2011 XMMS2 Team
3  *
4  * PLUGINS ARE NOT CONSIDERED TO BE DERIVED WORK !!!
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  */
16 
17 
18 #ifndef __XMMSV_GENERAL_H__
19 #define __XMMSV_GENERAL_H__
20 
21 #include <stdarg.h>
22 #include "xmmsc/xmmsc_compiler.h"
23 #include "xmmsc/xmmsc_stdint.h"
24 #include "xmmsc/xmmsv_coll.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 /**
31  * @defgroup ValueType The type xmmsv_t
32  * @{
33  */
34 
35 typedef enum {
46 } xmmsv_type_t;
47 
48 typedef struct xmmsv_St xmmsv_t;
49 
50 xmmsv_t *xmmsv_new_none (void);
51 xmmsv_t *xmmsv_new_error (const char *errstr); /* FIXME: err id? */
52 xmmsv_t *xmmsv_new_int (int32_t i);
53 xmmsv_t *xmmsv_new_string (const char *s);
55 xmmsv_t *xmmsv_new_bin (const unsigned char *data, unsigned int len);
56 
57 xmmsv_t *xmmsv_ref (xmmsv_t *val);
58 void xmmsv_unref (xmmsv_t *val);
59 
61 int xmmsv_is_type (const xmmsv_t *val, xmmsv_type_t t);
62 
63 int xmmsv_get_error (const xmmsv_t *val, const char **r);
64 int xmmsv_get_int (const xmmsv_t *val, int32_t *r);
65 int xmmsv_get_string (const xmmsv_t *val, const char **r);
66 int xmmsv_get_coll (const xmmsv_t *val, xmmsv_coll_t **coll);
67 int xmmsv_get_bin (const xmmsv_t *val, const unsigned char **r, unsigned int *rlen);
68 
69 /* legacy aliases */
70 int xmmsv_is_error (const xmmsv_t *val);
71 
72 /** @} */
73 
74 #ifdef __cplusplus
75 }
76 #endif
77 
78 #endif
void xmmsv_unref(xmmsv_t *val)
Decreases the references for the xmmsv_t When the number of references reaches 0 it will be freed...
Definition: value.c:303
xmmsv_t * xmmsv_new_error(const char *errstr)
Allocates a new error xmmsv_t.
Definition: value.c:143
struct xmmsv_St xmmsv_t
Definition: xmmsv_general.h:48
xmmsv_t * xmmsv_new_none(void)
Allocates a new empty xmmsv_t.
Definition: value.c:129
xmmsv_t * xmmsv_new_string(const char *s)
Allocates a new string xmmsv_t.
Definition: value.c:180
int xmmsv_get_int(const xmmsv_t *val, int32_t *r)
Retrieves a signed integer from the value.
Definition: value.c:823
int xmmsv_is_type(const xmmsv_t *val, xmmsv_type_t t)
Check if value is of specified type.
Definition: value.c:408
struct xmmsv_coll_St xmmsv_coll_t
Definition: xmmsv_coll.h:28
xmmsv_t * xmmsv_new_coll(xmmsv_coll_t *coll)
Allocates a new collection xmmsv_t.
Definition: value.c:202
xmmsv_type_t
Definition: xmmsv_general.h:35
xmmsv_type_t xmmsv_get_type(const xmmsv_t *val)
Get the type of the value.
Definition: value.c:392
xmmsv_t * xmmsv_new_int(int32_t i)
Allocates a new integer xmmsv_t.
Definition: value.c:161
xmmsv_t * xmmsv_ref(xmmsv_t *val)
References the xmmsv_t.
Definition: value.c:288
int xmmsv_get_error(const xmmsv_t *val, const char **r)
Retrieves an error string describing the server error from the value.
Definition: value.c:804
int xmmsv_get_bin(const xmmsv_t *val, const unsigned char **r, unsigned int *rlen)
Retrieves binary data from the value.
Definition: value.c:904
int xmmsv_get_string(const xmmsv_t *val, const char **r)
Retrieves a string from the value.
Definition: value.c:863
int xmmsv_is_error(const xmmsv_t *val)
Check if the value stores an error.
Definition: value.c:425
xmmsv_t * xmmsv_new_bin(const unsigned char *data, unsigned int len)
Allocates a new binary data xmmsv_t.
Definition: value.c:225
int xmmsv_get_coll(const xmmsv_t *val, xmmsv_coll_t **coll)
Retrieves a collection from the value.
Definition: value.c:883