aboutsummaryrefslogtreecommitdiffstats
path: root/src/SongSticker.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-01-19 10:51:34 +0100
committerMax Kellermann <max@duempel.org>2014-01-19 17:04:51 +0100
commitf5ae1ce00b85699291a7cdf9782574e70a8c28f5 (patch)
tree9cb95dd1d98b1b0cd522ee27d7e8a374a3c8eb4a /src/SongSticker.cxx
parent738d6f10409037fbf8aa30cec5aceb121e21e230 (diff)
downloadmpd-f5ae1ce00b85699291a7cdf9782574e70a8c28f5.tar.gz
mpd-f5ae1ce00b85699291a7cdf9782574e70a8c28f5.tar.xz
mpd-f5ae1ce00b85699291a7cdf9782574e70a8c28f5.zip
LightSong: new class to be used by DatabasePlugin callbacks
Detach the Song class completely from the public API, only to be used by SimpleDatabase and the update thread.
Diffstat (limited to 'src/SongSticker.cxx')
-rw-r--r--src/SongSticker.cxx17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/SongSticker.cxx b/src/SongSticker.cxx
index 8c5499bc2..55143d278 100644
--- a/src/SongSticker.cxx
+++ b/src/SongSticker.cxx
@@ -20,6 +20,7 @@
#include "config.h"
#include "SongSticker.hxx"
#include "StickerDatabase.hxx"
+#include "LightSong.hxx"
#include "Song.hxx"
#include "Directory.hxx"
@@ -29,14 +30,14 @@
#include <string.h>
std::string
-sticker_song_get_value(const Song &song, const char *name)
+sticker_song_get_value(const LightSong &song, const char *name)
{
const auto uri = song.GetURI();
return sticker_load_value("song", uri.c_str(), name);
}
bool
-sticker_song_set_value(const Song &song,
+sticker_song_set_value(const LightSong &song,
const char *name, const char *value)
{
const auto uri = song.GetURI();
@@ -44,21 +45,21 @@ sticker_song_set_value(const Song &song,
}
bool
-sticker_song_delete(const Song &song)
+sticker_song_delete(const LightSong &song)
{
const auto uri = song.GetURI();
return sticker_delete("song", uri.c_str());
}
bool
-sticker_song_delete_value(const Song &song, const char *name)
+sticker_song_delete_value(const LightSong &song, const char *name)
{
const auto uri = song.GetURI();
return sticker_delete_value("song", uri.c_str(), name);
}
struct sticker *
-sticker_song_get(const Song &song)
+sticker_song_get(const LightSong &song)
{
const auto uri = song.GetURI();
return sticker_load("song", uri.c_str());
@@ -69,7 +70,7 @@ struct sticker_song_find_data {
const char *base_uri;
size_t base_uri_length;
- void (*func)(Song &song, const char *value,
+ void (*func)(const LightSong &song, const char *value,
void *user_data);
void *user_data;
};
@@ -86,12 +87,12 @@ sticker_song_find_cb(const char *uri, const char *value, void *user_data)
Song *song = data->directory->LookupSong(uri + data->base_uri_length);
if (song != nullptr)
- data->func(*song, value, data->user_data);
+ data->func(song->Export(), value, data->user_data);
}
bool
sticker_song_find(Directory &directory, const char *name,
- void (*func)(Song &song, const char *value,
+ void (*func)(const LightSong &song, const char *value,
void *user_data),
void *user_data)
{