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:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user