CollectionStructure


Detailed Description

The API to be used to work with collection structures.


Functions

xmmsc_coll_txmmsc_coll_ref (xmmsc_coll_t *coll)
 Increases the references for the xmmsc_coll_t.
xmmsc_coll_txmmsc_coll_new (xmmsc_coll_type_t type)
 Allocate a new collection of the given type.
void xmmsc_coll_unref (xmmsc_coll_t *coll)
 Decreases the references for the xmmsc_coll_t When the number of references reaches 0 it will be freed and all its operands unreferenced as well.
void xmmsc_coll_set_idlist (xmmsc_coll_t *coll, unsigned int ids[])
 Set the list of ids in the given collection.
void xmmsc_coll_add_operand (xmmsc_coll_t *coll, xmmsc_coll_t *op)
 Add the operand to the given collection.
void xmmsc_coll_remove_operand (xmmsc_coll_t *coll, xmmsc_coll_t *op)
 Remove all the occurences of the operand in the given collection.
int xmmsc_coll_idlist_append (xmmsc_coll_t *coll, unsigned int id)
 Append a value to the idlist.
int xmmsc_coll_idlist_insert (xmmsc_coll_t *coll, unsigned int index, unsigned int id)
 Insert a value at a given position in the idlist.
int xmmsc_coll_idlist_move (xmmsc_coll_t *coll, unsigned int index, unsigned int newindex)
 Move a value of the idlist to a new position.
int xmmsc_coll_idlist_remove (xmmsc_coll_t *coll, unsigned int index)
 Remove the value at a given index from the idlist.
int xmmsc_coll_idlist_clear (xmmsc_coll_t *coll)
 Empties the idlist.
int xmmsc_coll_idlist_get_index (xmmsc_coll_t *coll, unsigned int index, uint32_t *val)
 Retrieves the value at the given position in the idlist.
int xmmsc_coll_idlist_set_index (xmmsc_coll_t *coll, unsigned int index, uint32_t val)
 Sets the value at the given position in the idlist.
size_t xmmsc_coll_idlist_get_size (xmmsc_coll_t *coll)
 Get the size of the idlist.
xmmsc_coll_type_t xmmsc_coll_get_type (xmmsc_coll_t *coll)
 Return the type of the collection.
uint32_t * xmmsc_coll_get_idlist (xmmsc_coll_t *coll)
 Return the list of ids stored in the collection.
int xmmsc_coll_operand_list_first (xmmsc_coll_t *coll)
 Move the internal pointer of the operand list to the first operand.
int xmmsc_coll_operand_list_valid (xmmsc_coll_t *coll)
 Checks if the internal pointer points to a valid operand of the list.
int xmmsc_coll_operand_list_entry (xmmsc_coll_t *coll, xmmsc_coll_t **operand)
 Provide a reference to the current operand in the list by changing the operand parameter to point to it.
int xmmsc_coll_operand_list_next (xmmsc_coll_t *coll)
 Move forward the internal pointer of the operand list.
int xmmsc_coll_operand_list_save (xmmsc_coll_t *coll)
 Save the position of the operand iterator, to be restored later by calling xmmsc_coll_operand_list_restore.
int xmmsc_coll_operand_list_restore (xmmsc_coll_t *coll)
 Restore the position of the operand iterator, previously saved by calling xmmsc_coll_operand_list_save.
void xmmsc_coll_operand_list_clear (xmmsc_coll_t *coll)
 Remove all the operands.
void xmmsc_coll_attribute_set (xmmsc_coll_t *coll, const char *key, const char *value)
 Set an attribute in the given collection.
int xmmsc_coll_attribute_remove (xmmsc_coll_t *coll, const char *key)
 Remove an attribute from the given collection.
int xmmsc_coll_attribute_get (xmmsc_coll_t *coll, const char *key, char **value)
 Retrieve the value of the attribute of the given collection.
void xmmsc_coll_attribute_foreach (xmmsc_coll_t *coll, xmmsc_coll_attribute_foreach_func func, void *user_data)
 Iterate over all key/value-pair of the collection attributes.
