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_DICT_H__ 00019 #define __XMMSV_DICT_H__ 00020 00021 #include "xmmsc/xmmsv_general.h" 00022 00023 #ifdef __cplusplus 00024 extern "C" { 00025 #endif 00026 00027 /** 00028 * @defgroup DictType Dictionaries 00029 * @ingroup ValueType 00030 * @{ 00031 */ 00032 00033 xmmsv_t *xmmsv_new_dict (void); 00034 int xmmsv_dict_get (xmmsv_t *dictv, const char *key, xmmsv_t **val); 00035 int xmmsv_dict_set (xmmsv_t *dictv, const char *key, xmmsv_t *val); 00036 int xmmsv_dict_remove (xmmsv_t *dictv, const char *key); 00037 int xmmsv_dict_clear (xmmsv_t *dictv); 00038 int xmmsv_dict_get_size (xmmsv_t *dictv); 00039 int xmmsv_dict_has_key (xmmsv_t *dictv, const char *key); 00040 00041 int xmmsv_dict_entry_get_string (xmmsv_t *val, const char *key, const char **r); 00042 int xmmsv_dict_entry_get_int (xmmsv_t *val, const char *key, int32_t *r); 00043 int xmmsv_dict_entry_get_coll (xmmsv_t *val, const char *key, xmmsv_coll_t **coll); 00044 00045 int xmmsv_dict_set_string (xmmsv_t *val, const char *key, const char *el); 00046 int xmmsv_dict_set_int (xmmsv_t *val, const char *key, int32_t el); 00047 int xmmsv_dict_set_coll (xmmsv_t *val, const char *key, xmmsv_coll_t *el); 00048 00049 /* Utility */ 00050 xmmsv_type_t xmmsv_dict_entry_get_type (xmmsv_t *val, const char *key); 00051 00052 /** 00053 * @defgroup DictIterType Iteration 00054 * @{ 00055 */ 00056 typedef void (*xmmsv_dict_foreach_func) (const char *key, xmmsv_t *value, void *user_data); 00057 int xmmsv_dict_foreach (xmmsv_t *dictv, xmmsv_dict_foreach_func func, void *user_data); 00058 00059 typedef struct xmmsv_dict_iter_St xmmsv_dict_iter_t; 00060 int xmmsv_get_dict_iter (const xmmsv_t *val, xmmsv_dict_iter_t **it); 00061 void xmmsv_dict_iter_explicit_destroy (xmmsv_dict_iter_t *it); 00062 00063 int xmmsv_dict_iter_pair (xmmsv_dict_iter_t *it, const char **key, xmmsv_t **val); 00064 int xmmsv_dict_iter_valid (xmmsv_dict_iter_t *it); 00065 void xmmsv_dict_iter_first (xmmsv_dict_iter_t *it); 00066 void xmmsv_dict_iter_next (xmmsv_dict_iter_t *it); 00067 int xmmsv_dict_iter_find (xmmsv_dict_iter_t *it, const char *key); 00068 00069 int xmmsv_dict_iter_set (xmmsv_dict_iter_t *it, xmmsv_t *val); 00070 int xmmsv_dict_iter_remove (xmmsv_dict_iter_t *it); 00071 00072 int xmmsv_dict_iter_pair_string (xmmsv_dict_iter_t *it, const char **key, const char **r); 00073 int xmmsv_dict_iter_pair_int (xmmsv_dict_iter_t *it, const char **key, int32_t *r); 00074 int xmmsv_dict_iter_pair_coll (xmmsv_dict_iter_t *it, const char **key, xmmsv_coll_t **r); 00075 00076 int xmmsv_dict_iter_set_string (xmmsv_dict_iter_t *it, const char *elem); 00077 int xmmsv_dict_iter_set_int (xmmsv_dict_iter_t *it, int32_t elem); 00078 int xmmsv_dict_iter_set_coll (xmmsv_dict_iter_t *it, xmmsv_coll_t *elem); 00079 /** @} */ 00080 00081 /** @} */ 00082 00083 #ifdef __cplusplus 00084 } 00085 #endif 00086 00087 #endif