1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-26 20:53:50 +00:00
This commit is contained in:
J. Nick Koston
2025-10-20 13:27:36 -10:00
parent c34a57df7b
commit 6c8c049c08

View File

@@ -62,12 +62,7 @@ optional<std::string> AppendFilter::new_value(std::string value) { return value
optional<std::string> PrependFilter::new_value(std::string value) { return this->prefix_ + value; }
// Substitute
SubstituteFilter::SubstituteFilter(std::initializer_list<Substitution> substitutions) {
this->substitutions_.init(substitutions.size());
for (auto &sub : substitutions) {
this->substitutions_.push_back(std::move(sub));
}
}
SubstituteFilter::SubstituteFilter(std::initializer_list<Substitution> substitutions) : substitutions_(substitutions) {}
optional<std::string> SubstituteFilter::new_value(std::string value) {
std::size_t pos;
@@ -79,12 +74,7 @@ optional<std::string> SubstituteFilter::new_value(std::string value) {
}
// Map
MapFilter::MapFilter(std::initializer_list<Substitution> mappings) {
this->mappings_.init(mappings.size());
for (auto &mapping : mappings) {
this->mappings_.push_back(std::move(mapping));
}
}
MapFilter::MapFilter(std::initializer_list<Substitution> mappings) : mappings_(mappings) {}
optional<std::string> MapFilter::new_value(std::string value) {
for (const auto &mapping : this->mappings_) {