void xmmsc_coll_attribute_list_first (xmmsc_coll_t *coll)
int xmmsc_coll_attribute_list_valid (xmmsc_coll_t *coll)
void xmmsc_coll_attribute_list_entry (xmmsc_coll_t *coll, const char **k, const char **v)
void xmmsc_coll_attribute_list_next (xmmsc_coll_t *coll)
xmmsc_coll_txmmsc_coll_universe ()
 Return a collection referencing the whole media library, that is a reference to the "All Media" collection.


Function Documentation

void xmmsc_coll_add_operand ( xmmsc_coll_t coll,
xmmsc_coll_t op 
)

Add the operand to the given collection.

Parameters:
coll The collection to add the operand to.
op The operand to add.

Definition at line 209 of file coll.c.

Referenced by bind_all_references(), and xmms_ipc_msg_get_collection_alloc().

void xmmsc_coll_attribute_foreach ( xmmsc_coll_t coll,
xmmsc_coll_attribute_foreach_func  func,
void *  user_data 
)

Iterate over all key/value-pair of the collection attributes.

Calls specified function for each key/value-pair of the attribute list.

void function (const char *key, const char *value, void *user_data);

Parameters:
coll the xmmsc_coll_t.
func function that is called for each key/value-pair
user_data extra data passed to func

Definition at line 726 of file coll.c.

Referenced by xmms_ipc_msg_put_collection().

int xmmsc_coll_attribute_get ( xmmsc_coll_t coll,
const char *  key,
char **  value 
)

Retrieve the value of the attribute of the given collection.

The return value is 1 if the attribute was found and 0 otherwise. The value of the attribute is owned by the collection and must not be freed by the caller.

Parameters:
coll The collection to retrieve the attribute from.
key The name of the attribute.
value The value of the attribute if found (owned by the collection).
Returns:
1 if the attribute was found, 0 otherwise

Definition at line 689 of file coll.c.

Referenced by bind_all_references(), xmms_collection_get_int_attr(), and xmms_playlist_advance().

void xmmsc_coll_attribute_list_entry ( xmmsc_coll_t coll,
const char **  k,
const char **  v 
)

Definition at line 760 of file coll.c.

void xmmsc_coll_attribute_list_first ( xmmsc_coll_t coll  ) 

Definition at line 744 of file coll.c.

void xmmsc_coll_attribute_list_next ( xmmsc_coll_t coll  ) 

Definition at line 771 of file coll.c.

int xmmsc_coll_attribute_list_valid ( xmmsc_coll_t coll  ) 

Definition at line 752 of file coll.c.

int xmmsc_coll_attribute_remove ( xmmsc_coll_t coll,
const char *  key 
)

Remove an attribute from the given collection.

The return value indicated whether the attribute was found (and removed)

Parameters:
coll The collection to remove the attribute from.
key The name of the attribute to remove.
Returns:
1 upon success, 0 otherwise

Definition at line 654 of file coll.c.

void xmmsc_coll_attribute_set ( xmmsc_coll_t coll,
const char *  key,
const char *  value 
)

Set an attribute in the given collection.

Parameters:
coll The collection in which to set the attribute.
key The name of the attribute to set.
value The value of the attribute.

Definition at line 621 of file coll.c.

Referenced by xmms_collection_set_int_attr(), xmms_ipc_msg_get_collection_alloc(), and xmmsc_coll_universe().

uint32_t* xmmsc_coll_get_idlist ( xmmsc_coll_t coll  ) 

Return the list of ids stored in the collection.

The list is owned by the collection. Note that this must not be confused with the content of the collection, which must be queried using xmmsc_coll_query_ids!

Parameters:
coll The collection to consider.
Returns:
The 0-terminated list of ids.

Definition at line 462 of file coll.c.

Referenced by xmms_ipc_msg_put_collection(), xmms_playlist_add_idlist(), and xmms_playlist_current_entry().

xmmsc_coll_type_t xmmsc_coll_get_type ( xmmsc_coll_t coll  ) 

Return the type of the collection.

