31 void input(std::string value);
33 void output(std::string &value);
54 bool new_value(std::string &value)
override;
74 if (result.has_value()) {
75 value = std::move(*result);
88 bool new_value(std::string &value)
override;
94 bool new_value(std::string &value)
override;
101 bool new_value(std::string &value)
override;
111 bool new_value(std::string &value)
override;
125 explicit SubstituteFilter(
const std::initializer_list<Substitution> &substitutions);
126 bool new_value(std::string &value)
override;
158 explicit MapFilter(
const std::initializer_list<Substitution> &mappings);
159 bool new_value(std::string &value)
override;
Fixed-capacity vector - allocates once at runtime, never reallocates This avoids std::vector template...
A simple filter that adds a string to the end of another string.
bool new_value(std::string &value) override
AppendFilter(const char *suffix)
Apply a filter to text sensor values such as to_upper.
virtual bool new_value(std::string &value)=0
This will be called every time the filter receives a new value.
void output(std::string &value)
void input(std::string value)
virtual void initialize(TextSensor *parent, Filter *next)
Initialize this filter, please note this can be called more than once.
This class allows for creation of simple template filters.
lambda_filter_t lambda_filter_
LambdaFilter(lambda_filter_t lambda_filter)
void set_lambda_filter(const lambda_filter_t &lambda_filter)
bool new_value(std::string &value) override
const lambda_filter_t & get_lambda_filter() const
A filter that maps values from one set to another.
bool new_value(std::string &value) override
MapFilter(const std::initializer_list< Substitution > &mappings)
FixedVector< Substitution > mappings_
A simple filter that adds a string to the start of another string.
bool new_value(std::string &value) override
PrependFilter(const char *prefix)
Optimized lambda filter for stateless lambdas (no capture).
optional< std::string >(* lambda_filter_)(std::string)
StatelessLambdaFilter(optional< std::string >(*lambda_filter)(std::string))
bool new_value(std::string &value) override
A simple filter that replaces a substring with another substring.
FixedVector< Substitution > substitutions_
bool new_value(std::string &value) override
SubstituteFilter(const std::initializer_list< Substitution > &substitutions)
A simple filter that converts all text to lowercase.
bool new_value(std::string &value) override
A simple filter that converts all text to uppercase.
bool new_value(std::string &value) override
std::function< optional< std::string >(std::string)> lambda_filter_t
Providing packet encoding functions for exchanging data with a remote host.