29 struct xmmsv_coll_St {
39 int32_t *legacy_idlist;
101 coll->legacy_idlist = NULL;
125 if (coll->legacy_idlist) {
126 free (coll->legacy_idlist);
143 x_api_error_if (coll->ref < 1,
"with a freed collection",);
146 if (coll->ref == 0) {
147 xmmsv_coll_free (coll);
166 for (i = 0; ids[i]; i++) {
206 if (_xmmsv_coll_operand_find (it, op)) {
207 x_api_warning (
"with an operand already in operand list");
236 if (_xmmsv_coll_operand_find (it, op)) {
239 x_api_warning (
"with an operand not in operand list");
399 if (coll->legacy_idlist) {
400 free (coll->legacy_idlist);
410 coll->legacy_idlist[i] = entry;
412 coll->legacy_idlist[i] = 0;
414 return coll->legacy_idlist;
441 return coll->operands;
449 return coll->attributes;
509 struct attr_fe_data {
515 attr_fe_func (
const char *key,
xmmsv_t *val,
void *user_data)
517 struct attr_fe_data *d = user_data;
524 d->func (key, v, d->userdata);
542 struct attr_fe_data d = {func, user_data};
int xmmsv_coll_idlist_insert(xmmsv_coll_t *coll, int index, int id)
Insert a value at a given position in the idlist.
#define x_return_val_if_fail(expr, val)
int xmmsv_list_insert_int(xmmsv_t *v, int pos, int32_t val)
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_coll_attribute_get(xmmsv_coll_t *coll, const char *key, char **value)
Retrieve the value of the attribute of the given collection.
int xmmsv_list_clear(xmmsv_t *listv)
Empty the list from all its elements.
const int32_t * xmmsv_coll_get_idlist(xmmsv_coll_t *coll)
Return the list of ids stored in the collection.
int xmmsv_coll_idlist_append(xmmsv_coll_t *coll, int id)
Append a value to the idlist.
int xmmsv_list_iter_remove(xmmsv_list_iter_t *it)
Remove the element in the list at the position pointed at by the iterator.
void xmmsv_coll_attribute_set(xmmsv_coll_t *coll, const char *key, const char *value)
Set an attribute in the given collection.
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_list_get_int(xmmsv_t *v, int pos, int32_t *val)
int xmmsv_coll_attribute_remove(xmmsv_coll_t *coll, const char *key)
Remove an attribute from the given collection.
int xmmsv_get_list_iter(const xmmsv_t *val, xmmsv_list_iter_t **it)
Retrieves a list iterator from a list xmmsv_t.
xmmsv_t * xmmsv_new_dict(void)
Allocates a new dict xmmsv_t.
int xmmsv_list_append_int(xmmsv_t *v, int32_t val)
int xmmsv_list_restrict_type(xmmsv_t *listv, xmmsv_type_t type)
xmmsv_t * xmmsv_coll_operands_get(xmmsv_coll_t *coll)
size_t xmmsv_coll_idlist_get_size(xmmsv_coll_t *coll)
Get the size of the idlist.
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.
xmmsv_t * xmmsv_coll_idlist_get(xmmsv_coll_t *coll)
Return the list of ids stored in the collection.
int xmmsv_coll_idlist_get_index(xmmsv_coll_t *coll, int index, int32_t *val)
Retrieves the value at the given position in the idlist.
int xmmsv_list_move(xmmsv_t *listv, int old_pos, int new_pos)
Move the element from position #old to position #new.
void xmmsv_list_iter_next(xmmsv_list_iter_t *it)
Advance the iterator to the next element in the list.
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
void(* xmmsv_coll_attribute_foreach_func)(const char *key, const char *value, void *udata)
int xmmsv_dict_entry_get_string(xmmsv_t *val, const char *key, const char **r)
xmmsv_t * xmmsv_new_coll(xmmsv_coll_t *coll)
Allocates a new collection xmmsv_t.
xmmsv_coll_t * xmmsv_coll_new(xmmsv_coll_type_t type)
Allocate a new collection of the given type.
int xmmsv_list_remove(xmmsv_t *listv, int pos)
Remove the element at the given position from the list xmmsv_t.
xmmsv_t * xmmsv_coll_attributes_get(xmmsv_coll_t *coll)
void xmmsv_coll_add_operand(xmmsv_coll_t *coll, xmmsv_coll_t *op)
Add the operand to the given collection.
int xmmsv_list_get_size(xmmsv_t *listv)
Return the size of the list.
void xmmsv_coll_set_idlist(xmmsv_coll_t *coll, int ids[])
Set the list of ids in the given collection.
int xmmsv_coll_idlist_remove(xmmsv_coll_t *coll, int index)
Remove the value at a given index from the idlist.
#define x_return_null_if_fail(expr)
void xmmsv_coll_remove_operand(xmmsv_coll_t *coll, xmmsv_coll_t *op)
Remove all the occurences of the operand in the given collection.
#define x_new0(type, num)
int xmmsv_coll_idlist_set_index(xmmsv_coll_t *coll, int index, int32_t val)
Sets the value at the given position in the idlist.
void xmmsv_coll_attribute_foreach(xmmsv_coll_t *coll, xmmsv_coll_attribute_foreach_func func, void *user_data)
Iterate over all key/value-pair of the collection attributes.
#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_entry(xmmsv_list_iter_t *it, xmmsv_t **val)
Get the element currently pointed at by the iterator.
int xmmsv_list_set_int(xmmsv_t *v, int pos, int32_t val)
int xmmsv_coll_idlist_move(xmmsv_coll_t *coll, int index, int newindex)
Move a value of the idlist to a new position.
int xmmsv_list_iter_entry_int(xmmsv_list_iter_t *it, int32_t *val)
int xmmsv_coll_idlist_clear(xmmsv_coll_t *coll)
Empties the idlist.
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).
xmmsv_coll_type_t xmmsv_coll_get_type(xmmsv_coll_t *coll)
Return the type of the collection.
int xmmsv_get_coll(const xmmsv_t *val, xmmsv_coll_t **coll)
Retrieves a collection from the value.
xmmsv_coll_t * xmmsv_coll_universe()
Return a collection referencing the whole media library, that is a reference to the "All Media" colle...
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...