blob: c935f1bddec6dd917fd38a8bb0c492faf3413711 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#ifndef NEWSBOAT_FILTERCONTAINER_H_
#define NEWSBOAT_FILTERCONTAINER_H_
#include "configactionhandler.h"
#include "3rd-party/optional.hpp"
namespace newsboat {
/// Stores the name of the filter and the filter expression that user added via
/// `define-filter` configuration option
struct FilterNameExprPair {
/// Name of the filter
std::string name;
/// Filter expression for this named filter
std::string expr;
};
class FilterContainer : public ConfigActionHandler {
public:
FilterContainer() = default;
~FilterContainer() override;
void handle_action(const std::string& action,
const std::vector<std::string>& params) override;
void dump_config(std::vector<std::string>& config_output) const override;
std::vector<FilterNameExprPair>& get_filters()
{
return filters;
}
unsigned int size()
{
return filters.size();
}
nonstd::optional<std::string> get_filter(const std::string& name);
private:
std::vector<FilterNameExprPair> filters;
};
} // namespace newsboat
#endif /* NEWSBOAT_FILTERCONTAINER_H_ */
|