tag_handler: convert to C++

This commit is contained in:
Max Kellermann 2013-07-29 07:32:36 +02:00
parent 96b763067e
commit cde6a3a00c
32 changed files with 58 additions and 63 deletions

View File

@ -226,7 +226,7 @@ src_mpd_SOURCES = \
src/TagPool.cxx src/TagPool.hxx \
src/TagPrint.cxx src/TagPrint.hxx \
src/TagSave.cxx src/TagSave.hxx \
src/tag_handler.c src/tag_handler.h \
src/TagHandler.cxx src/TagHandler.hxx \
src/TagFile.cxx src/TagFile.hxx \
src/TextFile.cxx src/TextFile.hxx \
src/TextInputStream.cxx \
@ -1138,7 +1138,7 @@ test_dump_playlist_SOURCES = test/dump_playlist.cxx \
$(DECODER_SRC) \
src/IOThread.cxx \
src/Song.cxx src/Tag.cxx src/TagNames.c src/TagPool.cxx src/TagSave.cxx \
src/tag_handler.c src/TagFile.cxx \
src/TagHandler.cxx src/TagFile.cxx \
src/audio_check.c \
src/TextInputStream.cxx \
src/cue/CueParser.cxx src/cue/CueParser.hxx \
@ -1164,7 +1164,7 @@ test_run_decoder_LDADD = \
test_run_decoder_SOURCES = test/run_decoder.cxx \
test/stdbin.h \
src/IOThread.cxx \
src/Tag.cxx src/TagNames.c src/TagPool.cxx src/tag_handler.c \
src/Tag.cxx src/TagNames.c src/TagPool.cxx src/TagHandler.cxx \
src/ReplayGainInfo.cxx \
src/fd_util.c \
src/audio_check.c \
@ -1187,7 +1187,7 @@ test_read_tags_LDADD = \
$(GLIB_LIBS)
test_read_tags_SOURCES = test/read_tags.cxx \
src/IOThread.cxx \
src/Tag.cxx src/TagNames.c src/TagPool.cxx src/tag_handler.c \
src/Tag.cxx src/TagNames.c src/TagPool.cxx src/TagHandler.cxx \
src/ReplayGainInfo.cxx \
src/fd_util.c \
src/audio_check.c \
@ -1199,7 +1199,7 @@ test_dump_rva2_LDADD = \
$(GLIB_LIBS)
test_dump_rva2_SOURCES = test/dump_rva2.cxx \
src/riff.c src/aiff.c \
src/tag_handler.c \
src/TagHandler.cxx \
src/TagId3.cxx \
src/TagRva2.cxx
endif

View File