Parameters:
coll The collection to consider.
Returns:
The xmmsc_coll_type_t of the collection, or -1 if invalid.

Definition at line 445 of file coll.c.

Referenced by bind_all_references(), and xmms_ipc_msg_put_collection().

int xmmsc_coll_idlist_append ( xmmsc_coll_t coll,
unsigned int  id 
)

Append a value to the idlist.

Parameters:
coll The collection to update.  
id The id to append to the idlist.
Returns:
TRUE on success, false otherwise.

Definition at line 256 of file coll.c.

Referenced by xmms_playlist_add_entry_unlocked().

int xmmsc_coll_idlist_clear ( xmmsc_coll_t coll  ) 

Empties the idlist.

Parameters:
coll The collection to update.
Returns:
TRUE on success, false otherwise.

Definition at line 371 of file coll.c.

int xmmsc_coll_idlist_get_index ( xmmsc_coll_t coll,
unsigned int  index,
uint32_t *  val 
)

Retrieves the value at the given position in the idlist.

Parameters:
coll The collection to update.
index The position of the value to retrieve.
val The pointer at which to store the found value.
Returns:
TRUE on success, false otherwise.

Definition at line 390 of file coll.c.

size_t xmmsc_coll_idlist_get_size ( xmmsc_coll_t coll  ) 

Get the size of the idlist.

Parameters:
coll The collection to update.
Returns:
The size of the idlist.

Definition at line 430 of file coll.c.

int xmmsc_coll_idlist_insert ( xmmsc_coll_t coll,
unsigned int  index,
unsigned int  id 
)

Insert a value at a given position in the idlist.

Parameters:
coll The collection to update.  
id The id to insert in the idlist.  
index The position at which to insert the value.
Returns:
TRUE on success, false otherwise.

Definition at line 271 of file coll.c.

Referenced by xmmsc_coll_idlist_append().

int xmmsc_coll_idlist_move ( xmmsc_coll_t coll,
unsigned int  index,
unsigned int  newindex 
)

Move a value of the idlist to a new position.

Parameters:
coll The collection to update.
index The index of the value to move.
newindex The newindex to which to move the value.
Returns:
TRUE on success, false otherwise.

Definition at line 306 of file coll.c.

int xmmsc_coll_idlist_remove ( xmmsc_coll_t coll,
unsigned int  index 
)

Remove the value at a given index from the idlist.

Parameters:
coll The collection to update.
index The index at which to remove the value.
Returns:
TRUE on success, false otherwise.

Definition at line 340 of file coll.c.

int xmmsc_coll_idlist_set_index ( xmmsc_coll_t coll,
unsigned int  index,
uint32_t  val 
)

Sets the value at the given position in the idlist.

Parameters:
coll The collection to update.
index The position of the value to set.
val The new value.
Returns:
TRUE on success, false otherwise.

Definition at line 411 of file coll.c.

xmmsc_coll_t* xmmsc_coll_new ( xmmsc_coll_type_t  type  ) 

Allocate a new collection of the given type.

The pointer will have to be deallocated using xmmsc_coll_unref.

Parameters:
type the xmmsc_coll_type_t specifying the type of collection to create.
Returns:
a pointer to the newly created collection.

Definition at line 91 of file coll.c.

Referenced by xmms_ipc_msg_get_collection_alloc(), and xmmsc_coll_universe().

void xmmsc_coll_operand_list_clear ( xmmsc_coll_t coll  ) 

Remove all the operands.

Parameters:
coll The collection to consider.

Definition at line 595 of file coll.c.

int xmmsc_coll_operand_list_entry ( xmmsc_coll_t coll,
xmmsc_coll_t **  operand 
)

Provide a reference to the current operand in the list by changing the operand parameter to point to it.

Note that the refcount of the operand is not modified by this operation. The function returns 1 if the entry was valid, 0 otherwise.

Parameters:
coll The collection to consider.
operand The current operand in the list.
Returns:
1 upon success (valid entry), 0 otherwise.

Definition at line 511 of file coll.c.

