50 typedef struct xmmsv_bin_St {
55 struct xmmsv_list_St {
67 static int xmmsv_list_resize (
xmmsv_list_t *l,
int newsize);
70 static int _xmmsv_list_remove (
xmmsv_list_t *l,
int pos);
71 static int _xmmsv_list_move (
xmmsv_list_t *l,
int old_pos,
int new_pos);
78 struct xmmsv_list_iter_St {
117 static void xmmsv_free (
xmmsv_t *val);
118 static int absolutify_and_validate_pos (
int *pos,
int size,
int allow_append);
148 val->value.error = strdup (errstr);
166 val->value.int32 = i;
189 val->value.string = strdup (s);
231 val->value.bin.data =
x_malloc (len);
232 if (!val->value.bin.data) {
237 memcpy (val->value.bin.data, data, len);
238 val->value.bin.len = len;
255 val->value.list = xmmsv_list_new ();
256 val->value.list->parent_value = val;
273 val->value.dict = xmmsv_dict_new ();
306 x_api_error_if (val->ref < 1,
"with a freed value",);
350 free (val->value.error);
351 val->value.error = NULL;
354 free (val->value.string);
355 val->value.string = NULL;
359 val->value.coll = NULL;
362 free (val->value.bin.data);
363 val->value.bin.len = 0;
366 xmmsv_list_free (val->value.list);
367 val->value.list = NULL;
370 xmmsv_dict_free (val->value.dict);
371 val->value.dict = NULL;
374 if (!val->value.bit.ro && val->value.bit.buf) {
375 free (val->value.bit.buf);
377 val->value.bit.buf = NULL;
394 x_api_error_if (!val,
"NULL value",
410 x_api_error_if (!val,
"NULL value", 0);
468 return val->value.error;
490 for (i = 0; (num >= 0 && i < num) || array[i]; i++) {
521 #define GEN_DICT_EXTRACTOR_FUNC(typename, type) \ 523 xmmsv_dict_entry_get_##typename (xmmsv_t *val, const char *key, \ 527 if (!xmmsv_dict_get (val, key, &v)) { \ 530 return xmmsv_get_##typename (v, r); \ 538 #define GEN_DICT_SET_FUNC(typename, type) \ 540 xmmsv_dict_set_##typename (xmmsv_t *dict, const char *key, type elem) \ 545 v = xmmsv_new_##typename (elem); \ 546 ret = xmmsv_dict_set (dict, key, v); \ 557 #define GEN_DICT_ITER_EXTRACTOR_FUNC(typename, type) \ 559 xmmsv_dict_iter_pair_##typename (xmmsv_dict_iter_t *it, \ 564 if (!xmmsv_dict_iter_pair (it, key, &v)) { \ 568 return xmmsv_get_##typename (v, r); \ 579 #define GEN_DICT_ITER_SET_FUNC(typename, type) \ 581 xmmsv_dict_iter_set_##typename (xmmsv_dict_iter_t *it, type elem) \ 586 v = xmmsv_new_##typename (elem); \ 587 ret = xmmsv_dict_iter_set (it, v); \ 598 #define GEN_LIST_EXTRACTOR_FUNC(typename, type) \ 600 xmmsv_list_get_##typename (xmmsv_t *val, int pos, type *r) \ 603 if (!xmmsv_list_get (val, pos, &v)) { \ 606 return xmmsv_get_##typename (v, r); \ 614 #define GEN_LIST_SET_FUNC(typename, type) \ 616 xmmsv_list_set_##typename (xmmsv_t *list, int pos, type elem) \ 621 v = xmmsv_new_##typename (elem); \ 622 ret = xmmsv_list_set (list, pos, v); \ 633 #define GEN_LIST_INSERT_FUNC(typename, type) \ 635 xmmsv_list_insert_##typename (xmmsv_t *list, int pos, type elem) \ 640 v = xmmsv_new_##typename (elem); \ 641 ret = xmmsv_list_insert (list, pos, v); \ 652 #define GEN_LIST_APPEND_FUNC(typename, type) \ 654 xmmsv_list_append_##typename (xmmsv_t *list, type elem) \ 659 v = xmmsv_new_##typename (elem); \ 660 ret = xmmsv_list_append (list, v); \ 671 #define GEN_LIST_ITER_EXTRACTOR_FUNC(typename, type) \ 673 xmmsv_list_iter_entry_##typename (xmmsv_list_iter_t *it, type *r) \ 676 if (!xmmsv_list_iter_entry (it, &v)) { \ 679 return xmmsv_get_##typename (v, r); \ 687 #define GEN_LIST_ITER_INSERT_FUNC(typename, type) \ 689 xmmsv_list_iter_insert_##typename (xmmsv_list_iter_t *it, type elem) \ 694 v = xmmsv_new_##typename (elem); \ 695 ret = xmmsv_list_iter_insert (it, v); \ 706 source_match_pattern (
const char *source,
const char *pattern)
709 int lpos = strlen (pattern) - 1;
711 if (strcasecmp (pattern, source) == 0) {
713 }
else if (lpos >= 0 && pattern[lpos] ==
'*' &&
714 (lpos == 0 || strncasecmp (source, pattern, lpos) == 0)) {
725 find_match_index (
const char *source,
const char **src_prefs)
729 for (i = 0; src_prefs[i]; i++) {
730 if (source_match_pattern (source, src_prefs[i])) {
754 xmmsv_t *dict, *source_dict, *value, *best_value;
756 const char *key, *source;
757 const char **local_prefs;
758 int match_index, best_index;
773 match_index = find_match_index (source, local_prefs);
775 if (match_index >= 0 && (best_index < 0 ||
776 match_index < best_index)) {
778 best_index = match_index;
810 *r = val->value.error;
829 *r = val->value.int32;
849 *r = val->value.int32;
869 *r = val->value.string;
889 *c = val->value.coll;
910 *r = val->value.bin.data;
911 *rlen = val->value.bin.len;
935 new_it = xmmsv_list_iter_new (val->value.list);
964 new_it = xmmsv_dict_iter_new (val->value.dict);
979 xmmsv_list_new (
void)
1001 while (l->iterators) {
1003 xmmsv_list_iter_free (it);
1007 for (i = 0; i < l->size; i++) {
1020 newmem = realloc (l->list, newsize * sizeof (
xmmsv_t *));
1022 if (newsize != 0 && newmem == NULL) {
1028 l->allocated = newsize;
1039 if (!absolutify_and_validate_pos (&pos, l->size, 1)) {
1043 if (l->restricted) {
1048 if (l->size == l->allocated) {
1051 if (l->allocated > 0) {
1052 double_size = l->allocated << 1;
1056 success = xmmsv_list_resize (l, double_size);
1061 if (l->size > pos) {
1062 memmove (l->list + pos + 1, l->list + pos,
1063 (l->size - pos) * sizeof (
xmmsv_t *));
1070 for (n = l->iterators; n; n = n->
next) {
1072 if (it->position > pos) {
1083 return _xmmsv_list_insert (l, l->size, val);
1094 if (!absolutify_and_validate_pos (&pos, l->size, 0)) {
1103 if (pos < l->size) {
1104 memmove (l->list + pos, l->list + pos + 1,
1105 (l->size - pos) * sizeof (
xmmsv_t *));
1109 half_size = l->allocated >> 1;
1110 if (l->size <= half_size) {
1112 success = xmmsv_list_resize (l, half_size);
1117 for (n = l->iterators; n; n = n->
next) {
1119 if (it->position > pos) {
1128 _xmmsv_list_move (
xmmsv_list_t *l,
int old_pos,
int new_pos)
1134 if (!absolutify_and_validate_pos (&old_pos, l->size, 0)) {
1137 if (!absolutify_and_validate_pos (&new_pos, l->size, 0)) {
1141 v = l->list[old_pos];
1142 if (old_pos < new_pos) {
1143 memmove (l->list + old_pos, l->list + old_pos + 1,
1144 (new_pos - old_pos) * sizeof (
xmmsv_t *));
1145 l->list[new_pos] = v;
1148 for (n = l->iterators; n; n = n->
next) {
1150 if (it->position >= old_pos && it->position <= new_pos) {
1151 if (it->position == old_pos) {
1152 it->position = new_pos;
1159 memmove (l->list + new_pos + 1, l->list + new_pos,
1160 (old_pos - new_pos) * sizeof (
xmmsv_t *));
1161 l->list[new_pos] = v;
1164 for (n = l->iterators; n; n = n->
next) {
1166 if (it->position >= new_pos && it->position <= old_pos) {
1167 if (it->position == old_pos) {
1168 it->position = new_pos;
1187 for (i = 0; i < l->size; i++) {
1199 for (n = l->iterators; n; n = n->
next) {
1225 l = listv->value.list;
1228 if (!absolutify_and_validate_pos (&pos, l->size, 0)) {
1233 *val = l->list[pos];
1258 l = listv->value.list;
1260 if (!absolutify_and_validate_pos (&pos, l->size, 0)) {
1264 old_val = l->list[pos];
1288 return _xmmsv_list_insert (listv->value.list, pos, val);
1305 return _xmmsv_list_remove (listv->value.list, pos);
1328 return _xmmsv_list_move (listv->value.list, old_pos, new_pos);
1346 return _xmmsv_list_append (listv->value.list, val);
1361 _xmmsv_list_clear (listv->value.list);
1387 func (v, user_data);
1391 xmmsv_list_iter_free (it);
1408 return listv->value.list->size;
1430 xmmsv_list_iter_free (it);
1432 listv->value.list->restricted =
true;
1433 listv->value.list->restricttype = type;
1463 it->parent->iterators =
x_list_remove (it->parent->iterators, it);
1480 xmmsv_list_iter_free (it);
1500 *val = it->parent->list[it->position];
1514 return it && (it->position < it->parent->size) && (it->position >= 0);
1540 if (it->parent->size > 0) {
1541 it->position = it->parent->size - 1;
1543 it->position = it->parent->size;
1557 if (it->position < it->parent->size) {
1572 if (it->position >= 0) {
1591 if (!absolutify_and_validate_pos (&pos, it->parent->size, 1)) {
1610 return it->position;
1624 return it->parent->parent_value;
1641 return _xmmsv_list_insert (it->parent, it->position, val);
1656 return _xmmsv_list_remove (it->parent, it->position);
1661 struct xmmsv_dict_St {
1667 struct xmmsv_dict_iter_St {
1674 xmmsv_dict_new (
void)
1684 dict->flatlist = xmmsv_list_new ();
1695 while (dict->iterators) {
1697 xmmsv_dict_iter_free (it);
1700 xmmsv_list_free (dict->flatlist);
1736 xmmsv_dict_iter_free (it);
1782 it->lit->position--;
1789 xmmsv_dict_iter_free (it);
1821 xmmsv_dict_iter_free (it);
1838 _xmmsv_list_clear (dictv->value.dict->flatlist);
1866 func (key, v, user_data);
1870 xmmsv_dict_iter_free (it);
1887 return dictv->value.dict->flatlist->size / 2;
1901 it->lit = xmmsv_list_iter_new (d->flatlist);
1916 it->parent->iterators =
x_list_remove (it->parent->iterators, it);
1933 xmmsv_dict_iter_free (it);
1959 orig = it->lit->position;
1971 it->lit->position = orig;
2032 int s, dict_size, cmp, left, right;
2038 dict_size = it->parent->flatlist->size / 2;
2051 right = dict_size - 1;
2053 while (left <= right) {
2054 int mid = left + ((right - left) / 2);
2065 cmp = strcmp (k, key);
2109 orig = it->lit->position;
2116 it->lit->position = orig;
2185 unsigned char chr = ins[i++];
2189 }
else if (chr ==
'%') {
2201 chr = strtoul (ts, &t, 16);
2231 va_start (ap, firstkey);
2243 key = va_arg (ap,
const char *);
2283 va_start (ap, first_entry);
2316 memset (target, 0, len);
2319 while (strlen (target) + 1 < len) {
2320 char *next_key, *key, *end;
2325 next_key = strstr (pos,
"${");
2327 strncat (target, pos, len - strlen (target) - 1);
2331 strncat (target, pos,
MIN (next_key - pos, len - strlen (target) - 1));
2332 keylen = strcspn (next_key + 2,
"}");
2333 key = malloc (keylen + 1);
2336 fprintf (stderr,
"Unable to allocate %u bytes of memory, OOM?", keylen);
2340 memset (key, 0, keylen + 1);
2341 strncpy (key, next_key + 2, keylen);
2345 if (strcmp (key,
"seconds") == 0) {
2356 strncat (target,
"00", len - strlen (target) - 1);
2361 snprintf (seconds,
sizeof (seconds),
"%02d", (duration/1000)%60);
2362 strncat (target, seconds, len - strlen (target) - 1);
2364 }
else if (strcmp (key,
"minutes") == 0) {
2375 strncat (target,
"00", len - strlen (target) - 1);
2380 snprintf (minutes,
sizeof (minutes),
"%02d", duration/60000);
2381 strncat (target, minutes, len - strlen (target) - 1);
2384 const char *result = NULL;
2396 snprintf (tmp, 12,
"%u", ui);
2401 snprintf (tmp, 12,
"%d", i);
2407 strncat (target, result, len - strlen (target) - 1);
2411 end = strchr (next_key,
'}');
2420 return strlen (target);
2424 _xmmsv_utf8_charlen (
unsigned char c)
2426 if ((c & 0x80) == 0) {
2428 }
else if ((c & 0x60) == 0x40) {
2430 }
else if ((c & 0x70) == 0x60) {
2432 }
else if ((c & 0x78) == 0x70) {
2449 unsigned char c = str[i++];
2456 l = _xmmsv_utf8_charlen (c);
2460 if ((str[i++] & 0xC0) != 0x80)
2472 absolutify_and_validate_pos (
int *pos,
int size,
int allow_append)
2485 if (!allow_append && *pos == size)
2504 val->value.bit.buf = (
unsigned char *) v;
2505 val->value.bit.len = len * 8;
2506 val->value.bit.ro =
true;
2516 val->value.bit.buf = NULL;
2517 val->value.bit.len = 0;
2518 val->value.bit.ro =
false;
2528 x_api_error_if (bits < 1,
"less than one bit requested", 0);
2531 int pos = v->value.bit.pos;
2533 if (pos >= v->value.bit.len)
2535 r = (v->value.bit.buf[pos / 8] >> (7-(pos % 8)) & 1);
2536 v->value.bit.pos += 1;
2542 for (i = 0; i < bits; i++) {
2573 x_api_error_if (v->value.bit.ro,
"write to readonly bitbuffer", 0);
2574 x_api_error_if (bits < 1,
"less than one bit requested", 0);
2577 pos = v->value.bit.pos;
2579 if (pos >= v->value.bit.alloclen) {
2581 nl = v->value.bit.alloclen * 2;
2582 ol = v->value.bit.alloclen;
2583 nl = nl < 128 ? 128 : nl;
2585 v->value.bit.buf = realloc (v->value.bit.buf, nl / 8);
2586 memset (v->value.bit.buf + ol / 8, 0, (nl - ol) / 8);
2587 v->value.bit.alloclen = nl;
2589 t = v->value.bit.buf[pos / 8];
2591 t = (t & (~(1<<(7-(pos % 8))))) | (d << (7-(pos % 8)));
2593 v->value.bit.buf[pos / 8] = t;
2595 v->value.bit.pos += 1;
2596 if (v->value.bit.pos > v->value.bit.len)
2597 v->value.bit.len = v->value.bit.pos;
2601 for (i = 0; i < bits; i++) {
2638 v->value.bit.pos = (v->value.bit.pos + 7) % 8;
2645 x_api_error_if (pos < 0,
"negative position", 0);
2646 x_api_error_if (pos > v->value.bit.len,
"position after buffer end", 0);
2648 v->value.bit.pos = pos;
2655 return v->value.bit.pos;
2673 return v->value.bit.len;
2676 const unsigned char *
2679 return v->value.bit.buf;
void xmmsv_list_iter_first(xmmsv_list_iter_t *it)
Rewind the iterator to the start of the list.
xmmsv_t * xmmsv_bitbuffer_new_ro(const unsigned char *v, int len)
#define x_return_val_if_fail(expr, val)
xmmsv_t * xmmsv_propdict_to_dict(xmmsv_t *propdict, const char **src_prefs)
Helper function to transform a key-source-value dict-of-dict xmmsv_t (formerly a propdict) to a regul...
struct xmmsv_list_iter_St xmmsv_list_iter_t
int xmmsv_dict_set(xmmsv_t *dictv, const char *key, xmmsv_t *val)
Insert an element under the given key in the dict xmmsv_t.
void xmmsv_unref(xmmsv_t *val)
Decreases the references for the xmmsv_t When the number of references reaches 0 it will be freed...
int xmmsv_list_append(xmmsv_t *listv, xmmsv_t *val)
Append an element to the end of the list xmmsv_t.
int xmmsv_list_clear(xmmsv_t *listv)
Empty the list from all its elements.
struct xmmsv_list_St xmmsv_list_t
xmmsv_t * xmmsv_new_error(const char *errstr)
Allocates a new error xmmsv_t.
int xmmsv_list_iter_remove(xmmsv_list_iter_t *it)
Remove the element in the list at the position pointed at by the iterator.
#define GEN_LIST_INSERT_FUNC(typename, type)
int xmmsv_dict_iter_pair(xmmsv_dict_iter_t *it, const char **key, xmmsv_t **val)
Get the key-element pair currently pointed at by the iterator.
xmmsv_t * xmmsv_new_none(void)
Allocates a new empty xmmsv_t.
xmmsv_t * xmmsv_decode_url(const xmmsv_t *inv)
Decode an URL-encoded string.
int xmmsv_dict_iter_set(xmmsv_dict_iter_t *it, xmmsv_t *val)
Replace the element of the pair currently pointed to by the iterator.
xmmsv_t * xmmsv_build_list_va(xmmsv_t *first_entry, va_list ap)
xmmsv_t * xmmsv_new_string(const char *s)
Allocates a new string xmmsv_t.
xmmsv_coll_t * xmmsv_coll_ref(xmmsv_coll_t *coll)
Increases the references for the xmmsv_coll_t.
int xmmsv_get_int(const xmmsv_t *val, int32_t *r)
Retrieves a signed integer from the value.
#define GEN_LIST_EXTRACTOR_FUNC(typename, type)
x_list_t * x_list_remove(x_list_t *list, const void *data)
int xmmsv_list_iter_tell(const xmmsv_list_iter_t *it)
Tell the position of the iterator.
int xmmsv_get_list_iter(const xmmsv_t *val, xmmsv_list_iter_t **it)
Retrieves a list iterator from a list xmmsv_t.
int xmmsv_bitbuffer_get_data(xmmsv_t *v, unsigned char *b, int len)
void xmmsv_dict_iter_next(xmmsv_dict_iter_t *it)
Advance the iterator to the next pair in the dict.
xmmsv_t * xmmsv_new_dict(void)
Allocates a new dict xmmsv_t.
int xmmsv_dict_iter_find(xmmsv_dict_iter_t *it, const char *key)
Move the iterator to the pair with the given key (if it exists) or move it to the position where the ...
#define GEN_LIST_ITER_INSERT_FUNC(typename, type)
int xmmsv_list_restrict_type(xmmsv_t *listv, xmmsv_type_t type)
int xmmsv_dict_foreach(xmmsv_t *dictv, xmmsv_dict_foreach_func func, void *user_data)
Apply a function to each key-element pair in the list.
int xmmsv_dict_iter_valid(xmmsv_dict_iter_t *it)
Check whether the iterator is valid and points to a valid pair.
void xmmsv_dict_iter_explicit_destroy(xmmsv_dict_iter_t *it)
Explicitly free dict iterator.
void(* xmmsv_dict_foreach_func)(const char *key, xmmsv_t *value, void *user_data)
int xmmsv_bitbuffer_pos(xmmsv_t *v)
int xmmsv_bitbuffer_goto(xmmsv_t *v, int pos)
int xmmsv_list_move(xmmsv_t *listv, int old_pos, int new_pos)
Move the element from position #old to position #new.
#define GEN_DICT_ITER_SET_FUNC(typename, type)
int xmmsv_is_list(const xmmsv_t *val)
Check if the value stores a list.
xmmsv_t * xmmsv_make_stringlist(char *array[], int num)
Helper function to build a list xmmsv_t containing the strings from the input array.
int xmmsv_dict_get(xmmsv_t *dictv, const char *key, xmmsv_t **val)
Get the element corresponding to the given key in the dict xmmsv_t (if it exists).
int xmmsv_is_type(const xmmsv_t *val, xmmsv_type_t t)
Check if value is of specified type.
void xmmsv_list_iter_next(xmmsv_list_iter_t *it)
Advance the iterator to the next element in the list.
const unsigned char * xmmsv_bitbuffer_buffer(xmmsv_t *v)
int xmmsv_is_dict(const xmmsv_t *val)
Check if the value stores a dict.
xmmsv_t * xmmsv_new_list(void)
Allocates a new list xmmsv_t.
void xmmsv_list_iter_explicit_destroy(xmmsv_list_iter_t *it)
Explicitly free list iterator.
struct xmmsv_coll_St xmmsv_coll_t
int xmmsv_list_get(xmmsv_t *listv, int pos, xmmsv_t **val)
Get the element at the given position in the list xmmsv_t.
void xmmsv_list_iter_prev(xmmsv_list_iter_t *it)
Move the iterator to the previous element in the list.
const char * xmmsv_get_error_old(const xmmsv_t *val)
Legacy alias to retrieve the error string from an xmmsv_t.
xmmsv_type_t xmmsv_dict_entry_get_type(xmmsv_t *val, const char *key)
Gets the type of a dict entry.
int xmmsv_list_iter_seek(xmmsv_list_iter_t *it, int pos)
Move the iterator to the n-th element in the list.
int xmmsv_bitbuffer_put_bits(xmmsv_t *v, int bits, int d)
int xmmsv_get_uint(const xmmsv_t *val, uint32_t *r)
Retrieves a unsigned integer from the value.
#define GEN_LIST_APPEND_FUNC(typename, type)
int xmmsv_bitbuffer_put_bits_at(xmmsv_t *v, int bits, int d, int offset)
#define XMMSV_TYPE_UINT32
int xmmsv_bitbuffer_align(xmmsv_t *v)
int xmmsv_dict_format(char *target, int len, const char *fmt, xmmsv_t *val)
This function will make a pretty string about the information in xmmsv dict.
xmmsv_t * xmmsv_new_coll(xmmsv_coll_t *c)
Allocates a new collection xmmsv_t.
int xmmsv_bitbuffer_len(xmmsv_t *v)
xmmsv_type_t xmmsv_get_type(const xmmsv_t *val)
Get the type of the value.
int xmmsv_list_remove(xmmsv_t *listv, int pos)
Remove the element at the given position from the list xmmsv_t.
xmmsv_t * xmmsv_new_int(int32_t i)
Allocates a new integer xmmsv_t.
int xmmsv_list_get_size(xmmsv_t *listv)
Return the size of the list.
xmmsv_t * xmmsv_build_dict(const char *firstkey,...)
xmmsv_t * xmmsv_ref(xmmsv_t *val)
References the xmmsv_t.
int xmmsv_get_error(const xmmsv_t *val, const char **r)
Retrieves an error string describing the server error from the value.
void xmmsv_dict_iter_first(xmmsv_dict_iter_t *it)
Rewind the iterator to the start of the dict.
void xmmsv_list_iter_last(xmmsv_list_iter_t *it)
Move the iterator to end of the list.
#define x_new0(type, num)
int xmmsv_utf8_validate(const char *str)
Check if a string is valid UTF-8.
int xmmsv_bitbuffer_rewind(xmmsv_t *v)
int xmmsv_list_set(xmmsv_t *listv, int pos, xmmsv_t *val)
Set the element at the given position in the list xmmsv_t.
#define GEN_DICT_SET_FUNC(typename, type)
struct xmmsv_bin_St xmmsv_bin_t
int xmmsv_get_bin(const xmmsv_t *val, const unsigned char **r, unsigned int *rlen)
Retrieves binary data from the value.
int xmmsv_bitbuffer_put_data(xmmsv_t *v, const unsigned char *b, int len)
xmmsv_t * xmmsv_build_list(xmmsv_t *first_entry,...)
#define x_return_if_fail(expr)
int xmmsv_list_iter_valid(xmmsv_list_iter_t *it)
Check whether the iterator is valid and points to a valid element.
int xmmsv_get_string(const xmmsv_t *val, const char **r)
Retrieves a string from the value.
int xmmsv_list_iter_insert(xmmsv_list_iter_t *it, xmmsv_t *val)
Insert an element in the list at the position pointed at by the iterator.
int xmmsv_bitbuffer_end(xmmsv_t *v)
int xmmsv_is_error(const xmmsv_t *val)
Check if the value stores an error.
int xmmsv_bitbuffer_get_bits(xmmsv_t *v, int bits, int *res)
x_list_t * x_list_prepend(x_list_t *list, void *data)
#define GEN_LIST_ITER_EXTRACTOR_FUNC(typename, type)
int xmmsv_dict_iter_remove(xmmsv_dict_iter_t *it)
Remove the pair in the dict pointed at by the iterator.
int xmmsv_list_insert(xmmsv_t *listv, int pos, xmmsv_t *val)
Insert an element at the given position in the list xmmsv_t.
#define GEN_DICT_ITER_EXTRACTOR_FUNC(typename, type)
int xmmsv_list_iter_entry(xmmsv_list_iter_t *it, xmmsv_t **val)
Get the element currently pointed at by the iterator.
struct xmmsv_dict_St xmmsv_dict_t
void(* xmmsv_list_foreach_func)(xmmsv_t *value, void *user_data)
#define GEN_DICT_EXTRACTOR_FUNC(typename, type)
struct xmmsv_dict_iter_St xmmsv_dict_iter_t
xmmsv_t * xmmsv_new_bin(const unsigned char *data, unsigned int len)
Allocates a new binary data xmmsv_t.
int xmmsv_get_dict_iter(const xmmsv_t *val, xmmsv_dict_iter_t **it)
Retrieves a dict iterator from a dict xmmsv_t.
int xmmsv_dict_remove(xmmsv_t *dictv, const char *key)
Remove the element corresponding to a given key in the dict xmmsv_t (if it exists).
#define GEN_LIST_SET_FUNC(typename, type)
int xmmsv_list_foreach(xmmsv_t *listv, xmmsv_list_foreach_func func, void *user_data)
Apply a function to each element in the list, in sequential order.
int xmmsv_dict_get_size(xmmsv_t *dictv)
Return the size of the dict.
int xmmsv_dict_has_key(xmmsv_t *dictv, const char *key)
int xmmsv_dict_clear(xmmsv_t *dictv)
Empty the dict of all its elements.
const char * default_source_pref[]
xmmsv_t * xmmsv_list_iter_get_parent(const xmmsv_list_iter_t *it)
Return the parent xmmsv_t of an iterator.
int xmmsv_get_coll(const xmmsv_t *val, xmmsv_coll_t **c)
Retrieves a collection from the value.
xmmsv_t * xmmsv_bitbuffer_new(void)
void xmmsv_coll_unref(xmmsv_coll_t *coll)
Decreases the references for the xmmsv_coll_t When the number of references reaches 0 it will be free...