filter/Chain: eliminate, just use a chain of TwoFilters instead

The ChainFilter class is extremely complicated code, and will grow to
be even more complicated when the Filter interface gets extended.
Let's just remove it; we can easily chain many TwoFilters instead.
This commit is contained in:
Max Kellermann
2021-08-26 17:15:48 +02:00
parent bd79354f32
commit 9ca64d5fb3
7 changed files with 28 additions and 263 deletions
+10 -8
View File
@@ -21,27 +21,29 @@
#include "Factory.hxx"
#include "Prepared.hxx"
#include "plugins/AutoConvertFilterPlugin.hxx"
#include "plugins/ChainFilterPlugin.hxx"
#include "plugins/TwoFilters.hxx"
#include "util/IterableSplitString.hxx"
#include <string>
static void
filter_chain_append_new(PreparedFilter &chain, FilterFactory &factory,
filter_chain_append_new(std::unique_ptr<PreparedFilter> &chain,
FilterFactory &factory,
std::string_view template_name)
{
/* using the AutoConvert filter just in case the specified
filter plugin does not support the exact input format */
filter_chain_append(chain, template_name,
/* unfortunately, MakeFilter() wants a
null-terminated string, so we need to
copy it here */
autoconvert_filter_new(factory.MakeFilter(std::string(template_name).c_str())));
chain = ChainFilters(std::move(chain),
/* unfortunately, MakeFilter() wants a
null-terminated string, so we need to
copy it here */
autoconvert_filter_new(factory.MakeFilter(std::string(template_name).c_str())),
template_name);
}
void
filter_chain_parse(PreparedFilter &chain,
filter_chain_parse(std::unique_ptr<PreparedFilter> &chain,
FilterFactory &factory,
const char *spec)
{