MPD: sticker/StickerDatabase.hxx File Reference

MPD 0.20.15

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

## ◆ sticker_delete()

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.

## ◆ sticker_delete_value()

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.

## ◆ sticker_enabled()

gcc_const bool sticker_enabled | ( |  | ) |
| noexcept

Returns true if the sticker database is configured and available.

## ◆ sticker_find()

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

  type | the resource type, e.g. "song"
  base_uri | the URI prefix of the resources, or nullptr if all resources should be searched
  name | the name of the sticker
  op | the comparison operator
  value | the operand

## ◆ sticker_foreach()

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

  sticker | the sticker object
  func | a callback function
  user_data | an opaque pointer for the callback function

## ◆ sticker_free()

void sticker_free | ( | Sticker * | sticker | ) |

Frees resources held by the sticker object.

Parameters

  sticker | the sticker object to be freed

## ◆ sticker_get_value()

gcc_pure const char* sticker_get_value | ( | const Sticker & | sticker,
|  | const char * | name
| ) |  |
| noexcept

Determines a single value in a sticker.

Parameters

  sticker | the sticker object
  name | the name of the sticker

Returns
  the sticker value, or nullptr if none was found

## ◆ sticker_global_finish()

void sticker_global_finish | ( |  | ) |

Close the sticker database.

## ◆ sticker_global_init()

void sticker_global_init | ( | Path | path | ) |

Opens the sticker database.

Throws std::runtime_error on error.

## ◆ sticker_load()

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

Loads the sticker for the specified resource.

Throws SqliteError on error.

Parameters

  type | the resource type, e.g. "song"
  uri | the URI of the resource, e.g. the song path

Returns
  a sticker object, or nullptr if there is no sticker

## ◆ sticker_load_value()

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.

## ◆ sticker_store_value()

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.