@ -22,7 +22,7 @@
#include "ApeLoader.hxx"
#include "tag.h"
#include "tag_table.h"
#include "tag_handler.h"
#include "TagHandler.hxx"
const struct tag_table ape_tags[] = {
{ "album artist", TAG_ALBUM_ARTIST },

View File

@ -28,13 +28,10 @@
#include "input_stream.h"
#include "DecoderPlugin.hxx"
#include "DecoderList.hxx"
#include "TagHandler.hxx"
#include "TagId3.hxx"
#include "ApeTag.hxx"
extern "C" {
#include "tag_handler.h"
}
#include <glib.h>
#include <assert.h>

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2011 The Music Player Daemon Project
* Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@ -18,14 +18,14 @@
*/
#include "config.h"
#include "tag_handler.h"
#include "TagHandler.hxx"
#include <glib.h>
static void
add_tag_duration(unsigned seconds, void *ctx)
{
struct tag *tag = ctx;
struct tag *tag = (struct tag *)ctx;
tag->time = seconds;
}
@ -33,28 +33,29 @@ add_tag_duration(unsigned seconds, void *ctx)
static void
add_tag_tag(enum tag_type type, const char *value, void *ctx)
{
struct tag *tag = ctx;
struct tag *tag = (struct tag *)ctx;
tag_add_item(tag, type, value);
}
const struct tag_handler add_tag_handler = {
.duration = add_tag_duration,
.tag = add_tag_tag,
add_tag_duration,
add_tag_tag,
nullptr,
};
static void
full_tag_pair(const char *name, G_GNUC_UNUSED const char *value, void *ctx)
{
struct tag *tag = ctx;
struct tag *tag = (struct tag *)ctx;
if (g_ascii_strcasecmp(name, "cuesheet") == 0)
tag->has_playlist = true;
}
const struct tag_handler full_tag_handler = {
.duration = add_tag_duration,
.tag = add_tag_tag,
.pair = full_tag_pair,
add_tag_duration,
add_tag_tag,
full_tag_pair,
};

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2011 The Music Player Daemon Project
* Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@ -17,8 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_TAG_HANDLER_H
#define MPD_TAG_HANDLER_H
#ifndef MPD_TAG_HANDLER_HXX
#define MPD_TAG_HANDLER_HXX
#include "check.h"
#include "tag.h"
@ -55,9 +55,9 @@ static inline void
tag_handler_invoke_duration(const struct tag_handler *handler, void *ctx,
unsigned seconds)
{
assert(handler != NULL);
assert(handler != nullptr);
if (handler->duration != NULL)
if (handler->duration != nullptr)
handler->duration(seconds, ctx);
}
@ -65,11 +65,11 @@ static inline void
tag_handler_invoke_tag(const struct tag_handler *handler, void *ctx,
enum tag_type type, const char *value)
{
assert(handler != NULL);
assert(handler != nullptr);
assert((unsigned)type < TAG_NUM_OF_ITEM_TYPES);
assert(value != NULL);
assert(value != nullptr);
if (handler->tag != NULL)
if (handler->tag != nullptr)
handler->tag(type, value, ctx);
}
@ -77,11 +77,11 @@ static inline void
tag_handler_invoke_pair(const struct tag_handler *handler, void *ctx,
const char *name, const char *value)
{
assert(handler != NULL);
assert(name != NULL);
assert(value != NULL);
assert(handler != nullptr);
assert(name != nullptr);
assert(value != nullptr);
if (handler->pair != NULL)
if (handler->pair != nullptr)
handler->pair(name, value, ctx);
}

View File

@ -19,7 +19,7 @@
#include "config.h"
#include "TagId3.hxx"
#include "tag_handler.h"
#include "TagHandler.hxx"
#include "tag_table.h"
#include "tag.h"

View File

@ -27,10 +27,7 @@
#include "DecoderPlugin.hxx"
#include "Mapper.hxx"
#include "fs/Path.hxx"
extern "C" {
#include "tag_handler.h"
}
#include "TagHandler.hxx"
#include <glib.h>

View File

@ -19,7 +19,7 @@
#include "config.h"
#include "AdPlugDecoderPlugin.h"
#include "tag_handler.h"
#include "TagHandler.hxx"
#include "DecoderAPI.hxx"
extern "C" {

View File

@ -21,7 +21,7 @@
#include "AudiofileDecoderPlugin.hxx"
#include "DecoderAPI.hxx"
#include "audio_check.h"
#include "tag_handler.h"
#include "TagHandler.hxx"
#include <audiofile.h>
#include <af_vfs.h>

View File

@ -27,7 +27,7 @@
#include "DsdLib.hxx"
#include "DecoderAPI.hxx"
#include "util/bit_reverse.h"
#include "tag_handler.h"
#include "TagHandler.hxx"
#include "TagId3.hxx"
#include <unistd.h>

View File

@ -31,9 +31,9 @@
#include "DecoderAPI.hxx"
#include "audio_check.h"
#include "util/bit_reverse.h"
#include "tag_handler.h"
#include "TagHandler.hxx"
#include "DsdLib.hxx"
#include "tag_handler.h"
#include "TagHandler.hxx"
#include <unistd.h>
#include <stdio.h> /* for SEEK_SET, SEEK_CUR */

View File

@ -33,7 +33,7 @@
#include "audio_check.h"
#include "util/bit_reverse.h"
#include "DsdLib.hxx"
#include "tag_handler.h"
#include "TagHandler.hxx"
#include <unistd.h>
#include <stdio.h> /* for SEEK_SET, SEEK_CUR */

View File

@ -22,7 +22,7 @@
#include "DecoderAPI.hxx"
#include "DecoderBuffer.hxx"
#include "audio_check.h"
#include "tag_handler.h"
#include "TagHandler.hxx"
#include <neaacdec.h>

View File

@ -24,7 +24,7 @@
#include "FfmpegDecoderPlugin.hxx"
#include "DecoderAPI.hxx"
#include "FfmpegMetaData.hxx"
#include "tag_handler.h"
#include "TagHandler.hxx"
#include "InputStream.hxx"
extern "C" {

View File

@ -23,7 +23,7 @@
#include "config.h"
#include "FfmpegMetaData.hxx"
#include "tag_table.h"
#include "tag_handler.h"
#include "TagHandler.hxx"
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "ffmpeg"

View File

@ -25,7 +25,7 @@ extern "C" {
}
#include "tag.h"
#include "tag_handler.h"
#include "TagHandler.hxx"
#include "tag_table.h"
#include "replay_gain_info.h"

View File

@ -21,7 +21,7 @@
#include "GmeDecoderPlugin.hxx"
#include "DecoderAPI.hxx"
#include "audio_check.h"
#include "tag_handler.h"
#include "TagHandler.hxx"
#include "util/UriUtil.hxx"
#include <glib.h>

View File

@ -23,7 +23,7 @@
#include "conf.h"
#include "TagId3.hxx"
#include "TagRva2.hxx"
#include "tag_handler.h"
#include "TagHandler.hxx"
#include "audio_check.h"
#include <assert.h>

View File

@ -21,7 +21,7 @@
#include "MikmodDecoderPlugin.hxx"
#include "DecoderAPI.hxx"
#include "mpd_error.h"
#include "tag_handler.h"
#include "TagHandler.hxx"
#include <glib.h>
#include <mikmod.h>

View File

@ -20,7 +20,7 @@
#include "config.h"
#include "ModplugDecoderPlugin.hxx"
#include "DecoderAPI.hxx"
#include "tag_handler.h"
#include "TagHandler.hxx"
#include <glib.h>
#include <modplug.h>

View File

@ -21,7 +21,7 @@
#include "MpcdecDecoderPlugin.hxx"
#include "DecoderAPI.hxx"
#include "audio_check.h"
#include "tag_handler.h"
#include "TagHandler.hxx"
#ifdef MPC_IS_OLD_API
#include <mpcdec/mpcdec.h>

View File

@ -21,7 +21,7 @@
#include "Mpg123DecoderPlugin.hxx"
#include "DecoderAPI.hxx"
#include "audio_check.h"
#include "tag_handler.h"
#include "TagHandler.hxx"
#include <glib.h>

View File

@ -27,7 +27,7 @@
#include "DecoderAPI.hxx"
#include "OggCodec.hxx"
#include "audio_check.h"
#include "tag_handler.h"
#include "TagHandler.hxx"
#include "InputStream.hxx"
#include <opus.h>

View File

@ -21,7 +21,7 @@
#include "OpusTags.hxx"
#include "OpusReader.hxx"
#include "XiphTags.h"
#include "tag_handler.h"
#include "TagHandler.hxx"
#include <stdint.h>
#include <string.h>

View File

@ -21,7 +21,7 @@
#include "SndfileDecoderPlugin.hxx"
#include "DecoderAPI.hxx"
#include "audio_check.h"
#include "tag_handler.h"
#include "TagHandler.hxx"
#include <sndfile.h>

View File

@ -22,7 +22,7 @@
#include "XiphTags.h"
#include "tag.h"
#include "tag_table.h"
#include "tag_handler.h"
#include "TagHandler.hxx"
#include "replay_gain_info.h"
#include <glib.h>

View File

@ -29,7 +29,7 @@ extern "C" {
#include "audio_check.h"
}
#include "tag_handler.h"
#include "TagHandler.hxx"
#ifndef HAVE_TREMOR
#define OV_EXCLUDE_STATIC_CALLBACKS

View File

@ -26,7 +26,7 @@ extern "C" {
#include "audio_check.h"
}
#include "tag_handler.h"
#include "TagHandler.hxx"
#include "ApeTag.hxx"
#include <wavpack/wavpack.h>

View File

@ -20,7 +20,7 @@
#include "config.h"
#include "WildmidiDecoderPlugin.hxx"
#include "DecoderAPI.hxx"
#include "tag_handler.h"
#include "TagHandler.hxx"
#include "glib_compat.h"
#include <glib.h>

View File

@ -21,7 +21,7 @@
#include "../DecoderAPI.hxx"
extern "C" {
#include "tag_handler.h"
#include "TagHandler.hxx"
}
#include <errno.h>

View File

@ -27,7 +27,7 @@
#include "EmbeddedCuePlaylistPlugin.hxx"
#include "PlaylistPlugin.hxx"
#include "tag.h"
#include "tag_handler.h"
#include "TagHandler.hxx"
#include "TagId3.hxx"
#include "ApeTag.hxx"
#include "Song.hxx"

View File

@ -24,7 +24,7 @@
#include "InputInit.hxx"
#include "InputStream.hxx"
#include "audio_format.h"
#include "tag_handler.h"
#include "TagHandler.hxx"
#include "TagId3.hxx"
#include "ApeTag.hxx"