XplayerPlPlaylist

## XplayerPlPlaylist XplayerPlPlaylist — playlist object |

## Stability Level

Stable, unless otherwise indicated

## Functions

XplayerPlPlaylist * | xplayer_pl_playlist_new ()
guint | xplayer_pl_playlist_size ()
void | xplayer_pl_playlist_prepend ()
void | xplayer_pl_playlist_append ()
void | xplayer_pl_playlist_insert ()
gboolean | xplayer_pl_playlist_iter_first ()
gboolean | xplayer_pl_playlist_iter_next ()
gboolean | xplayer_pl_playlist_iter_prev ()
gboolean | xplayer_pl_playlist_get_value ()
void | xplayer_pl_playlist_get_valist ()
void | xplayer_pl_playlist_get ()
gboolean | xplayer_pl_playlist_set_value ()
void | xplayer_pl_playlist_set_valist ()
void | xplayer_pl_playlist_set ()

## Types and Values

| XplayerPlPlaylist
| XplayerPlPlaylistClass

## Object Hierarchy

        GObject
        ╰── XplayerPlPlaylist

## Includes

    #include <xplayer-pl-playlist.h>

## Description

XplayerPlPlaylist represents a playlist, provides API to either navigate through the playlist elements, or perform additions or modifications. See also `xplayer_pl_parser_save()`.

## Functions

### xplayer_pl_playlist_new ()

    XplayerPlPlaylist *
    xplayer_pl_playlist_new (void);

Creates a new XplayerPlPlaylist object.

#### Returns

The newly created XplayerPlPlaylist

### xplayer_pl_playlist_size ()

    guint
    xplayer_pl_playlist_size (XplayerPlPlaylist *playlist);

Returns the number of elements in `playlist` .

#### Parameters

playlist | a XplayerPlPlaylist |

#### Returns

The number of elements

### xplayer_pl_playlist_prepend ()

    void
    xplayer_pl_playlist_prepend (XplayerPlPlaylist *playlist,
                                 XplayerPlPlaylistIter *iter);

Prepends a new empty element to `playlist` , and modifies `iter` so it points to it. To fill in values, you need to call `xplayer_pl_playlist_set()` or `xplayer_pl_playlist_set_value()`.

#### Parameters

playlist | a XplayerPlPlaylist |
iter | an unset XplayerPlPlaylistIter for returning the location. | [out]

### xplayer_pl_playlist_append ()

    void
    xplayer_pl_playlist_append (XplayerPlPlaylist *playlist,
                                XplayerPlPlaylistIter *iter);

Appends a new empty element to `playlist` , and modifies `iter` so it points to it. To fill in values, you need to call `xplayer_pl_playlist_set()` or `xplayer_pl_playlist_set_value()`.

#### Parameters

playlist | a XplayerPlPlaylist |
iter | an unset XplayerPlPlaylistIter for returning the location. | [out]

### xplayer_pl_playlist_insert ()

    void
    xplayer_pl_playlist_insert (XplayerPlPlaylist *playlist,
                                gint position,
                                XplayerPlPlaylistIter *iter);

Inserts a new empty element to `playlist` at `position` , and modifies `iter` so it points to it. To fill in values, you need to call `xplayer_pl_playlist_set()` or `xplayer_pl_playlist_set_value()`.

`position` may be minor than 0 to prepend elements, or bigger than the current `playlist` size to append elements.

#### Parameters

playlist | a XplayerPlPlaylist |
position | position in the playlist |
iter | an unset XplayerPlPlaylistIter for returning the location. | [out]

### xplayer_pl_playlist_iter_first ()

    gboolean
    xplayer_pl_playlist_iter_first (XplayerPlPlaylist *playlist,
                                    XplayerPlPlaylistIter *iter);

Modifies `iter` so it points to the first element in `playlist` .

#### Parameters

playlist | a XplayerPlPlaylist |
iter | an unset XplayerPlPlaylistIter for returning the location. | [out]

#### Returns

`TRUE` if there is such first element.

### xplayer_pl_playlist_iter_next ()

    gboolean
    xplayer_pl_playlist_iter_next (XplayerPlPlaylist *playlist,
                                   XplayerPlPlaylistIter *iter);

Modifies `iter` so it points to the next element it previously pointed to. This function will return `FALSE` if there was no next element, or `iter` didn't actually point to any element in `playlist` .

