tag/Tag: move tag_name_parse() to ParseName.cxx
This commit is contained in:
parent
03a97d87ea
commit
a3e28c2d1a
@ -913,6 +913,7 @@ libtag_a_SOURCES =\
|
|||||||
src/tag/Mask.hxx \
|
src/tag/Mask.hxx \
|
||||||
src/tag/Settings.cxx src/tag/Settings.hxx \
|
src/tag/Settings.cxx src/tag/Settings.hxx \
|
||||||
src/tag/Config.cxx src/tag/Config.hxx \
|
src/tag/Config.cxx src/tag/Config.hxx \
|
||||||
|
src/tag/ParseName.cxx src/tag/ParseName.hxx \
|
||||||
src/tag/Names.c \
|
src/tag/Names.c \
|
||||||
src/tag/FixString.cxx src/tag/FixString.hxx \
|
src/tag/FixString.cxx src/tag/FixString.hxx \
|
||||||
src/tag/Pool.cxx src/tag/Pool.hxx \
|
src/tag/Pool.cxx src/tag/Pool.hxx \
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include "SongFilter.hxx"
|
#include "SongFilter.hxx"
|
||||||
#include "db/LightSong.hxx"
|
#include "db/LightSong.hxx"
|
||||||
#include "DetachedSong.hxx"
|
#include "DetachedSong.hxx"
|
||||||
#include "tag/Tag.hxx"
|
#include "tag/ParseName.hxx"
|
||||||
#include "util/ConstBuffer.hxx"
|
#include "util/ConstBuffer.hxx"
|
||||||
#include "util/StringAPI.hxx"
|
#include "util/StringAPI.hxx"
|
||||||
#include "util/ASCII.hxx"
|
#include "util/ASCII.hxx"
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include "TagSave.hxx"
|
#include "TagSave.hxx"
|
||||||
#include "fs/io/TextFile.hxx"
|
#include "fs/io/TextFile.hxx"
|
||||||
#include "fs/io/BufferedOutputStream.hxx"
|
#include "fs/io/BufferedOutputStream.hxx"
|
||||||
|
#include "tag/ParseName.hxx"
|
||||||
#include "tag/Tag.hxx"
|
#include "tag/Tag.hxx"
|
||||||
#include "tag/Builder.hxx"
|
#include "tag/Builder.hxx"
|
||||||
#include "util/StringUtil.hxx"
|
#include "util/StringUtil.hxx"
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#include "CommandError.hxx"
|
#include "CommandError.hxx"
|
||||||
#include "client/Client.hxx"
|
#include "client/Client.hxx"
|
||||||
#include "client/Response.hxx"
|
#include "client/Response.hxx"
|
||||||
#include "tag/Tag.hxx"
|
#include "tag/ParseName.hxx"
|
||||||
#include "util/ConstBuffer.hxx"
|
#include "util/ConstBuffer.hxx"
|
||||||
#include "util/StringAPI.hxx"
|
#include "util/StringAPI.hxx"
|
||||||
#include "SongFilter.hxx"
|
#include "SongFilter.hxx"
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include "Request.hxx"
|
#include "Request.hxx"
|
||||||
#include "client/Client.hxx"
|
#include "client/Client.hxx"
|
||||||
#include "client/Response.hxx"
|
#include "client/Response.hxx"
|
||||||
#include "tag/Tag.hxx"
|
#include "tag/ParseName.hxx"
|
||||||
#include "Partition.hxx"
|
#include "Partition.hxx"
|
||||||
#include "util/ConstBuffer.hxx"
|
#include "util/ConstBuffer.hxx"
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#include "DirectorySave.hxx"
|
#include "DirectorySave.hxx"
|
||||||
#include "fs/io/BufferedOutputStream.hxx"
|
#include "fs/io/BufferedOutputStream.hxx"
|
||||||
#include "fs/io/TextFile.hxx"
|
#include "fs/io/TextFile.hxx"
|
||||||
#include "tag/Tag.hxx"
|
#include "tag/ParseName.hxx"
|
||||||
#include "tag/Settings.hxx"
|
#include "tag/Settings.hxx"
|
||||||
#include "fs/Charset.hxx"
|
#include "fs/Charset.hxx"
|
||||||
#include "util/StringCompare.hxx"
|
#include "util/StringCompare.hxx"
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include "OpusReader.hxx"
|
#include "OpusReader.hxx"
|
||||||
#include "lib/xiph/XiphTags.hxx"
|
#include "lib/xiph/XiphTags.hxx"
|
||||||
#include "tag/Handler.hxx"
|
#include "tag/Handler.hxx"
|
||||||
#include "tag/Tag.hxx"
|
#include "tag/ParseName.hxx"
|
||||||
#include "ReplayGainInfo.hxx"
|
#include "ReplayGainInfo.hxx"
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
@ -19,10 +19,10 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "CueParser.hxx"
|
#include "CueParser.hxx"
|
||||||
|
#include "tag/ParseName.hxx"
|
||||||
#include "util/Alloc.hxx"
|
#include "util/Alloc.hxx"
|
||||||
#include "util/StringUtil.hxx"
|
#include "util/StringUtil.hxx"
|
||||||
#include "util/CharUtil.hxx"
|
#include "util/CharUtil.hxx"
|
||||||
#include "tag/Tag.hxx"
|
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "ApeTag.hxx"
|
#include "ApeTag.hxx"
|
||||||
#include "ApeLoader.hxx"
|
#include "ApeLoader.hxx"
|
||||||
#include "Tag.hxx"
|
#include "ParseName.hxx"
|
||||||
#include "Table.hxx"
|
#include "Table.hxx"
|
||||||
#include "Handler.hxx"
|
#include "Handler.hxx"
|
||||||
#include "util/StringView.hxx"
|
#include "util/StringView.hxx"
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "Config.hxx"
|
#include "Config.hxx"
|
||||||
#include "Settings.hxx"
|
#include "Settings.hxx"
|
||||||
#include "Tag.hxx"
|
#include "ParseName.hxx"
|
||||||
#include "config/ConfigGlobal.hxx"
|
#include "config/ConfigGlobal.hxx"
|
||||||
#include "config/ConfigOption.hxx"
|
#include "config/ConfigOption.hxx"
|
||||||
#include "system/FatalError.hxx"
|
#include "system/FatalError.hxx"
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "Format.hxx"
|
#include "Format.hxx"
|
||||||
#include "Tag.hxx"
|
#include "Tag.hxx"
|
||||||
|
#include "ParseName.hxx"
|
||||||
#include "util/format.h"
|
#include "util/format.h"
|
||||||
#include "util/StringUtil.hxx"
|
#include "util/StringUtil.hxx"
|
||||||
|
|
||||||
|
55
src/tag/ParseName.cxx
Normal file
55
src/tag/ParseName.cxx
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2003-2017 The Music Player Daemon Project
|
||||||
|
* http://www.musicpd.org
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include "ParseName.hxx"
|
||||||
|
#include "util/ASCII.hxx"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
TagType
|
||||||
|
tag_name_parse(const char *name)
|
||||||
|
{
|
||||||
|
assert(name != nullptr);
|
||||||
|
|
||||||
|
for (unsigned i = 0; i < TAG_NUM_OF_ITEM_TYPES; ++i) {
|
||||||
|
assert(tag_item_names[i] != nullptr);
|
||||||
|
|
||||||
|
if (strcmp(name, tag_item_names[i]) == 0)
|
||||||
|
return (TagType)i;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TAG_NUM_OF_ITEM_TYPES;
|
||||||
|
}
|
||||||
|
|
||||||
|
TagType
|
||||||
|
tag_name_parse_i(const char *name)
|
||||||
|
{
|
||||||
|
assert(name != nullptr);
|
||||||
|
|
||||||
|
for (unsigned i = 0; i < TAG_NUM_OF_ITEM_TYPES; ++i) {
|
||||||
|
assert(tag_item_names[i] != nullptr);
|
||||||
|
|
||||||
|
if (StringEqualsCaseASCII(name, tag_item_names[i]))
|
||||||
|
return (TagType)i;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TAG_NUM_OF_ITEM_TYPES;
|
||||||
|
}
|
44
src/tag/ParseName.hxx
Normal file
44
src/tag/ParseName.hxx
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2003-2017 The Music Player Daemon Project
|
||||||
|
* http://www.musicpd.org
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MPD_TAG_PARSE_NAME_HXX
|
||||||
|
#define MPD_TAG_PARSE_NAME_HXX
|
||||||
|
|
||||||
|
#include "Type.h"
|
||||||
|
#include "Compiler.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse the string, and convert it into a #TagType. Returns
|
||||||
|
* #TAG_NUM_OF_ITEM_TYPES if the string could not be recognized.
|
||||||
|
*/
|
||||||
|
gcc_pure
|
||||||
|
TagType
|
||||||
|
tag_name_parse(const char *name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse the string, and convert it into a #TagType. Returns
|
||||||
|
* #TAG_NUM_OF_ITEM_TYPES if the string could not be recognized.
|
||||||
|
*
|
||||||
|
* Case does not matter.
|
||||||
|
*/
|
||||||
|
gcc_pure
|
||||||
|
TagType
|
||||||
|
tag_name_parse_i(const char *name);
|
||||||
|
|
||||||
|
#endif
|
@ -21,40 +21,8 @@
|
|||||||
#include "Tag.hxx"
|
#include "Tag.hxx"
|
||||||
#include "Pool.hxx"
|
#include "Pool.hxx"
|
||||||
#include "Builder.hxx"
|
#include "Builder.hxx"
|
||||||
#include "util/ASCII.hxx"
|
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
TagType
|
|
||||||
tag_name_parse(const char *name)
|
|
||||||
{
|
|
||||||
assert(name != nullptr);
|
|
||||||
|
|
||||||
for (unsigned i = 0; i < TAG_NUM_OF_ITEM_TYPES; ++i) {
|
|
||||||
assert(tag_item_names[i] != nullptr);
|
|
||||||
|
|
||||||
if (strcmp(name, tag_item_names[i]) == 0)
|
|
||||||
return (TagType)i;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TAG_NUM_OF_ITEM_TYPES;
|
|
||||||
}
|
|
||||||
|
|
||||||
TagType
|
|
||||||
tag_name_parse_i(const char *name)
|
|
||||||
{
|
|
||||||
assert(name != nullptr);
|
|
||||||
|
|
||||||
for (unsigned i = 0; i < TAG_NUM_OF_ITEM_TYPES; ++i) {
|
|
||||||
assert(tag_item_names[i] != nullptr);
|
|
||||||
|
|
||||||
if (StringEqualsCaseASCII(name, tag_item_names[i]))
|
|
||||||
return (TagType)i;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TAG_NUM_OF_ITEM_TYPES;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Tag::Clear()
|
Tag::Clear()
|
||||||
|
@ -196,22 +196,4 @@ struct Tag {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Parse the string, and convert it into a #TagType. Returns
|
|
||||||
* #TAG_NUM_OF_ITEM_TYPES if the string could not be recognized.
|
|
||||||
*/
|
|
||||||
gcc_pure
|
|
||||||
TagType
|
|
||||||
tag_name_parse(const char *name);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parse the string, and convert it into a #TagType. Returns
|
|
||||||
* #TAG_NUM_OF_ITEM_TYPES if the string could not be recognized.
|
|
||||||
*
|
|
||||||
* Case does not matter.
|
|
||||||
*/
|
|
||||||
gcc_pure
|
|
||||||
TagType
|
|
||||||
tag_name_parse_i(const char *name);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user