aboutsummaryrefslogtreecommitdiffstats
path: root/src/db
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-07-28 13:25:12 +0200
committerMax Kellermann <max@duempel.org>2013-07-28 13:25:12 +0200
commitba161ec572b98d3bcf9f735ff122133319fe896a (patch)
treea211690e3a8b7fce1fb6db540228122bead1f2bc /src/db
parent43f613d9be9aa2953dcfc0aacfbdfb56d5d1a708 (diff)
downloadmpd-ba161ec572b98d3bcf9f735ff122133319fe896a.tar.gz
mpd-ba161ec572b98d3bcf9f735ff122133319fe896a.tar.xz
mpd-ba161ec572b98d3bcf9f735ff122133319fe896a.zip
song: convert header to C++
Diffstat (limited to 'src/db')
-rw-r--r--src/db/ProxyDatabasePlugin.cxx30
-rw-r--r--src/db/SimpleDatabasePlugin.cxx8
-rw-r--r--src/db/SimpleDatabasePlugin.hxx4
3 files changed, 21 insertions, 21 deletions
diff --git a/src/db/ProxyDatabasePlugin.cxx b/src/db/ProxyDatabasePlugin.cxx
index efaaffeba..6f39eeea7 100644
--- a/src/db/ProxyDatabasePlugin.cxx
+++ b/src/db/ProxyDatabasePlugin.cxx
@@ -23,12 +23,12 @@
#include "DatabaseSelection.hxx"
#include "PlaylistVector.hxx"
#include "Directory.hxx"
+#include "Song.hxx"
#include "gcc.h"
#include "conf.h"
extern "C" {
#include "db_error.h"
-#include "song.h"
}
#undef MPD_DIRECTORY_H
@@ -52,9 +52,9 @@ public:
virtual bool Open(GError **error_r) override;
virtual void Close() override;
- virtual struct song *GetSong(const char *uri_utf8,
+ virtual Song *GetSong(const char *uri_utf8,
GError **error_r) const override;
- virtual void ReturnSong(struct song *song) const;
+ virtual void ReturnSong(Song *song) const;
virtual bool Visit(const DatabaseSelection &selection,
VisitDirectory visit_directory,
@@ -181,10 +181,10 @@ ProxyDatabase::Close()
mpd_connection_free(connection);
}
-static song *
+static Song *
Convert(const struct mpd_song *song);
-struct song *
+Song *
ProxyDatabase::GetSong(const char *uri, GError **error_r) const
{
// TODO: implement
@@ -196,13 +196,13 @@ ProxyDatabase::GetSong(const char *uri, GError **error_r) const
}
struct mpd_song *song = mpd_recv_song(connection);
- struct song *song2 = song != nullptr
+ Song *song2 = song != nullptr
? Convert(song)
: nullptr;
mpd_song_free(song);
if (!mpd_response_finish(connection)) {
if (song2 != nullptr)
- song_free(song2);
+ song2->Free();
CheckError(connection, error_r);
return nullptr;
@@ -216,13 +216,13 @@ ProxyDatabase::GetSong(const char *uri, GError **error_r) const
}
void
-ProxyDatabase::ReturnSong(struct song *song) const
+ProxyDatabase::ReturnSong(Song *song) const
{
assert(song != nullptr);
- assert(song_in_database(song));
- assert(song_is_detached(song));
+ assert(song->IsInDatabase());
+ assert(song->IsDetached());
- song_free(song);
+ song->Free();
}
static bool
@@ -268,10 +268,10 @@ Copy(struct tag *tag, enum tag_type d_tag,
}
}
-static song *
+static Song *
Convert(const struct mpd_song *song)
{
- struct song *s = song_detached_new(mpd_song_get_uri(song));
+ Song *s = Song::NewDetached(mpd_song_get_uri(song));
s->mtime = mpd_song_get_last_modified(song);
s->start_ms = mpd_song_get_start(song) * 1000;
@@ -297,9 +297,9 @@ Visit(const struct mpd_song *song,
if (!visit_song)
return true;
- struct song *s = Convert(song);
+ Song *s = Convert(song);
bool success = visit_song(*s, error_r);
- song_free(s);
+ s->Free();
return success;
}
diff --git a/src/db/SimpleDatabasePlugin.cxx b/src/db/SimpleDatabasePlugin.cxx
index 2b720c41f..f8a176fe1 100644
--- a/src/db/SimpleDatabasePlugin.cxx
+++ b/src/db/SimpleDatabasePlugin.cxx
@@ -211,13 +211,13 @@ SimpleDatabase::Close()
root->Free();
}
-struct song *
+Song *
SimpleDatabase::GetSong(const char *uri, GError **error_r) const
{
assert(root != NULL);
db_lock();
- song *song = root->LookupSong(uri);
+ Song *song = root->LookupSong(uri);
db_unlock();
if (song == NULL)
g_set_error(error_r, db_quark(), DB_NOT_FOUND,
@@ -231,7 +231,7 @@ SimpleDatabase::GetSong(const char *uri, GError **error_r) const
}
void
-SimpleDatabase::ReturnSong(gcc_unused struct song *song) const
+SimpleDatabase::ReturnSong(gcc_unused Song *song) const
{
assert(song != nullptr);
@@ -264,7 +264,7 @@ SimpleDatabase::Visit(const DatabaseSelection &selection,
const Directory *directory = root->LookupDirectory(selection.uri);
if (directory == NULL) {
if (visit_song) {
- song *song = root->LookupSong(selection.uri);
+ Song *song = root->LookupSong(selection.uri);
if (song != nullptr)
return !selection.Match(*song) ||
visit_song(*song, error_r);
diff --git a/src/db/SimpleDatabasePlugin.hxx b/src/db/SimpleDatabasePlugin.hxx
index 525e854db..8f0ed214c 100644
--- a/src/db/SimpleDatabasePlugin.hxx
+++ b/src/db/SimpleDatabasePlugin.hxx
@@ -66,9 +66,9 @@ public:
virtual bool Open(GError **error_r) override;
virtual void Close() override;
- virtual struct song *GetSong(const char *uri_utf8,
+ virtual Song *GetSong(const char *uri_utf8,
GError **error_r) const override;
- virtual void ReturnSong(struct song *song) const;
+ virtual void ReturnSong(Song *song) const;
virtual bool Visit(const DatabaseSelection &selection,
VisitDirectory visit_directory,