song: convert header to C++
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
#include "AsxPlaylistPlugin.hxx"
|
||||
#include "MemoryPlaylistProvider.hxx"
|
||||
#include "input_stream.h"
|
||||
#include "song.h"
|
||||
#include "Song.hxx"
|
||||
#include "tag.h"
|
||||
|
||||
#include <glib.h>
|
||||
@@ -60,7 +60,7 @@ struct AsxParser {
|
||||
* The current song. It is allocated after the "location"
|
||||
* element.
|
||||
*/
|
||||
struct song *song;
|
||||
Song *song;
|
||||
|
||||
AsxParser()
|
||||
:state(ROOT) {}
|
||||
@@ -91,7 +91,7 @@ asx_start_element(G_GNUC_UNUSED GMarkupParseContext *context,
|
||||
case AsxParser::ROOT:
|
||||
if (g_ascii_strcasecmp(element_name, "entry") == 0) {
|
||||
parser->state = AsxParser::ENTRY;
|
||||
parser->song = song_remote_new("asx:");
|
||||
parser->song = Song::NewRemote("asx:");
|
||||
parser->tag = TAG_NUM_OF_ITEM_TYPES;
|
||||
}
|
||||
|
||||
@@ -108,12 +108,12 @@ asx_start_element(G_GNUC_UNUSED GMarkupParseContext *context,
|
||||
replace the existing song's URI,
|
||||
because that attribute is
|
||||
immutable */
|
||||
struct song *song = song_remote_new(href);
|
||||
Song *song = Song::NewRemote(href);
|
||||
|
||||
if (parser->song != NULL) {
|
||||
song->tag = parser->song->tag;
|
||||
parser->song->tag = NULL;
|
||||
song_free(parser->song);
|
||||
parser->song->Free();
|
||||
}
|
||||
|
||||
parser->song = song;
|
||||
@@ -145,7 +145,7 @@ asx_end_element(G_GNUC_UNUSED GMarkupParseContext *context,
|
||||
if (strcmp(parser->song->uri, "asx:") != 0)
|
||||
parser->songs.emplace_front(parser->song);
|
||||
else
|
||||
song_free(parser->song);
|
||||
parser->song->Free();
|
||||
|
||||
parser->state = AsxParser::ROOT;
|
||||
} else
|
||||
@@ -192,7 +192,7 @@ asx_parser_destroy(gpointer data)
|
||||
AsxParser *parser = (AsxParser *)data;
|
||||
|
||||
if (parser->state >= AsxParser::ENTRY)
|
||||
song_free(parser->song);
|
||||
parser->song->Free();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "CuePlaylistPlugin.hxx"
|
||||
#include "PlaylistPlugin.hxx"
|
||||
#include "tag.h"
|
||||
#include "song.h"
|
||||
#include "Song.hxx"
|
||||
#include "input_stream.h"
|
||||
#include "cue/CueParser.hxx"
|
||||
#include "TextInputStream.hxx"
|
||||
@@ -63,12 +63,12 @@ cue_playlist_close(struct playlist_provider *_playlist)
|
||||
delete playlist;
|
||||
}
|
||||
|
||||
static struct song *
|
||||
static Song *
|
||||
cue_playlist_read(struct playlist_provider *_playlist)
|
||||
{
|
||||
CuePlaylist *playlist = (CuePlaylist *)_playlist;
|
||||
|
||||
struct song *song = playlist->parser.Get();
|
||||
Song *song = playlist->parser.Get();
|
||||
if (song != NULL)
|
||||
return song;
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "DespotifyUtils.hxx"
|
||||
#include "MemoryPlaylistProvider.hxx"
|
||||
#include "tag.h"
|
||||
#include "song.h"
|
||||
#include "Song.hxx"
|
||||
|
||||
extern "C" {
|
||||
#include <despotify.h>
|
||||
@@ -37,7 +37,7 @@ static void
|
||||
add_song(std::forward_list<SongPointer> &songs, struct ds_track *track)
|
||||
{
|
||||
const char *dsp_scheme = despotify_playlist_plugin.schemes[0];
|
||||
struct song *song;
|
||||
Song *song;
|
||||
char uri[128];
|
||||
char *ds_uri;
|
||||
|
||||
@@ -51,7 +51,7 @@ add_song(std::forward_list<SongPointer> &songs, struct ds_track *track)
|
||||
return;
|
||||
}
|
||||
|
||||
song = song_remote_new(uri);
|
||||
song = Song::NewRemote(uri);
|
||||
song->tag = mpd_despotify_tag_from_track(track);
|
||||
|
||||
songs.emplace_front(song);
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include "PlaylistPlugin.hxx"
|
||||
#include "tag.h"
|
||||
#include "tag_handler.h"
|
||||
#include "song.h"
|
||||
#include "Song.hxx"
|
||||
#include "TagFile.hxx"
|
||||
#include "cue/CueParser.hxx"
|
||||
|
||||
@@ -128,12 +128,12 @@ embcue_playlist_close(struct playlist_provider *_playlist)
|
||||
g_free(playlist);
|
||||
}
|
||||
|
||||
static struct song *
|
||||
static Song *
|
||||
embcue_playlist_read(struct playlist_provider *_playlist)
|
||||
{
|
||||
struct embcue_playlist *playlist = (struct embcue_playlist *)_playlist;
|
||||
|
||||
struct song *song = playlist->parser->Get();
|
||||
Song *song = playlist->parser->Get();
|
||||
if (song != NULL)
|
||||
return song;
|
||||
|
||||
@@ -152,13 +152,13 @@ embcue_playlist_read(struct playlist_provider *_playlist)
|
||||
playlist->parser->Feed(line);
|
||||
song = playlist->parser->Get();
|
||||
if (song != NULL)
|
||||
return song_replace_uri(song, playlist->filename);
|
||||
return song->ReplaceURI(playlist->filename);
|
||||
}
|
||||
|
||||
playlist->parser->Finish();
|
||||
song = playlist->parser->Get();
|
||||
if (song != NULL)
|
||||
song = song_replace_uri(song, playlist->filename);
|
||||
song = song->ReplaceURI(playlist->filename);
|
||||
return song;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "config.h"
|
||||
#include "ExtM3uPlaylistPlugin.hxx"
|
||||
#include "PlaylistPlugin.hxx"
|
||||
#include "song.h"
|
||||
#include "Song.hxx"
|
||||
#include "tag.h"
|
||||
#include "util/StringUtil.hxx"
|
||||
#include "TextInputStream.hxx"
|
||||
@@ -105,14 +105,14 @@ extm3u_parse_tag(const char *line)
|
||||
return tag;
|
||||
}
|
||||
|
||||
static struct song *
|
||||
static Song *
|
||||
extm3u_read(struct playlist_provider *_playlist)
|
||||
{
|
||||
ExtM3uPlaylist *playlist = (ExtM3uPlaylist *)_playlist;
|
||||
struct tag *tag = NULL;
|
||||
std::string line;
|
||||
const char *line_s;
|
||||
struct song *song;
|
||||
Song *song;
|
||||
|
||||
do {
|
||||
if (!playlist->tis->ReadLine(line)) {
|
||||
@@ -134,7 +134,7 @@ extm3u_read(struct playlist_provider *_playlist)
|
||||
++line_s;
|
||||
} while (line_s[0] == '#' || *line_s == 0);
|
||||
|
||||
song = song_remote_new(line_s);
|
||||
song = Song::NewRemote(line_s);
|
||||
song->tag = tag;
|
||||
return song;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "PlaylistPlugin.hxx"
|
||||
#include "PlaylistRegistry.hxx"
|
||||
#include "conf.h"
|
||||
#include "song.h"
|
||||
#include "Song.hxx"
|
||||
#include "input_stream.h"
|
||||
|
||||
#include <glib.h>
|
||||
@@ -268,7 +268,7 @@ lastfm_close(struct playlist_provider *_playlist)
|
||||
g_free(playlist);
|
||||
}
|
||||
|
||||
static struct song *
|
||||
static Song *
|
||||
lastfm_read(struct playlist_provider *_playlist)
|
||||
{
|
||||
struct lastfm_playlist *playlist = (struct lastfm_playlist *)_playlist;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "config.h"
|
||||
#include "M3uPlaylistPlugin.hxx"
|
||||
#include "PlaylistPlugin.hxx"
|
||||
#include "song.h"
|
||||
#include "Song.hxx"
|
||||
#include "TextInputStream.hxx"
|
||||
|
||||
#include <glib.h>
|
||||
@@ -51,7 +51,7 @@ m3u_close(struct playlist_provider *_playlist)
|
||||
g_free(playlist);
|
||||
}
|
||||
|
||||
static struct song *
|
||||
static Song *
|
||||
m3u_read(struct playlist_provider *_playlist)
|
||||
{
|
||||
M3uPlaylist *playlist = (M3uPlaylist *)_playlist;
|
||||
@@ -68,7 +68,7 @@ m3u_read(struct playlist_provider *_playlist)
|
||||
++line_s;
|
||||
} while (line_s[0] == '#' || *line_s == 0);
|
||||
|
||||
return song_remote_new(line_s);
|
||||
return Song::NewRemote(line_s);
|
||||
}
|
||||
|
||||
static const char *const m3u_suffixes[] = {
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#include "config.h"
|
||||
#include "MemoryPlaylistProvider.hxx"
|
||||
#include "song.h"
|
||||
#include "Song.hxx"
|
||||
|
||||
static void
|
||||
memory_playlist_close(struct playlist_provider *_playlist)
|
||||
@@ -29,7 +29,7 @@ memory_playlist_close(struct playlist_provider *_playlist)
|
||||
delete playlist;
|
||||
}
|
||||
|
||||
static struct song *
|
||||
static Song *
|
||||
memory_playlist_read(struct playlist_provider *_playlist)
|
||||
{
|
||||
MemoryPlaylistProvider *playlist = (MemoryPlaylistProvider *)_playlist;
|
||||
@@ -57,7 +57,7 @@ MemoryPlaylistProvider::MemoryPlaylistProvider(std::forward_list<SongPointer> &&
|
||||
playlist_provider_init(this, &memory_playlist_plugin);
|
||||
}
|
||||
|
||||
inline song *
|
||||
inline Song *
|
||||
MemoryPlaylistProvider::Read()
|
||||
{
|
||||
if (songs.empty())
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
#include <forward_list>
|
||||
|
||||
struct song;
|
||||
struct Song;
|
||||
|
||||
class MemoryPlaylistProvider : public playlist_provider {
|
||||
std::forward_list<SongPointer> songs;
|
||||
@@ -33,7 +33,7 @@ class MemoryPlaylistProvider : public playlist_provider {
|
||||
public:
|
||||
MemoryPlaylistProvider(std::forward_list<SongPointer> &&_songs);
|
||||
|
||||
song *Read();
|
||||
Song *Read();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "PlsPlaylistPlugin.hxx"
|
||||
#include "MemoryPlaylistProvider.hxx"
|
||||
#include "input_stream.h"
|
||||
#include "song.h"
|
||||
#include "Song.hxx"
|
||||
#include "tag.h"
|
||||
|
||||
#include <glib.h>
|
||||
@@ -50,7 +50,7 @@ pls_parser(GKeyFile *keyfile, std::forward_list<SongPointer> &songs)
|
||||
}
|
||||
|
||||
while (num_entries > 0) {
|
||||
struct song *song;
|
||||
Song *song;
|
||||
key = g_strdup_printf("File%i", num_entries);
|
||||
value = g_key_file_get_string(keyfile, "playlist", key,
|
||||
&error);
|
||||
@@ -62,7 +62,7 @@ pls_parser(GKeyFile *keyfile, std::forward_list<SongPointer> &songs)
|
||||
}
|
||||
g_free(key);
|
||||
|
||||
song = song_remote_new(value);
|
||||
song = Song::NewRemote(value);
|
||||
g_free(value);
|
||||
|
||||
key = g_strdup_printf("Title%i", num_entries);
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "RssPlaylistPlugin.hxx"
|
||||
#include "MemoryPlaylistProvider.hxx"
|
||||
#include "input_stream.h"
|
||||
#include "song.h"
|
||||
#include "Song.hxx"
|
||||
#include "tag.h"
|
||||
|
||||
#include <glib.h>
|
||||
@@ -60,7 +60,7 @@ struct RssParser {
|
||||
* The current song. It is allocated after the "location"
|
||||
* element.
|
||||
*/
|
||||
struct song *song;
|
||||
Song *song;
|
||||
|
||||
RssParser()
|
||||
:state(ROOT) {}
|
||||
@@ -90,7 +90,7 @@ rss_start_element(G_GNUC_UNUSED GMarkupParseContext *context,
|
||||
case RssParser::ROOT:
|
||||
if (g_ascii_strcasecmp(element_name, "item") == 0) {
|
||||
parser->state = RssParser::ITEM;
|
||||
parser->song = song_remote_new("rss:");
|
||||
parser->song = Song::NewRemote("rss:");
|
||||
parser->tag = TAG_NUM_OF_ITEM_TYPES;
|
||||
}
|
||||
|
||||
@@ -107,12 +107,12 @@ rss_start_element(G_GNUC_UNUSED GMarkupParseContext *context,
|
||||
replace the existing song's URI,
|
||||
because that attribute is
|
||||
immutable */
|
||||
struct song *song = song_remote_new(href);
|
||||
Song *song = Song::NewRemote(href);
|
||||
|
||||
if (parser->song != NULL) {
|
||||
song->tag = parser->song->tag;
|
||||
parser->song->tag = NULL;
|
||||
song_free(parser->song);
|
||||
parser->song->Free();
|
||||
}
|
||||
|
||||
parser->song = song;
|
||||
@@ -142,7 +142,7 @@ rss_end_element(G_GNUC_UNUSED GMarkupParseContext *context,
|
||||
if (strcmp(parser->song->uri, "rss:") != 0)
|
||||
parser->songs.emplace_front(parser->song);
|
||||
else
|
||||
song_free(parser->song);
|
||||
parser->song->Free();
|
||||
|
||||
parser->state = RssParser::ROOT;
|
||||
} else
|
||||
@@ -189,7 +189,7 @@ rss_parser_destroy(gpointer data)
|
||||
RssParser *parser = (RssParser *)data;
|
||||
|
||||
if (parser->state >= RssParser::ITEM)
|
||||
song_free(parser->song);
|
||||
parser->song->Free();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "MemoryPlaylistProvider.hxx"
|
||||
#include "conf.h"
|
||||
#include "input_stream.h"
|
||||
#include "song.h"
|
||||
#include "Song.hxx"
|
||||
#include "tag.h"
|
||||
|
||||
#include <glib.h>
|
||||
@@ -203,12 +203,12 @@ static int handle_end_map(void *ctx)
|
||||
/* got_url == 1, track finished, make it into a song */
|
||||
data->got_url = 0;
|
||||
|
||||
struct song *s;
|
||||
Song *s;
|
||||
struct tag *t;
|
||||
char *u;
|
||||
|
||||
u = g_strconcat(data->stream_url, "?client_id=", soundcloud_config.apikey, NULL);
|
||||
s = song_remote_new(u);
|
||||
s = Song::NewRemote(u);
|
||||
g_free(u);
|
||||
t = tag_new();
|
||||
t->time = data->duration / 1000;
|
||||
|
||||
@@ -60,7 +60,7 @@ struct XspfParser {
|
||||
* The current song. It is allocated after the "location"
|
||||
* element.
|
||||
*/
|
||||
struct song *song;
|
||||
Song *song;
|
||||
|
||||
XspfParser()
|
||||
:state(ROOT) {}
|
||||
@@ -187,7 +187,7 @@ xspf_text(G_GNUC_UNUSED GMarkupParseContext *context,
|
||||
case XspfParser::LOCATION:
|
||||
if (parser->song == NULL) {
|
||||
char *uri = g_strndup(text, text_len);
|
||||
parser->song = song_remote_new(uri);
|
||||
parser->song = Song::NewRemote(uri);
|
||||
g_free(uri);
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ xspf_parser_destroy(gpointer data)
|
||||
XspfParser *parser = (XspfParser *)data;
|
||||
|
||||
if (parser->state >= XspfParser::TRACK && parser->song != NULL)
|
||||
song_free(parser->song);
|
||||
parser->song->Free();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user