XMMS2
xmmsv_dict.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_DICT_H__
19 #define __XMMSV_DICT_H__
20 
21 #include "xmmsc/xmmsv_general.h"
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /**
28  * @defgroup DictType Dictionaries
29  * @ingroup ValueType
30  * @{
31  */
32 
33 xmmsv_t *xmmsv_new_dict (void);
34 int xmmsv_dict_get (xmmsv_t *dictv, const char *key, xmmsv_t **val);
35 int xmmsv_dict_set (xmmsv_t *dictv, const char *key, xmmsv_t *val);
36 int xmmsv_dict_remove (xmmsv_t *dictv, const char *key);
37 int xmmsv_dict_clear (xmmsv_t *dictv);
38 int xmmsv_dict_get_size (xmmsv_t *dictv);
39 int xmmsv_dict_has_key (xmmsv_t *dictv, const char *key);
40 
41 int xmmsv_dict_entry_get_string (xmmsv_t *val, const char *key, const char **r);
42 int xmmsv_dict_entry_get_int (xmmsv_t *val, const char *key, int32_t *r);
43 int xmmsv_dict_entry_get_coll (xmmsv_t *val, const char *key, xmmsv_coll_t **coll);
44 
45 int xmmsv_dict_set_string (xmmsv_t *val, const char *key, const char *el);
46 int xmmsv_dict_set_int (xmmsv_t *val, const char *key, int32_t el);
47 int xmmsv_dict_set_coll (xmmsv_t *val, const char *key, xmmsv_coll_t *el);
48 
49 /* Utility */
50 xmmsv_type_t xmmsv_dict_entry_get_type (xmmsv_t *val, const char *key);
51 
52 /**
53  * @defgroup DictIterType Iteration
54  * @{
55  */
56 typedef void (*xmmsv_dict_foreach_func) (const char *key, xmmsv_t *value, void *user_data);
57 int xmmsv_dict_foreach (xmmsv_t *dictv, xmmsv_dict_foreach_func func, void *user_data);
58 
59 typedef struct xmmsv_dict_iter_St xmmsv_dict_iter_t;
60 int xmmsv_get_dict_iter (const xmmsv_t *val, xmmsv_dict_iter_t **it);
62 
63 int xmmsv_dict_iter_pair (xmmsv_dict_iter_t *it, const char **key, xmmsv_t **val);
67 int xmmsv_dict_iter_find (xmmsv_dict_iter_t *it, const char *key);
68 
71 
72 int xmmsv_dict_iter_pair_string (xmmsv_dict_iter_t *it, const char **key, const char **r);
73 int xmmsv_dict_iter_pair_int (xmmsv_dict_iter_t *it, const char **key, int32_t *r);
74 int xmmsv_dict_iter_pair_coll (xmmsv_dict_iter_t *it, const char **key, xmmsv_coll_t **r);
75 
76 int xmmsv_dict_iter_set_string (xmmsv_dict_iter_t *it, const char *elem);
77 int xmmsv_dict_iter_set_int (xmmsv_dict_iter_t *it, int32_t elem);
79 /** @} */
80 
81 /** @} */
82 
83 #ifdef __cplusplus
84 }
85 #endif
86 
87 #endif