XMMS2
xmmsv_coll.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 #ifndef __XMMS_COLL_H__
18 #define __XMMS_COLL_H__
19 
20 #include "xmmsc/xmmsc_compiler.h"
21 #include "xmmsc/xmmsc_stdint.h"
22 #include "xmmsc/xmmsc_idnumbers.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 typedef struct xmmsv_coll_St xmmsv_coll_t;
29 
30 typedef void (*xmmsv_coll_attribute_foreach_func) (const char *key, const char *value, void *udata);
31 
34 void xmmsv_coll_unref (xmmsv_coll_t *coll);
35 
36 void xmmsv_coll_set_idlist (xmmsv_coll_t *coll, int ids[]);
39 struct xmmsv_St *xmmsv_coll_operands_get (xmmsv_coll_t *coll);
40 
41 int xmmsv_coll_idlist_append (xmmsv_coll_t *coll, int id);
42 int xmmsv_coll_idlist_insert (xmmsv_coll_t *coll, int index, int id);
43 int xmmsv_coll_idlist_move (xmmsv_coll_t *coll, int index, int newindex);
44 int xmmsv_coll_idlist_remove (xmmsv_coll_t *coll, int index);
46 int xmmsv_coll_idlist_get_index (xmmsv_coll_t *coll, int index, int32_t *val);
47 int xmmsv_coll_idlist_set_index (xmmsv_coll_t *coll, int index, int32_t val);
49 
51 struct xmmsv_St *xmmsv_coll_idlist_get (xmmsv_coll_t *coll);
52 
53 /** @deprecated */
55 
56 void xmmsv_coll_attribute_set (xmmsv_coll_t *coll, const char *key, const char *value);
57 int xmmsv_coll_attribute_remove (xmmsv_coll_t *coll, const char *key);
58 int xmmsv_coll_attribute_get (xmmsv_coll_t *coll, const char *key, char **value);
59 
60 /** @deprecated */
62 
63 struct xmmsv_St *xmmsv_coll_attributes_get (xmmsv_coll_t *coll);
64 
66 
67 
68 
69 /* compability */
71 
72 #define xmmsc_coll_new xmmsv_coll_new
73 #define xmmsc_coll_ref xmmsv_coll_ref
74 #define xmmsc_coll_unref xmmsv_coll_unref
75 
76 #define xmmsc_coll_set_idlist xmmsv_coll_set_idlist
77 #define xmmsc_coll_add_operand xmmsv_coll_add_operand
78 #define xmmsc_coll_remove_operand xmmsv_coll_remove_operand
79 
80 #define xmmsc_coll_idlist_append xmmsv_coll_idlist_append
81 #define xmmsc_coll_idlist_insert xmmsv_coll_idlist_insert
82 #define xmmsc_coll_idlist_move xmmsv_coll_idlist_move
83 #define xmmsc_coll_idlist_remove xmmsv_coll_idlist_remove
84 #define xmmsc_coll_idlist_clear xmmsv_coll_idlist_clear
85 #define xmmsc_coll_idlist_get_index xmmsv_coll_idlist_get_index
86 #define xmmsc_coll_idlist_set_index xmmsv_coll_idlist_set_index
87 #define xmmsc_coll_idlist_get_size xmmsv_coll_idlist_get_size
88 
89 #define xmmsc_coll_get_type xmmsv_coll_get_type
90 #define xmmsc_coll_get_idlist xmmsv_coll_get_idlist
91 
92 #define xmmsc_coll_attribute_set xmmsv_coll_attribute_set
93 #define xmmsc_coll_attribute_remove xmmsv_coll_attribute_remove
94 #define xmmsc_coll_attribute_get xmmsv_coll_attribute_get
95 #define xmmsc_coll_attribute_foreach xmmsv_coll_attribute_foreach
96 
97 #define xmmsc_coll_universe xmmsv_coll_universe
98 
99 
100 
101 #ifdef __cplusplus
102 }
103 #endif
104 
105 #endif
int xmmsv_coll_idlist_insert(xmmsv_coll_t *coll, int index, int id)
Insert a value at a given position in the idlist.
Definition: coll.c:267
#define XMMS_DEPRECATED
int xmmsv_coll_attribute_get(xmmsv_coll_t *coll, const char *key, char **value)
Retrieve the value of the attribute of the given collection.
Definition: coll.c:498
const int32_t * xmmsv_coll_get_idlist(xmmsv_coll_t *coll) XMMS_DEPRECATED
Return the list of ids stored in the collection.
Definition: coll.c:390
int xmmsv_coll_idlist_append(xmmsv_coll_t *coll, int id)
Append a value to the idlist.
Definition: coll.c:252
void xmmsv_coll_attribute_set(xmmsv_coll_t *coll, const char *key, const char *value)
Set an attribute in the given collection.
Definition: coll.c:460
xmmsv_coll_t * xmmsv_coll_ref(xmmsv_coll_t *coll)
Increases the references for the xmmsv_coll_t.
Definition: coll.c:61
int xmmsv_coll_attribute_remove(xmmsv_coll_t *coll, const char *key)
Remove an attribute from the given collection.
Definition: coll.c:481
xmmsv_coll_type_t
struct xmmsv_St * xmmsv_coll_operands_get(xmmsv_coll_t *coll)
Definition: coll.c:437
size_t xmmsv_coll_idlist_get_size(xmmsv_coll_t *coll)
Get the size of the idlist.
Definition: coll.c:352
struct xmmsv_St * xmmsv_coll_idlist_get(xmmsv_coll_t *coll)
Return the list of ids stored in the collection.
Definition: coll.c:429
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.
Definition: coll.c:324
struct xmmsv_coll_St xmmsv_coll_t
Definition: xmmsv_coll.h:28
void(* xmmsv_coll_attribute_foreach_func)(const char *key, const char *value, void *udata)
Definition: xmmsv_coll.h:30
xmmsv_coll_t * xmmsv_coll_new(xmmsv_coll_type_t type)
Allocate a new collection of the given type.
Definition: coll.c:78
struct xmmsv_St * xmmsv_coll_attributes_get(xmmsv_coll_t *coll)
Definition: coll.c:445
void xmmsv_coll_add_operand(xmmsv_coll_t *coll, xmmsv_coll_t *op)
Add the operand to the given collection.
Definition: coll.c:195
void xmmsv_coll_set_idlist(xmmsv_coll_t *coll, int ids[])
Set the list of ids in the given collection.
Definition: coll.c:161
int xmmsv_coll_idlist_remove(xmmsv_coll_t *coll, int index)
Remove the value at a given index from the idlist.
Definition: coll.c:296
void xmmsv_coll_remove_operand(xmmsv_coll_t *coll, xmmsv_coll_t *op)
Remove all the occurences of the operand in the given collection.
Definition: coll.c:226
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.
Definition: coll.c:339
void xmmsv_coll_attribute_foreach(xmmsv_coll_t *coll, xmmsv_coll_attribute_foreach_func func, void *user_data) XMMS_DEPRECATED
Iterate over all key/value-pair of the collection attributes.
Definition: coll.c:538
int xmmsv_coll_idlist_move(xmmsv_coll_t *coll, int index, int newindex)
Move a value of the idlist to a new position.
Definition: coll.c:282
int xmmsv_coll_idlist_clear(xmmsv_coll_t *coll)
Empties the idlist.
Definition: coll.c:309
xmmsv_coll_t xmmsc_coll_t
Definition: xmmsv_coll.h:70
xmmsv_coll_type_t xmmsv_coll_get_type(xmmsv_coll_t *coll)
Return the type of the collection.
Definition: coll.c:367
xmmsv_coll_t * xmmsv_coll_universe(void)
Return a collection referencing the whole media library, that is a reference to the "All Media" colle...
Definition: coll.c:555
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...
Definition: coll.c:140