Data Object


Data Structures

struct  _MpdData

Typedefs

typedef struct _MpdData MpdData

Enumerations

enum  MpdDataType {
  MPD_DATA_TYPE_NONE, MPD_DATA_TYPE_TAG, MPD_DATA_TYPE_DIRECTORY, MPD_DATA_TYPE_SONG,
  MPD_DATA_TYPE_PLAYLIST, MPD_DATA_TYPE_OUTPUT_DEV
}

Functions

int mpd_data_is_last (MpdData const *data)
void mpd_data_free (MpdData *data)
MpdDatampd_data_get_next (MpdData *data)
MpdDatampd_data_get_first (MpdData const *data)
MpdDatampd_data_delete_item (MpdData *data)

Detailed Description

This is a fast linked list implementation where data returned from mpd is stored in.

Typedef Documentation

typedef struct _MpdData MpdData


Enumeration Type Documentation

enumeration to determine what value the MpdData structure hold. The MpdData structure can hold only one type of value, but a list of MpdData structs can hold structs with different type of values. It's required to check every MpdData Structure.

Enumerator:
MPD_DATA_TYPE_NONE  The MpdData structure holds no value
MPD_DATA_TYPE_TAG  Holds an Tag String. value->tag is filled value->tag_type defines what type of tag.
MPD_DATA_TYPE_DIRECTORY  Holds an Directory String. value->directory is filled.
MPD_DATA_TYPE_SONG  Holds an MpdSong Structure. value->song is valid.
MPD_DATA_TYPE_PLAYLIST  Holds an Playlist String. value->playlist is filled.
MPD_DATA_TYPE_OUTPUT_DEV  Holds an MpdOutputDevice structure. value->output_dev is valid.

Definition at line 118 of file libmpd.h.


Function Documentation

MpdData* mpd_data_delete_item ( MpdData data  ) 

Parameters:
data a MpdData item
removes the passed MpdData from the underlying list, and returns the element before data

Returns:
a MpdData list

void mpd_data_free ( MpdData data  ) 

Parameters:
data a MpdData
Free's a MpdData List

MpdData* mpd_data_get_first ( MpdData const *  data  ) 

Parameters:
data a MpdData
Returns the first MpdData in the list.

Returns:
The first MpdData or NULL

MpdData* mpd_data_get_next ( MpdData data  ) 

Parameters:
data a MpdData
Returns the next MpdData in the list. If it's the last item in the list, it will free the list.

You can iterate through a list like this and have it freed afterwards.

        for(data = mpd_database_get_albums(mi);data != NULL; data = mpd_data_get_next(data))
        {
                // do your thing
        }
Returns:
The next MpdData or NULL
Examples:
testcase.c.

int mpd_data_is_last ( MpdData const *  data  ) 

Parameters:
data a MpdData
Checks if the passed MpdData is the last in a list
Returns:
TRUE when data is the last in the list.


Copyright 2006 Qball Cow