aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-04-09 00:22:35 +0200
committerMax Kellermann <max@duempel.org>2013-04-09 00:38:03 +0200
commit2090911363a131b2a38d39d3b8458eae02889e57 (patch)
treef4aca1787b5986a91cdcf95e5f15d433c12089ff /src/playlist
parent3cc7be0fa6ad68fae6f3d1938e2f7f5a2e951454 (diff)
downloadmpd-2090911363a131b2a38d39d3b8458eae02889e57.tar.gz
mpd-2090911363a131b2a38d39d3b8458eae02889e57.tar.xz
mpd-2090911363a131b2a38d39d3b8458eae02889e57.zip
cue_parser: convert to C++
Diffstat (limited to 'src/playlist')
-rw-r--r--src/playlist/CuePlaylistPlugin.cxx18
-rw-r--r--src/playlist/EmbeddedCuePlaylistPlugin.cxx18
2 files changed, 17 insertions, 19 deletions
diff --git a/src/playlist/CuePlaylistPlugin.cxx b/src/playlist/CuePlaylistPlugin.cxx
index 71ae2261a..730ef783b 100644
--- a/src/playlist/CuePlaylistPlugin.cxx
+++ b/src/playlist/CuePlaylistPlugin.cxx
@@ -23,10 +23,10 @@
#include "tag.h"
#include "song.h"
#include "input_stream.h"
+#include "cue/CueParser.hxx"
extern "C" {
#include "text_input_stream.h"
-#include "cue/cue_parser.h"
}
#include <glib.h>
@@ -41,16 +41,14 @@ struct CuePlaylist {
struct input_stream *is;
struct text_input_stream *tis;
- struct cue_parser *parser;
+ CueParser parser;
CuePlaylist(struct input_stream *_is)
- :is(_is), tis(text_input_stream_new(is)),
- parser(cue_parser_new()) {
+ :is(_is), tis(text_input_stream_new(is)) {
playlist_provider_init(&base, &cue_playlist_plugin);
}
~CuePlaylist() {
- cue_parser_free(parser);
text_input_stream_free(tis);
}
};
@@ -74,20 +72,20 @@ cue_playlist_read(struct playlist_provider *_playlist)
{
CuePlaylist *playlist = (CuePlaylist *)_playlist;
- struct song *song = cue_parser_get(playlist->parser);
+ struct song *song = playlist->parser.Get();
if (song != NULL)
return song;
const char *line;
while ((line = text_input_stream_read(playlist->tis)) != NULL) {
- cue_parser_feed(playlist->parser, line);
- song = cue_parser_get(playlist->parser);
+ playlist->parser.Feed(line);
+ song = playlist->parser.Get();
if (song != NULL)
return song;
}
- cue_parser_finish(playlist->parser);
- return cue_parser_get(playlist->parser);
+ playlist->parser.Finish();
+ return playlist->parser.Get();
}
static const char *const cue_playlist_suffixes[] = {
diff --git a/src/playlist/EmbeddedCuePlaylistPlugin.cxx b/src/playlist/EmbeddedCuePlaylistPlugin.cxx
index 04cb12eca..eaedc738f 100644
--- a/src/playlist/EmbeddedCuePlaylistPlugin.cxx
+++ b/src/playlist/EmbeddedCuePlaylistPlugin.cxx
@@ -30,11 +30,11 @@
#include "tag_handler.h"
#include "song.h"
#include "TagFile.hxx"
+#include "cue/CueParser.hxx"
extern "C" {
#include "tag_ape.h"
#include "tag_id3.h"
-#include "cue/cue_parser.h"
}
#include <glib.h>
@@ -64,7 +64,7 @@ struct embcue_playlist {
*/
char *next;
- struct cue_parser *parser;
+ CueParser *parser;
};
static void
@@ -112,7 +112,7 @@ embcue_playlist_open_uri(const char *uri,
playlist->filename = g_path_get_basename(uri);
playlist->next = playlist->cuesheet;
- playlist->parser = cue_parser_new();
+ playlist->parser = new CueParser();
return &playlist->base;
}
@@ -122,7 +122,7 @@ embcue_playlist_close(struct playlist_provider *_playlist)
{
struct embcue_playlist *playlist = (struct embcue_playlist *)_playlist;
- cue_parser_free(playlist->parser);
+ delete playlist->parser;
g_free(playlist->cuesheet);
g_free(playlist->filename);
g_free(playlist);
@@ -133,7 +133,7 @@ embcue_playlist_read(struct playlist_provider *_playlist)
{
struct embcue_playlist *playlist = (struct embcue_playlist *)_playlist;
- struct song *song = cue_parser_get(playlist->parser);
+ struct song *song = playlist->parser->Get();
if (song != NULL)
return song;
@@ -149,14 +149,14 @@ embcue_playlist_read(struct playlist_provider *_playlist)
end of the buffer */
playlist->next += strlen(line);
- cue_parser_feed(playlist->parser, line);
- song = cue_parser_get(playlist->parser);
+ playlist->parser->Feed(line);
+ song = playlist->parser->Get();
if (song != NULL)
return song_replace_uri(song, playlist->filename);
}
- cue_parser_finish(playlist->parser);
- song = cue_parser_get(playlist->parser);
+ playlist->parser->Finish();
+ song = playlist->parser->Get();
if (song != NULL)
song = song_replace_uri(song, playlist->filename);
return song;