32 void input(
const std::string &value);
34 void output(
const std::string &value);
120 explicit SubstituteFilter(
const std::initializer_list<Substitution> &substitutions);
153 explicit MapFilter(
const std::initializer_list<Substitution> &mappings);
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.
AppendFilter(std::string suffix)
optional< std::string > new_value(std::string value) override
Apply a filter to text sensor values such as to_upper.
void output(const std::string &value)
void input(const std::string &value)
virtual void initialize(TextSensor *parent, Filter *next)
Initialize this filter, please note this can be called more than once.
virtual optional< std::string > new_value(std::string value)=0
This will be called every time the filter receives a new value.
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)
optional< std::string > new_value(std::string value) override
const lambda_filter_t & get_lambda_filter() const
A filter that maps values from one set to another.
optional< std::string > 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.
PrependFilter(std::string prefix)
optional< std::string > new_value(std::string value) override
Optimized lambda filter for stateless lambdas (no capture).
optional< std::string >(* lambda_filter_)(std::string)
StatelessLambdaFilter(optional< std::string >(*lambda_filter)(std::string))
optional< std::string > new_value(std::string value) override
A simple filter that replaces a substring with another substring.
FixedVector< Substitution > substitutions_
SubstituteFilter(const std::initializer_list< Substitution > &substitutions)
optional< std::string > new_value(std::string value) override
A simple filter that converts all text to lowercase.
optional< std::string > new_value(std::string value) override
A simple filter that converts all text to uppercase.
optional< std::string > 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.