XMMS2
|
00001 /* XMMS2 - X Music Multiplexer System 00002 * Copyright (C) 2003-2011 XMMS2 Team 00003 * 00004 * PLUGINS ARE NOT CONSIDERED TO BE DERIVED WORK !!! 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 */ 00016 00017 00018 #ifndef __XMMSV_GENERAL_H__ 00019 #define __XMMSV_GENERAL_H__ 00020 00021 #include <stdarg.h> 00022 #include "xmmsc/xmmsc_compiler.h" 00023 #include "xmmsc/xmmsc_stdint.h" 00024 #include "xmmsc/xmmsv_coll.h" 00025 00026 #ifdef __cplusplus 00027 extern "C" { 00028 #endif 00029 00030 /** 00031 * @defgroup ValueType The type xmmsv_t 00032 * @{ 00033 */ 00034 00035 typedef enum { 00036 XMMSV_TYPE_NONE, 00037 XMMSV_TYPE_ERROR, 00038 XMMSV_TYPE_INT32, 00039 XMMSV_TYPE_STRING, 00040 XMMSV_TYPE_COLL, 00041 XMMSV_TYPE_BIN, 00042 XMMSV_TYPE_LIST, 00043 XMMSV_TYPE_DICT, 00044 XMMSV_TYPE_BITBUFFER, 00045 XMMSV_TYPE_END 00046 } xmmsv_type_t; 00047 00048 typedef struct xmmsv_St xmmsv_t; 00049 00050 xmmsv_t *xmmsv_new_none (void); 00051 xmmsv_t *xmmsv_new_error (const char *errstr); /* FIXME: err id? */ 00052 xmmsv_t *xmmsv_new_int (int32_t i); 00053 xmmsv_t *xmmsv_new_string (const char *s); 00054 xmmsv_t *xmmsv_new_coll (xmmsv_coll_t *coll); 00055 xmmsv_t *xmmsv_new_bin (const unsigned char *data, unsigned int len); 00056 00057 xmmsv_t *xmmsv_ref (xmmsv_t *val); 00058 void xmmsv_unref (xmmsv_t *val); 00059 00060 xmmsv_type_t xmmsv_get_type (const xmmsv_t *val); 00061 int xmmsv_is_type (const xmmsv_t *val, xmmsv_type_t t); 00062 00063 int xmmsv_get_error (const xmmsv_t *val, const char **r); 00064 int xmmsv_get_int (const xmmsv_t *val, int32_t *r); 00065 int xmmsv_get_string (const xmmsv_t *val, const char **r); 00066 int xmmsv_get_coll (const xmmsv_t *val, xmmsv_coll_t **coll); 00067 int xmmsv_get_bin (const xmmsv_t *val, const unsigned char **r, unsigned int *rlen); 00068 00069 /* legacy aliases */ 00070 int xmmsv_is_error (const xmmsv_t *val); 00071 00072 /** @} */ 00073 00074 #ifdef __cplusplus 00075 } 00076 #endif 00077 00078 #endif