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>
23#include "xmmsc/xmmsc_stdint.h"
24#include "xmmsc/xmmsv_coll.h"
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30/**
31 * @defgroup ValueType The type xmmsv_t
32 * @{
33 */
34
35typedef enum {
47
48typedef struct xmmsv_St xmmsv_t;
49
51xmmsv_t *xmmsv_new_error (const char *errstr); /* FIXME: err id? */
52xmmsv_t *xmmsv_new_int (int32_t i);
53xmmsv_t *xmmsv_new_string (const char *s);
55xmmsv_t *xmmsv_new_bin (const unsigned char *data, unsigned int len);
56
58void xmmsv_unref (xmmsv_t *val);
59
61int xmmsv_is_type (const xmmsv_t *val, xmmsv_type_t t);
62
63int xmmsv_get_error (const xmmsv_t *val, const char **r);
64int xmmsv_get_int (const xmmsv_t *val, int32_t *r);
65int xmmsv_get_string (const xmmsv_t *val, const char **r);
66int xmmsv_get_coll (const xmmsv_t *val, xmmsv_coll_t **coll);
67int xmmsv_get_bin (const xmmsv_t *val, const unsigned char **r, unsigned int *rlen);
68
69/* legacy aliases */
70int 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_none(void)
Allocates a new empty xmmsv_t.
Definition value.c:129
int xmmsv_get_coll(const xmmsv_t *val, xmmsv_coll_t **coll)
Retrieves a collection from the value.
Definition value.c:883
xmmsv_t * xmmsv_ref(xmmsv_t *val)
References the xmmsv_t.
Definition value.c:288
xmmsv_t * xmmsv_new_string(const char *s)
Allocates a new string xmmsv_t.
Definition value.c:180
int xmmsv_get_string(const xmmsv_t *val, const char **r)
Retrieves a string from the value.
Definition value.c:863
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_St xmmsv_t
xmmsv_t * xmmsv_new_coll(xmmsv_coll_t *coll)
Allocates a new collection xmmsv_t.
Definition value.c:202
int xmmsv_get_int(const xmmsv_t *val, int32_t *r)
Retrieves a signed integer from the value.
Definition value.c:823
xmmsv_type_t
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
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_new_bin(const unsigned char *data, unsigned int len)
Allocates a new binary data xmmsv_t.
Definition value.c:225
xmmsv_t * xmmsv_new_error(const char *errstr)
Allocates a new error xmmsv_t.
Definition value.c:143
int xmmsv_is_error(const xmmsv_t *val)
Check if the value stores an error.
Definition value.c:425
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
@ XMMSV_TYPE_NONE
@ XMMSV_TYPE_DICT
@ XMMSV_TYPE_END
@ XMMSV_TYPE_COLL
@ XMMSV_TYPE_BIN
@ XMMSV_TYPE_ERROR
@ XMMSV_TYPE_INT32
@ XMMSV_TYPE_BITBUFFER
@ XMMSV_TYPE_STRING
@ XMMSV_TYPE_LIST
struct xmmsv_coll_St xmmsv_coll_t
Definition xmmsv_coll.h:28