11 namespace text_sensor {
36 void input(
const std::string &value);
38 void output(
const std::string &value);
104 SubstituteFilter(std::vector<std::string> from_strings, std::vector<std::string> to_strings)
105 : from_strings_(
std::move(from_strings)), to_strings_(
std::move(to_strings)) {}
116 MapFilter(std::map<std::string, std::string> mappings) : mappings_(
std::move(mappings)) {}
A simple filter that adds a string to the start of another string.
This class allows for creation of simple template filters.
void input(const std::string &value)
MapFilter(std::map< std::string, std::string > mappings)
std::vector< std::string > from_strings_
lambda_filter_t lambda_filter_
virtual optional< std::string > new_value(std::string value)=0
This will be called every time the filter receives a new value.
std::function< optional< std::string >(std::string)> lambda_filter_t
A filter that maps values from one set to another.
std::vector< std::string > to_strings_
std::map< std::string, std::string > mappings_
A simple filter that adds a string to the end of another string.
virtual void initialize(TextSensor *parent, Filter *next)
Initialize this filter, please note this can be called more than once.
AppendFilter(std::string suffix)
PrependFilter(std::string prefix)
void output(const std::string &value)
Implementation of SPI Controller mode.
A simple filter that converts all text to lowercase.
A simple filter that replaces a substring with another substring.
Apply a filter to text sensor values such as to_upper.
A simple filter that converts all text to uppercase.
SubstituteFilter(std::vector< std::string > from_strings, std::vector< std::string > to_strings)