MPD  0.20.18
Functions
StickerDatabase.hxx File Reference
#include "Match.hxx"
#include "Compiler.h"
#include <string>
Include dependency graph for StickerDatabase.hxx:

Go to the source code of this file.

Functions

void sticker_global_init (Path path)
 Opens the sticker database. More...
 
void sticker_global_finish ()
 Close the sticker database. More...
 
gcc_const bool sticker_enabled () noexcept
 Returns true if the sticker database is configured and available. More...
 
std::string sticker_load_value (const char *type, const char *uri, const char *name)
 Returns one value from an object's sticker record. More...
 
void sticker_store_value (const char *type, const char *uri, const char *name, const char *value)
 Sets a sticker value in the specified object. More...
 
bool sticker_delete (const char *type, const char *uri)
 Deletes a sticker from the database. More...
 
bool sticker_delete_value (const char *type, const char *uri, const char *name)
 Deletes a sticker value. More...
 
void sticker_free (Sticker *sticker)
 Frees resources held by the sticker object. More...
 
gcc_pure const char * sticker_get_value (const Sticker &sticker, const char *name) noexcept
 Determines a single value in a sticker. More...
 
void sticker_foreach (const Sticker &sticker, void(*func)(const char *name, const char *value, void *user_data), void *user_data)
 Iterates over all sticker items in a sticker. More...
 
Sticker * sticker_load (const char *type, const char *uri)
 Loads the sticker for the specified resource. More...
 
void sticker_find (const char *type, const char *base_uri, const char *name, StickerOperator op, const char *value, void(*func)(const char *uri, const char *value, void *user_data), void *user_data)
 Finds stickers with the specified name below the specified URI. More...
 

Function Documentation

bool sticker_delete ( const char *  type,
const char *  uri 
)

Deletes a sticker from the database.

All sticker values of the specified object are deleted.

Throws SqliteError on error.

bool sticker_delete_value ( const char *  type,
const char *  uri,
const char *  name 
)

Deletes a sticker value.

Fails if no sticker with this name exists.

Throws SqliteError on error.

gcc_const bool sticker_enabled ( )
noexcept

Returns true if the sticker database is configured and available.

void sticker_find ( const char *  type,
const char *  base_uri,
const char *  name,
StickerOperator  op,
const char *  value,
void(*)(const char *uri, const char *value, void *user_data)  func,
void *  user_data 
)

Finds stickers with the specified name below the specified URI.

Parameters
typethe resource type, e.g. "song"
base_urithe URI prefix of the resources, or nullptr if all resources should be searched
namethe name of the sticker
opthe comparison operator
valuethe operand
void sticker_foreach ( const Sticker &  sticker,
void(*)(const char *name, const char *value, void *user_data)  func,
void *  user_data 
)

Iterates over all sticker items in a sticker.

Parameters
stickerthe sticker object
funca callback function
user_dataan opaque pointer for the callback function
void sticker_free ( Sticker *  sticker)

Frees resources held by the sticker object.

Parameters
stickerthe sticker object to be freed
gcc_pure const char* sticker_get_value ( const Sticker &  sticker,
const char *  name 
)
noexcept

Determines a single value in a sticker.

Parameters
stickerthe sticker object
namethe name of the sticker
Returns
the sticker value, or nullptr if none was found
void sticker_global_finish ( )

Close the sticker database.

void sticker_global_init ( Path  path)

Opens the sticker database.

Throws std::runtime_error on error.

Sticker* sticker_load ( const char *  type,
const char *  uri 
)

Loads the sticker for the specified resource.

Throws SqliteError on error.

Parameters
typethe resource type, e.g. "song"
urithe URI of the resource, e.g. the song path
Returns
a sticker object, or nullptr if there is no sticker
std::string sticker_load_value ( const char *  type,
const char *  uri,
const char *  name 
)

Returns one value from an object's sticker record.

Returns an empty string if the value doesn't exist.

Throws SqliteError on error.

void sticker_store_value ( const char *  type,
const char *  uri,
const char *  name,
const char *  value 
)

Sets a sticker value in the specified object.

Overwrites existing values.

Throws SqliteError on error.