mirror of
https://github.com/esphome/esphome.git
synced 2025-09-08 22:32:21 +01:00
preen
This commit is contained in:
@@ -17,19 +17,6 @@ void ComponentIterator::begin(bool include_internal) {
|
|||||||
this->include_internal_ = include_internal;
|
this->include_internal_ = include_internal;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename PlatformItem>
|
|
||||||
void ComponentIterator::process_platform_item_(const std::vector<PlatformItem *> &items,
|
|
||||||
bool (ComponentIterator::*on_item)(PlatformItem *)) {
|
|
||||||
if (this->at_ >= items.size()) {
|
|
||||||
this->advance_platform_();
|
|
||||||
} else {
|
|
||||||
PlatformItem *item = items[this->at_];
|
|
||||||
if ((item->is_internal() && !this->include_internal_) || (this->*on_item)(item)) {
|
|
||||||
this->at_++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ComponentIterator::advance_platform_() {
|
void ComponentIterator::advance_platform_() {
|
||||||
this->state_ = static_cast<IteratorState>(static_cast<uint32_t>(this->state_) + 1);
|
this->state_ = static_cast<IteratorState>(static_cast<uint32_t>(this->state_) + 1);
|
||||||
this->at_ = 0;
|
this->at_ = 0;
|
||||||
|
@@ -174,7 +174,17 @@ class ComponentIterator {
|
|||||||
|
|
||||||
template<typename Container>
|
template<typename Container>
|
||||||
void process_platform_item_(const Container &items,
|
void process_platform_item_(const Container &items,
|
||||||
bool (ComponentIterator::*on_item)(typename Container::value_type));
|
bool (ComponentIterator::*on_item)(typename Container::value_type)) {
|
||||||
|
if (this->at_ >= items.size()) {
|
||||||
|
this->advance_platform_();
|
||||||
|
} else {
|
||||||
|
typename Container::value_type item = items[this->at_];
|
||||||
|
if ((item->is_internal() && !this->include_internal_) || (this->*on_item)(item)) {
|
||||||
|
this->at_++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void advance_platform_();
|
void advance_platform_();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user