whitespace and clang-format cleanup

This commit is contained in:
Alexander 'Leo' Bergolth 2024-06-27 21:58:56 +02:00
parent 637cc3ac6b
commit 6e5ecf72ac
3 changed files with 7 additions and 9 deletions

View file

@ -15,8 +15,7 @@ ListEntitiesIterator::ListEntitiesIterator(WebServer *web_server) : web_server_(
bool ListEntitiesIterator::on_binary_sensor(binary_sensor::BinarySensor *binary_sensor) {
if (!this->has_connected_client())
return true;
return this->process(
this->web_server_->binary_sensor_json(binary_sensor, binary_sensor->state, DETAIL_ALL));
return this->process(this->web_server_->binary_sensor_json(binary_sensor, binary_sensor->state, DETAIL_ALL));
}
#endif
#ifdef USE_COVER
@ -65,8 +64,7 @@ bool ListEntitiesIterator::on_button(button::Button *button) {
bool ListEntitiesIterator::on_text_sensor(text_sensor::TextSensor *text_sensor) {
if (!this->has_connected_client())
return true;
return this->process(
this->web_server_->text_sensor_json(text_sensor, text_sensor->state, DETAIL_ALL));
return this->process(this->web_server_->text_sensor_json(text_sensor, text_sensor->state, DETAIL_ALL));
}
#endif
#ifdef USE_LOCK
@ -145,8 +143,8 @@ bool ListEntitiesIterator::on_select(select::Select *select) {
bool ListEntitiesIterator::on_alarm_control_panel(alarm_control_panel::AlarmControlPanel *a_alarm_control_panel) {
if (!this->has_connected_client())
return true;
return this->process(
this->web_server_->alarm_control_panel_json(a_alarm_control_panel, a_alarm_control_panel->get_state(), DETAIL_ALL));
return this->process(this->web_server_->alarm_control_panel_json(a_alarm_control_panel,
a_alarm_control_panel->get_state(), DETAIL_ALL));
}
#endif
@ -155,7 +153,7 @@ bool ListEntitiesIterator::on_event(event::Event *event) {
// Null event type, since we are just iterating over entities
const std::string null_event_type = "";
if (!this->has_connected_client())
return true;
return true;
return this->process(this->web_server_->event_json(event, null_event_type, DETAIL_ALL));
}
#endif

View file

@ -9,7 +9,7 @@ namespace esphome {
namespace web_server {
StatesIterator::StatesIterator(WebServer *web_server) : ListEntitiesIterator::ListEntitiesIterator(web_server) {}
bool StatesIterator::has_connected_client() { return true; }
bool StatesIterator::process(const std::string &s) {

View file

@ -21,7 +21,7 @@ class StatesIterator : public ListEntitiesIterator {
protected:
// WebServer *web_server_;
optional<std::string> str_;
bool has_connected_client() override;
bool process(const std::string &s) override;
};