db/Helpers: move code to CheckUniqueTag()
This commit is contained in:
parent
3965b490a9
commit
986dd2fac1
|
@ -39,20 +39,26 @@ struct StringLess {
|
||||||
typedef std::set<const char *, StringLess> StringSet;
|
typedef std::set<const char *, StringLess> StringSet;
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
CollectTags(StringSet &set, TagType tag_type, const LightSong &song)
|
CheckUniqueTag(StringSet &set, const Tag &tag, TagType type)
|
||||||
{
|
{
|
||||||
assert(song.tag != nullptr);
|
|
||||||
const Tag &tag = *song.tag;
|
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for (unsigned i = 0; i < tag.num_items; ++i) {
|
for (unsigned i = 0; i < tag.num_items; ++i) {
|
||||||
if (tag.items[i]->type == tag_type) {
|
if (tag.items[i]->type == type) {
|
||||||
set.insert(tag.items[i]->value);
|
set.insert(tag.items[i]->value);
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found)
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
CollectTags(StringSet &set, TagType tag_type, const LightSong &song)
|
||||||
|
{
|
||||||
|
assert(song.tag != nullptr);
|
||||||
|
const Tag &tag = *song.tag;
|
||||||
|
|
||||||
|
if (!CheckUniqueTag(set, tag, tag_type))
|
||||||
set.insert("");
|
set.insert("");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue