libmpdclient 2.22
Enumerations | Functions
entity.h File Reference

MPD client library. More...

#include "song.h"
#include "directory.h"
#include "compiler.h"
Include dependency graph for entity.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  mpd_entity_type { MPD_ENTITY_TYPE_UNKNOWN , MPD_ENTITY_TYPE_DIRECTORY , MPD_ENTITY_TYPE_SONG , MPD_ENTITY_TYPE_PLAYLIST }
 

Functions

void mpd_entity_free (struct mpd_entity *entity)
 
enum mpd_entity_type mpd_entity_get_type (const struct mpd_entity *entity)
 
const struct mpd_directorympd_entity_get_directory (const struct mpd_entity *entity)
 
const struct mpd_songmpd_entity_get_song (const struct mpd_entity *entity)
 
const struct mpd_playlistmpd_entity_get_playlist (const struct mpd_entity *entity)
 
struct mpd_entitympd_entity_begin (const struct mpd_pair *pair)
 
bool mpd_entity_feed (struct mpd_entity *entity, const struct mpd_pair *pair)
 
struct mpd_entitympd_recv_entity (struct mpd_connection *connection)
 

Detailed Description

MPD client library.

Do not include this header directly. Use mpd/client.h instead.

Definition in file entity.h.

Enumeration Type Documentation

◆ mpd_entity_type

The type of a mpd_entity object.

Enumerator
MPD_ENTITY_TYPE_UNKNOWN 

The type of the entity received from MPD is not implemented in this version of libmpdclient.

MPD_ENTITY_TYPE_DIRECTORY 

A directory (mpd_directory) containing more entities.

MPD_ENTITY_TYPE_SONG 

A song file (mpd_song) which can be added to the playlist.

MPD_ENTITY_TYPE_PLAYLIST 

A stored playlist (mpd_playlist).

Definition at line 51 of file entity.h.

Function Documentation

◆ mpd_entity_free()

void mpd_entity_free ( struct mpd_entity entity)

Releases an entity. This also frees the wrapped object.

◆ mpd_entity_get_type()

enum mpd_entity_type mpd_entity_get_type ( const struct mpd_entity entity)
Returns
the type of this entity.

◆ mpd_entity_get_directory()

const struct mpd_directory * mpd_entity_get_directory ( const struct mpd_entity entity)

Obtains a pointer to the mpd_directory object enclosed by this mpd_entity. Calling this function is only allowed if mpd_entity_get_type() has returned MPD_ENTITY_TYPE_DIRECTORY.

Returns
the directory object

◆ mpd_entity_get_song()

const struct mpd_song * mpd_entity_get_song ( const struct mpd_entity entity)

Obtains a pointer to the mpd_song object enclosed by this mpd_entity. Calling this function is only allowed if mpd_entity_get_type() has returned MPD_ENTITY_TYPE_SONG.

Returns
the song object

◆ mpd_entity_get_playlist()

const struct mpd_playlist * mpd_entity_get_playlist ( const struct mpd_entity entity)

Obtains a pointer to the mpd_playlist object enclosed by this mpd_entity. Calling this function is only allowed if mpd_entity_get_type() has returned MPD_ENTITY_TYPE_PLAYLIST.

Returns
the playlist object

◆ mpd_entity_begin()

struct mpd_entity * mpd_entity_begin ( const struct mpd_pair pair)

Begins parsing a new entity.

Parameters
pairthe first pair in this entity
Returns
the new mpd_entity object, or NULL on error (out of memory)

◆ mpd_entity_feed()

bool mpd_entity_feed ( struct mpd_entity entity,
const struct mpd_pair pair 
)

Parses the pair, adding its information to the specified mpd_entity object.

Returns
true if the pair was parsed and added to the entity (or if the pair was not understood and ignored), false if this pair is the beginning of the next entity

◆ mpd_recv_entity()

struct mpd_entity * mpd_recv_entity ( struct mpd_connection connection)

Receives the next entity from the MPD server.

Returns
an entity object, or NULL on error or if the entity list is finished