libmpdclient: mpd/entity.h File Reference

libmpdclient 2.9

- Main Page
- Classes
- Files

- File List
- File Members

Enumerations | Functions
entity.h File Reference

MPD client library. More...

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)
mpd_pure enum mpd_entity_type | mpd_entity_get_type (const struct mpd_entity *entity)
mpd_pure const struct mpd_directory * | mpd_entity_get_directory (const struct mpd_entity *entity)
mpd_pure const struct mpd_song * | mpd_entity_get_song (const struct mpd_entity *entity)
mpd_pure const struct mpd_playlist * | mpd_entity_get_playlist (const struct mpd_entity *entity)
mpd_malloc struct mpd_entity * | mpd_entity_begin (const struct mpd_pair *pair)
bool | mpd_entity_feed (struct mpd_entity *entity, const struct mpd_pair *pair)
mpd_malloc struct mpd_entity * | mpd_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

enum 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 52 of file entity.h.

## Function Documentation

void mpd_entity_free | ( | struct mpd_entity * | entity | ) |

Releases an entity. This also frees the wrapped object.

mpd_pure enum mpd_entity_type mpd_entity_get_type | ( | const struct mpd_entity * | entity | ) |

Returns
  the type of this entity.

mpd_pure 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 of mpd_entity_get_type() has returned MPD_ENTITY_TYPE_DIRECTORY.

Returns
  the directory object

mpd_pure 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 of mpd_entity_get_type() has returned MPD_ENTITY_TYPE_SONG.

Returns
  the song object

mpd_pure 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 of mpd_entity_get_type() has returned MPD_ENTITY_TYPE_PLAYLIST.

Returns
  the directory object

mpd_malloc struct mpd_entity* mpd_entity_begin | ( | const struct mpd_pair * | pair | ) |

Begins parsing a new entity.

Parameters

  pair | the first pair in this entity

Returns
  the new mpd_entity object, or NULL on error (out of memory)

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_malloc 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