#### Parameters

playlist | a XplayerPlPlaylist |
iter | a XplayerPlPlaylistIter pointing to some item in `playlist` . | [in]

#### Returns

`TRUE` if there was next element.

### xplayer_pl_playlist_iter_prev ()

    gboolean
    xplayer_pl_playlist_iter_prev (XplayerPlPlaylist *playlist,
                                   XplayerPlPlaylistIter *iter);

Modifies `iter` so it points to the previous element it previously pointed to. This function will return `FALSE` if there was no previous element, or `iter` didn't actually point to any element in `playlist` .

#### Parameters

playlist | a XplayerPlPlaylist |
iter | a XplayerPlPlaylistIter pointing to some item in `playlist` . | [in]

#### Returns

`TRUE` if there was previous element.

### xplayer_pl_playlist_get_value ()

    gboolean
    xplayer_pl_playlist_get_value (XplayerPlPlaylist *playlist,
                                   XplayerPlPlaylistIter *iter,
                                   const gchar *key,
                                   GValue *value);

Gets the value for `key` (Such as `XPLAYER_PL_PARSER_FIELD_URI`) in the playlist item pointed by `iter` .

#### Parameters

playlist | a XplayerPlPlaylist |
iter | a XplayerPlPlaylistIter pointing to some item in `playlist` |
key | data key |
value | an empty GValue to set |

#### Returns

`TRUE` if `iter` contains data for `key` .

### xplayer_pl_playlist_get_valist ()

    void
    xplayer_pl_playlist_get_valist (XplayerPlPlaylist *playlist,
                                    XplayerPlPlaylistIter *iter,
                                    va_list args);

See `xplayer_pl_playlist_get()`, this function takes a va_list.

#### Parameters

playlist | a XplayerPlPlaylist |
iter | a XplayerPlPlaylistIter pointing to some item in `playlist` |
args | a va_list |

### xplayer_pl_playlist_get ()

    void
    xplayer_pl_playlist_get (XplayerPlPlaylist *playlist,
                             XplayerPlPlaylistIter *iter,
                             ...);

Gets the value for one or more keys from the element pointed by `iter` .

#### Parameters

playlist | a XplayerPlPlaylist |
iter | a XplayerPlPlaylistIter pointing to some item in `playlist` |
... | pairs of key/return location for value, terminated by `NULL` |

### xplayer_pl_playlist_set_value ()

    gboolean
    xplayer_pl_playlist_set_value (XplayerPlPlaylist *playlist,
                                   XplayerPlPlaylistIter *iter,
                                   const gchar *key,
                                   GValue *value);

Sets the value for `key` in the element pointed by `iter` .

#### Parameters

playlist | a XplayerPlPlaylist |
iter | a XplayerPlPlaylistIter pointing to some item in `playlist` |
key | key to set the value for |
value | GValue containing the key value |

#### Returns

`TRUE` if the value could be stored in `playlist`

### xplayer_pl_playlist_set_valist ()

    void
    xplayer_pl_playlist_set_valist (XplayerPlPlaylist *playlist,
                                    XplayerPlPlaylistIter *iter,
                                    va_list args);

See `xplayer_pl_playlist_set()`, this function takes a va_list.

#### Parameters

playlist | a XplayerPlPlaylist |
iter | a XplayerPlPlaylistIter pointing to some item in `playlist` |
args | a va_list |

### xplayer_pl_playlist_set ()

    void
    xplayer_pl_playlist_set (XplayerPlPlaylist *playlist,
                             XplayerPlPlaylistIter *iter,
                             ...);

Sets the value for one or several keys in the element pointed by `iter` .

#### Parameters

playlist | a XplayerPlPlaylist |
iter | a XplayerPlPlaylistIter pointing to some item in `playlist` |
... | key/value string pairs, terminated with `NULL` |

## Types and Values

### XplayerPlPlaylist

    typedef struct _XplayerPlPlaylist XplayerPlPlaylist;

All the fields in the XplayerPlPlaylist structure are private and should never be accessed directly.

### XplayerPlPlaylistClass

    typedef struct {
            GObjectClass parent_class;
    } XplayerPlPlaylistClass;

All the fields in the XplayerPlPlaylistClass structure are private and should never be accessed directly.

#### Members

GObjectClass `parent_class`; | the parent class |