MPD: SimpleDatabase Class Reference

MPD 0.20.15

Public Member Functions | Static Public Member Functions
SimpleDatabase Class Reference

`#include <SimpleDatabasePlugin.hxx>`

Inheritance diagram for SimpleDatabase:
[legend]
Collaboration diagram for SimpleDatabase:
[legend]

## Public Member Functions
gcc_pure Directory & | GetRoot () noexcept
void | Save ()
bool | FileExists () const
| Returns true if there is a valid database file on the disk. More...
gcc_nonnull_all void | Mount (const char *uri, Database *db)
gcc_nonnull_all void | Mount (const char *local_uri, const char *storage_uri)
| Throws #std::runtime_error on error. More...
gcc_nonnull_all bool | Unmount (const char *uri)
void | Open () override
| Open the database. More...
void | Close () override
| Close the database, free allocated memory. More...
const LightSong * | GetSong (const char *uri_utf8) const override
| Look up a song (including tag data) in the database. More...
void | ReturnSong (const LightSong *song) const override
| Mark the song object as "unused". More...
void | Visit (const DatabaseSelection &selection, VisitDirectory visit_directory, VisitSong visit_song, VisitPlaylist visit_playlist) const override
| Visit the selected entities. More...
void | VisitUniqueTags (const DatabaseSelection &selection, TagType tag_type, tag_mask_t group_mask, VisitTag visit_tag) const override
| Visit all unique tag values. More...
DatabaseStats | GetStats (const DatabaseSelection &selection) const override
time_t | GetUpdateStamp () const noexcept override
| Returns the time stamp of the last database update. More...
Public Member Functions inherited from Database
| Database (const DatabasePlugin &_plugin)
virtual | ~Database ()
| Free instance data. More...
const DatabasePlugin & | GetPlugin () const
bool | IsPlugin (const DatabasePlugin &other) const
void | Visit (const DatabaseSelection &selection, VisitDirectory visit_directory, VisitSong visit_song) const
void | Visit (const DatabaseSelection &selection, VisitSong visit_song) const
virtual unsigned | Update (gcc_unused const char *uri_utf8, gcc_unused bool discard)
| Update the database. More...

## Static Public Member Functions
static Database * | Create (EventLoop &loop, DatabaseListener &listener, const ConfigBlock &block)

## Detailed Description

Definition at line 38 of file SimpleDatabasePlugin.hxx.

## Member Function Documentation

## ◆ Close()

void SimpleDatabase::Close | ( |  | ) |
| overridevirtual

Close the database, free allocated memory.

Reimplemented from Database.

## ◆ Create()

static Database* SimpleDatabase::Create | ( | EventLoop & | loop,
|  | DatabaseListener & | listener,
|  | const ConfigBlock & | block
| ) |  |
| static

## ◆ FileExists()

bool SimpleDatabase::FileExists | ( |  | ) | const
| inline

Returns true if there is a valid database file on the disk.

Definition at line 90 of file SimpleDatabasePlugin.hxx.

## ◆ GetRoot()

gcc_pure Directory& SimpleDatabase::GetRoot | ( |  | ) |
| inlinenoexcept

Definition at line 79 of file SimpleDatabasePlugin.hxx.

## ◆ GetSong()

const LightSong* SimpleDatabase::GetSong | ( | const char * | uri_utf8 | ) | const
| overridevirtual

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)

Implements Database.

## ◆ GetStats()

DatabaseStats SimpleDatabase::GetStats | ( | const DatabaseSelection & | selection | ) | const
| overridevirtual

Implements Database.

## ◆ GetUpdateStamp()

time_t SimpleDatabase::GetUpdateStamp | ( |  | ) | const
| inlineoverridevirtualnoexcept

Returns the time stamp of the last database update.

Returns 0 if that is not not known/available.

Implements Database.

Definition at line 128 of file SimpleDatabasePlugin.hxx.

## ◆ Mount() [1/2]

gcc_nonnull_all void SimpleDatabase::Mount | ( | const char * | uri,
|  | Database * | db
| ) |  |

Parameters

  db | the Database to be mounted; must be "open"; on success, this object gains ownership of the given Database

## ◆ Mount() [2/2]

gcc_nonnull_all void SimpleDatabase::Mount | ( | const char * | local_uri,
|  | const char * | storage_uri
| ) |  |

Throws #std::runtime_error on error.

## ◆ Open()

void SimpleDatabase::Open | ( |  | ) |
| overridevirtual

Open the database.

Read it into memory if applicable.

Throws DatabaseError or std::runtime_error on error.

Reimplemented from Database.

## ◆ ReturnSong()

void SimpleDatabase::ReturnSong | ( | const LightSong * | song | ) | const
| overridevirtual

Mark the song object as "unused".

Call this on objects returned by GetSong().

Implements Database.

## ◆ Save()

void SimpleDatabase::Save | ( |  | ) |

## ◆ Unmount()

gcc_nonnull_all bool SimpleDatabase::Unmount | ( | const char * | uri | ) |

## ◆ Visit()

void SimpleDatabase::Visit | ( | const DatabaseSelection & | selection,
|  | VisitDirectory | visit_directory,
|  | VisitSong | visit_song,
|  | VisitPlaylist | visit_playlist
| ) |  | const
| overridevirtual

Visit the selected entities.

Implements Database.

## ◆ VisitUniqueTags()

void SimpleDatabase::VisitUniqueTags | ( | const DatabaseSelection & | selection,
|  | TagType | tag_type,
|  | tag_mask_t | group_mask,
|  | VisitTag | visit_tag
| ) |  | const
| overridevirtual

Visit all unique tag values.

Implements Database.

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

- db/plugins/simple/SimpleDatabasePlugin.hxx