Referenced by xmms_ipc_msg_put_collection().

int xmmsc_coll_operand_list_first ( xmmsc_coll_t coll  ) 

Move the internal pointer of the operand list to the first operand.

Parameters:
coll The collection to consider.
Returns:
1 upon success, 0 otherwise.

Definition at line 477 of file coll.c.

Referenced by xmms_ipc_msg_put_collection().

int xmmsc_coll_operand_list_next ( xmmsc_coll_t coll  ) 

Move forward the internal pointer of the operand list.

Parameters:
coll The collection to consider.
Returns:
1 upon success, 0 otherwise.

Definition at line 530 of file coll.c.

Referenced by xmms_ipc_msg_put_collection().

int xmmsc_coll_operand_list_restore ( xmmsc_coll_t coll  ) 

Restore the position of the operand iterator, previously saved by calling xmmsc_coll_operand_list_save.

Note that the iterator is not tested for consistency, so you better be careful if the list of operands was manipulated since the iterator was saved!

Parameters:
coll The collection to consider.
Returns:
1 upon success, 0 otherwise.

Definition at line 576 of file coll.c.

Referenced by xmms_ipc_msg_put_collection().

int xmmsc_coll_operand_list_save ( xmmsc_coll_t coll  ) 

Save the position of the operand iterator, to be restored later by calling xmmsc_coll_operand_list_restore.

The pointer is saved on a stack, so it can be called any number of times, as long as it is restored as many times. Note that the iterator is not tested for consistency before being saved!

Parameters:
coll The collection to consider.
Returns:
1 upon success, 0 otherwise.

Definition at line 555 of file coll.c.

Referenced by xmms_ipc_msg_put_collection().

int xmmsc_coll_operand_list_valid ( xmmsc_coll_t coll  ) 

Checks if the internal pointer points to a valid operand of the list.

Parameters:
coll The collection to consider.
Returns:
1 if the current operand is valid, 0 otherwise.

Definition at line 493 of file coll.c.

xmmsc_coll_t* xmmsc_coll_ref ( xmmsc_coll_t coll  ) 

Increases the references for the xmmsc_coll_t.

Parameters:
coll the collection to reference.
Returns:
coll

Definition at line 74 of file coll.c.

Referenced by xmms_collection_dag_restore(), xmms_collection_get(), xmms_collection_rename(), xmms_collection_save(), xmms_collection_update_pointer(), xmmsc_coll_add_operand(), and xmmsc_coll_new().

void xmmsc_coll_remove_operand ( xmmsc_coll_t coll,
xmmsc_coll_t op 
)

Remove all the occurences of the operand in the given collection.

Parameters:
coll The collection to remove the operand from.
op The operand to remove.

Definition at line 230 of file coll.c.

void xmmsc_coll_set_idlist ( xmmsc_coll_t coll,
unsigned int  ids[] 
)

Set the list of ids in the given collection.

The list must be 0-terminated. Note that the idlist is only relevant for idlist collections.

Parameters:
coll the collection to modify.
ids the 0-terminated list of ids to store in the collection.

Definition at line 176 of file coll.c.

Referenced by xmms_ipc_msg_get_collection_alloc(), and xmmsc_coll_idlist_clear().

xmmsc_coll_t* xmmsc_coll_universe ( void   ) 

Return a collection referencing the whole media library, that is a reference to the "All Media" collection.

The returned structure must be unref'd using xmmsc_coll_unref after usage.

Returns:
a collection referring to the "All Media" collection.

Definition at line 791 of file coll.c.

void xmmsc_coll_unref ( xmmsc_coll_t coll  ) 

Decreases the references for the xmmsc_coll_t When the number of references reaches 0 it will be freed and all its operands unreferenced as well.

Parameters:
coll the collection to unref.

Definition at line 155 of file coll.c.

Referenced by xmms_ipc_msg_get_collection_alloc(), xmmsc_coll_operand_list_clear(), and xmmsc_coll_remove_operand().


Generated on Wed Dec 10 18:06:45 2008 for XMMS2 by  doxygen 1.5.6