MPD: Database Class Reference

MPD 0.20.15

Public Member Functions
Database Class Referenceabstract

`#include <Interface.hxx>`

Inheritance diagram for Database:
[legend]

## Public Member Functions
| Database (const DatabasePlugin &_plugin)
virtual | ~Database ()
| Free instance data. More...
const DatabasePlugin & | GetPlugin () const
bool | IsPlugin (const DatabasePlugin &other) const
virtual void | Open ()
| Open the database. More...
virtual void | Close ()
| Close the database, free allocated memory. More...
virtual const LightSong * | GetSong (const char *uri_utf8) const =0
| Look up a song (including tag data) in the database. More...
virtual void | ReturnSong (const LightSong *song) const =0
| Mark the song object as "unused". More...
virtual void | Visit (const DatabaseSelection &selection, VisitDirectory visit_directory, VisitSong visit_song, VisitPlaylist visit_playlist) const =0
| Visit the selected entities. More...
void | Visit (const DatabaseSelection &selection, VisitDirectory visit_directory, VisitSong visit_song) const
void | Visit (const DatabaseSelection &selection, VisitSong visit_song) const
virtual void | VisitUniqueTags (const DatabaseSelection &selection, TagType tag_type, tag_mask_t group_mask, VisitTag visit_tag) const =0
| Visit all unique tag values. More...
virtual DatabaseStats | GetStats (const DatabaseSelection &selection) const =0
virtual unsigned | Update (gcc_unused const char *uri_utf8, gcc_unused bool discard)
| Update the database. More...
virtual gcc_pure time_t | GetUpdateStamp () const noexcept=0
| Returns the time stamp of the last database update. More...

## Detailed Description

Definition at line 35 of file Interface.hxx.

## Constructor & Destructor Documentation

## ◆ Database()

Database::Database | ( | const DatabasePlugin & | _plugin | ) |
| inline

Definition at line 39 of file Interface.hxx.

## ◆ ~Database()

virtual Database::~Database | ( |  | ) |
| inlinevirtual

Free instance data.

Definition at line 45 of file Interface.hxx.

## Member Function Documentation

## ◆ Close()

virtual void Database::Close | ( |  | ) |
| inlinevirtual

Close the database, free allocated memory.

Reimplemented in SimpleDatabase.

Definition at line 66 of file Interface.hxx.

## ◆ GetPlugin()

const DatabasePlugin& Database::GetPlugin | ( |  | ) | const
| inline

Definition at line 47 of file Interface.hxx.

## ◆ GetSong()

virtual const LightSong* Database::GetSong | ( | const char * | uri_utf8 | ) | const
| pure virtual

Look up a song (including tag data) in the database.

When you don't need this anymore, call ReturnSong().

Parameters

  uri_utf8 | the URI of the song within the music directory (UTF-8)

Implemented in SimpleDatabase.

## ◆ GetStats()

virtual DatabaseStats Database::GetStats | ( | const DatabaseSelection & | selection | ) | const
| pure virtual

Implemented in SimpleDatabase.

## ◆ GetUpdateStamp()

virtual gcc_pure time_t Database::GetUpdateStamp | ( |  | ) | const
| pure virtualnoexcept

Returns the time stamp of the last database update.

Returns 0 if that is not not known/available.

Implemented in SimpleDatabase.

## ◆ IsPlugin()

bool Database::IsPlugin | ( | const DatabasePlugin & | other | ) | const
| inline

Definition at line 51 of file Interface.hxx.

## ◆ Open()

virtual void Database::Open | ( |  | ) |
| inlinevirtual

Open the database.

Read it into memory if applicable.

Throws DatabaseError or std::runtime_error on error.

Reimplemented in SimpleDatabase.

Definition at line 60 of file Interface.hxx.

## ◆ ReturnSong()

virtual void Database::ReturnSong | ( | const LightSong * | song | ) | const
| pure virtual

Mark the song object as "unused".

Call this on objects returned by GetSong().

Implemented in SimpleDatabase.

## ◆ Update()

virtual unsigned Database::Update | ( | gcc_unused const char * | uri_utf8,
|  | gcc_unused bool | discard
| ) |  |
| inlinevirtual

Update the database.

Throws #std::runtime_error on error.

Returns
  the job id or 0 if not implemented

Definition at line 118 of file Interface.hxx.

## ◆ Visit() [1/3]

virtual void Database::Visit | ( | const DatabaseSelection & | selection,
|  | VisitDirectory | visit_directory,
|  | VisitSong | visit_song,
|  | VisitPlaylist | visit_playlist
| ) |  | const
| pure virtual

Visit the selected entities.

Implemented in SimpleDatabase.

## ◆ Visit() [2/3]

void Database::Visit | ( | const DatabaseSelection & | selection,
|  | VisitDirectory | visit_directory,
|  | VisitSong | visit_song
| ) |  | const
| inline

Definition at line 91 of file Interface.hxx.

## ◆ Visit() [3/3]

void Database::Visit | ( | const DatabaseSelection & | selection,
|  | VisitSong | visit_song
| ) |  | const
| inline

Definition at line 97 of file Interface.hxx.

## ◆ VisitUniqueTags()

virtual void Database::VisitUniqueTags | ( | const DatabaseSelection & | selection,
|  | TagType | tag_type,
|  | tag_mask_t | group_mask,
|  | VisitTag | visit_tag
| ) |  | const
| pure virtual

Visit all unique tag values.

Implemented in SimpleDatabase.

The documentation for this class was generated from the following file:

- db/Interface.hxx