tag: convert to C++

This commit is contained in:
Max Kellermann
2013-07-30 20:11:57 +02:00
parent 6a9ab8bc0e
commit 06f898cc12
105 changed files with 711 additions and 723 deletions

View File

@@ -25,7 +25,7 @@
#include "Song.hxx"
#include "PlaylistVector.hxx"
#include "conf.h"
#include "tag.h"
#include "Tag.hxx"
#include "fs/Path.hxx"
#include <iostream>

View File

@@ -106,7 +106,7 @@ decoder_data(G_GNUC_UNUSED struct decoder *decoder,
enum decoder_command
decoder_tag(G_GNUC_UNUSED struct decoder *decoder,
G_GNUC_UNUSED struct input_stream *is,
G_GNUC_UNUSED const struct tag *tag)
G_GNUC_UNUSED const Tag *tag)
{
return DECODE_COMMAND_NONE;
}
@@ -232,7 +232,7 @@ int main(int argc, char **argv)
(song->start_ms / 1000) % 60);
if (song->tag != NULL)
tag_save(stdout, song->tag);
tag_save(stdout, *song->tag);
song->Free();
}

View File

@@ -22,7 +22,7 @@
#include "TagRva2.hxx"
#include "replay_gain_info.h"
#include "conf.h"
#include "tag.h"
#include "Tag.hxx"
#include <id3tag.h>
@@ -41,23 +41,13 @@ config_get_string(gcc_unused enum ConfigOption option,
return default_value;
}
struct tag *
tag_new(void)
{
return NULL;
}
void
tag_add_item_n(gcc_unused struct tag *tag, gcc_unused enum tag_type type,
gcc_unused const char *value, gcc_unused size_t len)
Tag::AddItem(gcc_unused enum tag_type type,
gcc_unused const char *value)
{
}
void
tag_free(struct tag *tag)
{
g_free(tag);
}
Tag::~Tag() {}
int main(int argc, char **argv)
{

View File

@@ -92,7 +92,7 @@ decoder_data(G_GNUC_UNUSED struct decoder *decoder,
enum decoder_command
decoder_tag(G_GNUC_UNUSED struct decoder *decoder,
G_GNUC_UNUSED struct input_stream *is,
G_GNUC_UNUSED const struct tag *tag)
G_GNUC_UNUSED const Tag *tag)
{
return DECODE_COMMAND_NONE;
}

View File

@@ -113,7 +113,7 @@ decoder_data(G_GNUC_UNUSED struct decoder *decoder,
enum decoder_command
decoder_tag(G_GNUC_UNUSED struct decoder *decoder,
G_GNUC_UNUSED struct input_stream *is,
G_GNUC_UNUSED const struct tag *tag)
G_GNUC_UNUSED const Tag *tag)
{
return DECODE_COMMAND_NONE;
}

View File

@@ -20,7 +20,7 @@
#include "config.h"
#include "TagSave.hxx"
#include "stdbin.h"
#include "tag.h"
#include "Tag.hxx"
#include "conf.h"
#include "input_stream.h"
#include "InputStream.hxx"
@@ -75,11 +75,11 @@ dump_input_stream(struct input_stream *is)
/* read data and tags from the stream */
while (!input_stream_eof(is)) {
struct tag *tag = input_stream_tag(is);
Tag *tag = input_stream_tag(is);
if (tag != NULL) {
g_printerr("Received a tag:\n");
tag_save(stderr, tag);
tag_free(tag);
tag_save(stderr, *tag);
delete tag;
}
num_read = input_stream_read(is, buffer, sizeof(buffer),

View File

@@ -23,7 +23,7 @@
#include "audio_format.h"
#include "conf.h"
#include "stdbin.h"
#include "tag.h"
#include "Tag.hxx"
#include <glib.h>
@@ -83,15 +83,13 @@ main(G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv)
encoder_to_stdout(*encoder);
struct tag *tag = tag_new();
tag_add_item(tag, TAG_ARTIST, "Foo");
tag_add_item(tag, TAG_TITLE, "Bar");
Tag tag;
tag.AddItem(TAG_ARTIST, "Foo");
tag.AddItem(TAG_TITLE, "Bar");
success = encoder_tag(encoder, tag, NULL);
success = encoder_tag(encoder, &tag, NULL);
assert(success);
tag_free(tag);
encoder_to_stdout(*encoder);
/* write another block of data */

View File

@@ -19,7 +19,7 @@
#include "config.h"
#include "stdbin.h"
#include "tag.h"
#include "Tag.hxx"
#include "conf.h"
#include "IOThread.hxx"
#include "InputInit.hxx"