song/{Tag,Uri}SongFilter: pass `StringFilter&&` to constructor
This commit is contained in:
parent
73b22d82aa
commit
d5e0d49f86
|
@ -93,9 +93,8 @@ SongFilter::SongFilter(TagType tag, const char *value, bool fold_case)
|
||||||
{
|
{
|
||||||
/* for compatibility with MPD 0.20 and older, "fold_case" also
|
/* for compatibility with MPD 0.20 and older, "fold_case" also
|
||||||
switches on "substring" */
|
switches on "substring" */
|
||||||
and_filter.AddItem(std::make_unique<TagSongFilter>(tag, value,
|
and_filter.AddItem(std::make_unique<TagSongFilter>(tag,
|
||||||
fold_case, fold_case,
|
StringFilter(value, fold_case, fold_case, false)));
|
||||||
false));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SongFilter::~SongFilter()
|
SongFilter::~SongFilter()
|
||||||
|
@ -293,19 +292,17 @@ SongFilter::ParseExpression(const char *&s, bool fold_case)
|
||||||
|
|
||||||
s = StripLeft(s + 1);
|
s = StripLeft(s + 1);
|
||||||
|
|
||||||
|
StringFilter string_filter(std::move(value),
|
||||||
|
fold_case, false, negated);
|
||||||
|
|
||||||
if (type == LOCATE_TAG_ANY_TYPE)
|
if (type == LOCATE_TAG_ANY_TYPE)
|
||||||
type = TAG_NUM_OF_ITEM_TYPES;
|
type = TAG_NUM_OF_ITEM_TYPES;
|
||||||
|
|
||||||
if (type == LOCATE_TAG_FILE_TYPE)
|
if (type == LOCATE_TAG_FILE_TYPE)
|
||||||
return std::make_unique<UriSongFilter>(std::move(value),
|
return std::make_unique<UriSongFilter>(std::move(string_filter));
|
||||||
fold_case,
|
|
||||||
false,
|
|
||||||
negated);
|
|
||||||
|
|
||||||
return std::make_unique<TagSongFilter>(TagType(type),
|
return std::make_unique<TagSongFilter>(TagType(type),
|
||||||
std::move(value),
|
std::move(string_filter));
|
||||||
fold_case, false,
|
|
||||||
negated);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,10 +329,10 @@ SongFilter::Parse(const char *tag_string, const char *value, bool fold_case)
|
||||||
case LOCATE_TAG_FILE_TYPE:
|
case LOCATE_TAG_FILE_TYPE:
|
||||||
/* for compatibility with MPD 0.20 and older,
|
/* for compatibility with MPD 0.20 and older,
|
||||||
"fold_case" also switches on "substring" */
|
"fold_case" also switches on "substring" */
|
||||||
and_filter.AddItem(std::make_unique<UriSongFilter>(value,
|
and_filter.AddItem(std::make_unique<UriSongFilter>(StringFilter(value,
|
||||||
fold_case,
|
fold_case,
|
||||||
fold_case,
|
fold_case,
|
||||||
false));
|
false)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -345,10 +342,10 @@ SongFilter::Parse(const char *tag_string, const char *value, bool fold_case)
|
||||||
/* for compatibility with MPD 0.20 and older,
|
/* for compatibility with MPD 0.20 and older,
|
||||||
"fold_case" also switches on "substring" */
|
"fold_case" also switches on "substring" */
|
||||||
and_filter.AddItem(std::make_unique<TagSongFilter>(TagType(tag),
|
and_filter.AddItem(std::make_unique<TagSongFilter>(TagType(tag),
|
||||||
value,
|
StringFilter(value,
|
||||||
fold_case,
|
fold_case,
|
||||||
fold_case,
|
fold_case,
|
||||||
false));
|
false)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,12 +37,8 @@ class TagSongFilter final : public ISongFilter {
|
||||||
StringFilter filter;
|
StringFilter filter;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
template<typename V>
|
TagSongFilter(TagType _type, StringFilter &&_filter) noexcept
|
||||||
TagSongFilter(TagType _type, V &&_value, bool fold_case, bool substring,
|
:type(_type), filter(std::move(_filter)) {}
|
||||||
bool negated)
|
|
||||||
:type(_type),
|
|
||||||
filter(std::forward<V>(_value), fold_case, substring,
|
|
||||||
negated) {}
|
|
||||||
|
|
||||||
TagType GetTagType() const {
|
TagType GetTagType() const {
|
||||||
return type;
|
return type;
|
||||||
|
|
|
@ -27,11 +27,8 @@ class UriSongFilter final : public ISongFilter {
|
||||||
StringFilter filter;
|
StringFilter filter;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
template<typename V>
|
UriSongFilter(StringFilter &&_filter) noexcept
|
||||||
UriSongFilter(V &&_value, bool fold_case, bool substring,
|
:filter(std::move(_filter)) {}
|
||||||
bool negated)
|
|
||||||
:filter(std::forward<V>(_value), fold_case, substring,
|
|
||||||
negated) {}
|
|
||||||
|
|
||||||
const auto &GetValue() const noexcept {
|
const auto &GetValue() const noexcept {
|
||||||
return filter.GetValue();
|
return filter.GetValue();
|
||||||
|
|
Loading…
Reference in New Issue