MPD

- Main Page
- Data Structures
- Files

- File List
- Globals

Functions

# src/sticker.h File Reference

`#include <glib.h>`
`#include <stdbool.h>`

Go to the source code of this file.

## Functions
bool | sticker_global_init (const char *path, GError **error_r)
| Opens the sticker database (if path is not NULL).
void | sticker_global_finish (void)
| Close the sticker database.
bool | sticker_enabled (void)
| Returns true if the sticker database is configured and available.
char * | sticker_load_value (const char *type, const char *uri, const char *name)
| Returns one value from an object's sticker record.
bool | sticker_store_value (const char *type, const char *uri, const char *name, const char *value)
| Sets a sticker value in the specified object.
bool | sticker_delete (const char *type, const char *uri)
| Deletes a sticker from the database.
bool | sticker_delete_value (const char *type, const char *uri, const char *name)
| Deletes a sticker value.
void | sticker_free (struct sticker *sticker)
| Frees resources held by the sticker object.
const char * | sticker_get_value (const struct sticker *sticker, const char *name)
| Determines a single value in a sticker.
void | sticker_foreach (const struct sticker *sticker, void(*func)(const char *name, const char *value, gpointer user_data), gpointer user_data)
| Iterates over all sticker items in a sticker.
struct sticker * | sticker_load (const char *type, const char *uri)
| Loads the sticker for the specified resource.
bool | sticker_find (const char *type, const char *base_uri, const char *name, void(*func)(const char *uri, const char *value, gpointer user_data), gpointer user_data)
| Finds stickers with the specified name below the specified URI.

## 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.

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.

bool sticker_enabled | ( | void |  | ) |

Returns true if the sticker database is configured and available.

bool sticker_find | ( | const char * | type,
|  | const char * | base_uri,
|  | const char * | name,
|  | void(*)(const char *uri, const char *value, gpointer user_data) | func,
|  | gpointer | 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 NULL if all resources should be searched
  name | the name of the sticker

Returns:
  true on success (even if no sticker was found), false on failure

void sticker_foreach | ( | const struct sticker * | sticker,
|  | void(*)(const char *name, const char *value, gpointer user_data) | func,
|  | gpointer | 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

void sticker_free | ( | struct sticker * | sticker | ) |

Frees resources held by the sticker object.

Parameters:

  sticker | the sticker object to be freed

const char* sticker_get_value | ( | const struct sticker * | sticker,
|  | const char * | name
| ) |  |

Determines a single value in a sticker.

Parameters:

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

Returns:
  the sticker value, or NULL if none was found

void sticker_global_finish | ( | void |  | ) |

Close the sticker database.

bool sticker_global_init | ( | const char * | path,
|  | GError ** | error_r
| ) |  |

Opens the sticker database (if path is not NULL).

Parameters:

  error_r | location to store the error occuring, or NULL to ignore errors

Returns:
  true on success, false on error

struct sticker* sticker_load | ( | const char * | type,
|  | const char * | uri
| ) |  | `[read]`

Loads the sticker for the specified resource.

Parameters:

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

Returns:
  a sticker object, or NULL on error or if there is no sticker

char* sticker_load_value | ( | const char * | type,
|  | const char * | uri,
|  | const char * | name
| ) |  |

Returns one value from an object's sticker record.

The caller must free the return value with g_free().

bool 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.