StickerDatabase: convert the struct name to upper case
This commit is contained in:
parent
822ac7b100
commit
593bb5a8a7
@ -88,7 +88,7 @@ handle_sticker_song(Client &client, ConstBuffer<const char *> args)
|
|||||||
if (song == nullptr)
|
if (song == nullptr)
|
||||||
return print_error(client, error);
|
return print_error(client, error);
|
||||||
|
|
||||||
sticker *sticker = sticker_song_get(*song, error);
|
Sticker *sticker = sticker_song_get(*song, error);
|
||||||
db->ReturnSong(song);
|
db->ReturnSong(song);
|
||||||
if (sticker) {
|
if (sticker) {
|
||||||
sticker_print(client, *sticker);
|
sticker_print(client, *sticker);
|
||||||
|
@ -60,7 +60,7 @@ sticker_song_delete_value(const LightSong &song, const char *name,
|
|||||||
return sticker_delete_value("song", uri.c_str(), name, error);
|
return sticker_delete_value("song", uri.c_str(), name, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct sticker *
|
Sticker *
|
||||||
sticker_song_get(const LightSong &song, Error &error)
|
sticker_song_get(const LightSong &song, Error &error)
|
||||||
{
|
{
|
||||||
const auto uri = song.GetURI();
|
const auto uri = song.GetURI();
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
struct LightSong;
|
struct LightSong;
|
||||||
struct sticker;
|
struct Sticker;
|
||||||
class Database;
|
class Database;
|
||||||
class Error;
|
class Error;
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ sticker_song_delete_value(const LightSong &song, const char *name,
|
|||||||
* @param song the song object
|
* @param song the song object
|
||||||
* @return a sticker object, or NULL on error or if there is no sticker
|
* @return a sticker object, or NULL on error or if there is no sticker
|
||||||
*/
|
*/
|
||||||
sticker *
|
Sticker *
|
||||||
sticker_song_get(const LightSong &song, Error &error);
|
sticker_song_get(const LightSong &song, Error &error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
struct sticker {
|
struct Sticker {
|
||||||
std::map<std::string, std::string> table;
|
std::map<std::string, std::string> table;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -340,13 +340,13 @@ sticker_delete_value(const char *type, const char *uri, const char *name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sticker_free(struct sticker *sticker)
|
sticker_free(Sticker *sticker)
|
||||||
{
|
{
|
||||||
delete sticker;
|
delete sticker;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
sticker_get_value(const struct sticker &sticker, const char *name)
|
sticker_get_value(const Sticker &sticker, const char *name)
|
||||||
{
|
{
|
||||||
auto i = sticker.table.find(name);
|
auto i = sticker.table.find(name);
|
||||||
if (i == sticker.table.end())
|
if (i == sticker.table.end())
|
||||||
@ -356,7 +356,7 @@ sticker_get_value(const struct sticker &sticker, const char *name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sticker_foreach(const sticker &sticker,
|
sticker_foreach(const Sticker &sticker,
|
||||||
void (*func)(const char *name, const char *value,
|
void (*func)(const char *name, const char *value,
|
||||||
void *user_data),
|
void *user_data),
|
||||||
void *user_data)
|
void *user_data)
|
||||||
@ -365,10 +365,10 @@ sticker_foreach(const sticker &sticker,
|
|||||||
func(i.first.c_str(), i.second.c_str(), user_data);
|
func(i.first.c_str(), i.second.c_str(), user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct sticker *
|
Sticker *
|
||||||
sticker_load(const char *type, const char *uri, Error &error)
|
sticker_load(const char *type, const char *uri, Error &error)
|
||||||
{
|
{
|
||||||
sticker s;
|
Sticker s;
|
||||||
|
|
||||||
if (!sticker_list_values(s.table, type, uri, error))
|
if (!sticker_list_values(s.table, type, uri, error))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -377,7 +377,7 @@ sticker_load(const char *type, const char *uri, Error &error)
|
|||||||
/* don't return empty sticker objects */
|
/* don't return empty sticker objects */
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
return new sticker(std::move(s));
|
return new Sticker(std::move(s));
|
||||||
}
|
}
|
||||||
|
|
||||||
static sqlite3_stmt *
|
static sqlite3_stmt *
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
|
|
||||||
class Error;
|
class Error;
|
||||||
class Path;
|
class Path;
|
||||||
struct sticker;
|
struct Sticker;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens the sticker database.
|
* Opens the sticker database.
|
||||||
@ -111,7 +111,7 @@ sticker_delete_value(const char *type, const char *uri, const char *name,
|
|||||||
* @param sticker the sticker object to be freed
|
* @param sticker the sticker object to be freed
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
sticker_free(sticker *sticker);
|
sticker_free(Sticker *sticker);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines a single value in a sticker.
|
* Determines a single value in a sticker.
|
||||||
@ -122,7 +122,7 @@ sticker_free(sticker *sticker);
|
|||||||
*/
|
*/
|
||||||
gcc_pure
|
gcc_pure
|
||||||
const char *
|
const char *
|
||||||
sticker_get_value(const sticker &sticker, const char *name);
|
sticker_get_value(const Sticker &sticker, const char *name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Iterates over all sticker items in a sticker.
|
* Iterates over all sticker items in a sticker.
|
||||||
@ -132,7 +132,7 @@ sticker_get_value(const sticker &sticker, const char *name);
|
|||||||
* @param user_data an opaque pointer for the callback function
|
* @param user_data an opaque pointer for the callback function
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
sticker_foreach(const sticker &sticker,
|
sticker_foreach(const Sticker &sticker,
|
||||||
void (*func)(const char *name, const char *value,
|
void (*func)(const char *name, const char *value,
|
||||||
void *user_data),
|
void *user_data),
|
||||||
void *user_data);
|
void *user_data);
|
||||||
@ -144,7 +144,7 @@ sticker_foreach(const sticker &sticker,
|
|||||||
* @param uri the URI of the resource, e.g. the song path
|
* @param uri the URI of the resource, e.g. the song path
|
||||||
* @return a sticker object, or nullptr on error or if there is no sticker
|
* @return a sticker object, or nullptr on error or if there is no sticker
|
||||||
*/
|
*/
|
||||||
sticker *
|
Sticker *
|
||||||
sticker_load(const char *type, const char *uri,
|
sticker_load(const char *type, const char *uri,
|
||||||
Error &error);
|
Error &error);
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ print_sticker_cb(const char *name, const char *value, void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sticker_print(Client &client, const sticker &sticker)
|
sticker_print(Client &client, const Sticker &sticker)
|
||||||
{
|
{
|
||||||
sticker_foreach(sticker, print_sticker_cb, &client);
|
sticker_foreach(sticker, print_sticker_cb, &client);
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#ifndef MPD_STICKER_PRINT_HXX
|
#ifndef MPD_STICKER_PRINT_HXX
|
||||||
#define MPD_STICKER_PRINT_HXX
|
#define MPD_STICKER_PRINT_HXX
|
||||||
|
|
||||||
struct sticker;
|
struct Sticker;
|
||||||
class Client;
|
class Client;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -33,6 +33,6 @@ sticker_print_value(Client &client, const char *name, const char *value);
|
|||||||
* Sends all sticker values to the client.
|
* Sends all sticker values to the client.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
sticker_print(Client &client, const sticker &sticker);
|
sticker_print(Client &client, const Sticker &sticker);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user