From a61343e8ec48aa706a026af0b083be85a770ae3b Mon Sep 17 00:00:00 2001 From: Michael Davidson Date: Sun, 17 Dec 2023 22:28:58 +1100 Subject: [PATCH] ... more clang fixes --- esphome/components/display/display.h | 8 ++++---- esphome/components/display/point.h | 4 ++-- .../components/graphical_layout/container_layout_item.h | 9 ++++----- esphome/components/graphical_layout/graphical_layout.cpp | 3 +-- esphome/components/graphical_layout/graphical_layout.h | 4 ++-- esphome/components/graphical_layout/layout_item.h | 3 +-- esphome/components/graphical_layout/text_panel.h | 2 -- 7 files changed, 14 insertions(+), 19 deletions(-) diff --git a/esphome/components/display/display.h b/esphome/components/display/display.h index 7038d3781d..662f7ea60a 100644 --- a/esphome/components/display/display.h +++ b/esphome/components/display/display.h @@ -419,7 +419,7 @@ class Display : public PollingComponent { * @param y The y coordinate of the upper left corner * @param layout The graphical layout to render * - */ + */ void render_layout(int x, int y, graphical_layout::RootLayoutComponent *layout); #endif @@ -516,7 +516,7 @@ class Display : public PollingComponent { * * @param[in] x: x coordinate as the new local. Absolute to the displays underlying 0 * @param[in] y: y coordinate as the new local. Absolute to the displays underlying 0 - */ + */ void set_local_coordinate(int x, int y) { this->local_coordinate_.push_back(Point(x, y)); }; /** Changes the local coordinates to be to be (x_local + x_offset, y_local + y_offset) @@ -525,11 +525,11 @@ class Display : public PollingComponent { * * @param[in] x_offset: x offset from the current local. Relative to the local x * @param[in] y_offset: y offset from the current local. Relative to the local y - */ + */ void set_local_coordinates_relative_to_current(int x_offset, int y_offset); /** Removes the most recent local coordinate system from use - */ + */ void pop_local_coordinates(); /** Gets the current local coordinates in the displays absolute coordinate system diff --git a/esphome/components/display/point.h b/esphome/components/display/point.h index 6ed81d03e7..2bcce1e955 100644 --- a/esphome/components/display/point.h +++ b/esphome/components/display/point.h @@ -10,8 +10,8 @@ class Point { int16_t x; int16_t y; - Point() : x(VALUE_NO_SET), y(VALUE_NO_SET) {}; - inline Point(int16_t x, int16_t y) ALWAYS_INLINE : x(x), y(y) {}; + Point() : x(VALUE_NO_SET), y(VALUE_NO_SET){}; + inline Point(int16_t x, int16_t y) ALWAYS_INLINE : x(x), y(y){}; }; } // namespace display diff --git a/esphome/components/graphical_layout/container_layout_item.h b/esphome/components/graphical_layout/container_layout_item.h index c477e200eb..c6dca3fde9 100644 --- a/esphome/components/graphical_layout/container_layout_item.h +++ b/esphome/components/graphical_layout/container_layout_item.h @@ -6,16 +6,15 @@ namespace esphome { namespace display { class Display; class Rect; -} +} // namespace display namespace graphical_layout { /** The ContainerLayoutItem can be used to derive from when a layout item has children. * It does not define what or how child items get used just that they exist for the item -*/ + */ class ContainerLayoutItem : public LayoutItem { public: - /** Adds an item to this container */ void add_item(LayoutItem *child) { this->children_.push_back(child); } @@ -23,5 +22,5 @@ class ContainerLayoutItem : public LayoutItem { std::vector children_; }; -} -} +} // namespace graphical_layout +} // namespace esphome diff --git a/esphome/components/graphical_layout/graphical_layout.cpp b/esphome/components/graphical_layout/graphical_layout.cpp index b94d085b74..a3c04580b3 100644 --- a/esphome/components/graphical_layout/graphical_layout.cpp +++ b/esphome/components/graphical_layout/graphical_layout.cpp @@ -8,8 +8,7 @@ namespace graphical_layout { static const char *const TAG = "rootlayoutcomponent"; -void RootLayoutComponent::setup() { -} +void RootLayoutComponent::setup() {} void RootLayoutComponent::dump_config() { ESP_LOGCONFIG(TAG, "Graphical Layout"); diff --git a/esphome/components/graphical_layout/graphical_layout.h b/esphome/components/graphical_layout/graphical_layout.h index 41a5801d49..cb4b0a2ec4 100644 --- a/esphome/components/graphical_layout/graphical_layout.h +++ b/esphome/components/graphical_layout/graphical_layout.h @@ -16,7 +16,7 @@ namespace graphical_layout { /** Component used for rendering the layout*/ class RootLayoutComponent : public Component { -public: + public: void setup() override; void dump_config() override; @@ -30,7 +30,7 @@ public: void set_layout_root(LayoutItem *layout) { this->layout_root_ = layout; }; -protected: + protected: LayoutItem *layout_root_{nullptr}; }; diff --git a/esphome/components/graphical_layout/layout_item.h b/esphome/components/graphical_layout/layout_item.h index ce129d1687..68147317bb 100644 --- a/esphome/components/graphical_layout/layout_item.h +++ b/esphome/components/graphical_layout/layout_item.h @@ -4,14 +4,13 @@ namespace esphome { namespace display { class Display; class Rect; -} +} // namespace display namespace graphical_layout { /** LayoutItem is the base from which all items derive from*/ class LayoutItem { public: - /** Measures the item as it would be drawn on the display and returns the bounds for it * * param[in] display: Display that will be used for rendering. May be used to help with calculations diff --git a/esphome/components/graphical_layout/text_panel.h b/esphome/components/graphical_layout/text_panel.h index 6717562959..bf61cf6e8e 100644 --- a/esphome/components/graphical_layout/text_panel.h +++ b/esphome/components/graphical_layout/text_panel.h @@ -3,7 +3,6 @@ #include "esphome/components/graphical_layout/graphical_layout.h" #include "esphome/components/font/font.h" - namespace esphome { namespace graphical_layout { @@ -23,7 +22,6 @@ class TextPanel : public LayoutItem { void set_foreground_color(Color foreground_color) { this->foreground_color_ = foreground_color; }; void set_background_color(Color background_color) { this->background_color_ = background_color; }; - protected: int item_padding_{0}; std::string text_{};