ESPHome
2023.11.6
|
This class allows for creation of simple template filters. More...
#include <filter.h>
Public Member Functions | |
LambdaFilter (lambda_filter_t lambda_filter) | |
optional< std::string > | new_value (std::string value) override |
const lambda_filter_t & | get_lambda_filter () const |
void | set_lambda_filter (const lambda_filter_t &lambda_filter) |
![]() | |
virtual void | initialize (TextSensor *parent, Filter *next) |
Initialize this filter, please note this can be called more than once. More... | |
void | input (const std::string &value) |
void | output (const std::string &value) |
Protected Attributes | |
lambda_filter_t | lambda_filter_ |
![]() | |
friend | TextSensor |
Filter * | next_ {nullptr} |
TextSensor * | parent_ {nullptr} |
This class allows for creation of simple template filters.
The constructor accepts a lambda of the form std::string -> optional<std::string>. It will be called with each new value in the filter chain and returns the modified value that shall be passed down the filter chain. Returning an empty Optional means that the value shall be discarded.
|
explicit |
Definition at line 34 of file filter.cpp.
const lambda_filter_t & esphome::text_sensor::LambdaFilter::get_lambda_filter | ( | ) | const |
Definition at line 35 of file filter.cpp.
|
overridevirtual |
Reimplemented from esphome::text_sensor::Filter.
Definition at line 38 of file filter.cpp.
void esphome::text_sensor::LambdaFilter::set_lambda_filter | ( | const lambda_filter_t & | lambda_filter | ) |
Definition at line 36 of file filter.cpp.
|
protected |