mirror of
https://github.com/esphome/esphome.git
synced 2026-09-11 23:37:34 +00:00
Merge remote-tracking branch 'upstream/text_sensor_substitute_static_array' into integration
This commit is contained in:
@@ -131,12 +131,7 @@ bool substitute_filter_apply(const Substitution *substitutions, size_t count, st
|
||||
template<size_t N> class SubstituteFilter : public Filter {
|
||||
public:
|
||||
explicit SubstituteFilter(const std::initializer_list<Substitution> &substitutions) {
|
||||
size_t i = 0;
|
||||
for (const auto &s : substitutions) {
|
||||
if (i >= N)
|
||||
break;
|
||||
this->substitutions_[i++] = s;
|
||||
}
|
||||
init_array_from(this->substitutions_, substitutions);
|
||||
}
|
||||
bool new_value(std::string &value) override { return substitute_filter_apply(this->substitutions_.data(), N, value); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user