From 5dfd0b0db7808f72b7eefa87361733f2391b4b9d Mon Sep 17 00:00:00 2001 From: William Emfinger Date: Tue, 13 Feb 2024 16:30:01 -0600 Subject: [PATCH] style: re-run new clang format on all files (#153) --- components/cli/include/cli.hpp | 4 +- components/color/src/color.cpp | 26 ++++-- .../display_drivers/example/main/gui.hpp | 3 +- .../event_manager/src/event_manager.cpp | 7 +- .../filters/include/transfer_function.hpp | 4 +- components/i2c/example/main/i2c_menu.hpp | 3 +- components/math/include/bezier.hpp | 7 +- components/math/include/gaussian.hpp | 4 +- components/math/include/vector2d.hpp | 8 +- components/rtsp/include/jpeg_frame.hpp | 3 +- components/rtsp/include/jpeg_header.hpp | 8 +- components/rtsp/include/rtp_jpeg_packet.hpp | 23 ++++- components/rtsp/include/rtp_packet.hpp | 25 ++++- components/socket/include/tcp_socket.hpp | 4 +- .../example/main/Complex_generated_states.hpp | 91 ++++++++++++------- .../include/deep_history_state.hpp | 6 +- .../include/shallow_history_state.hpp | 6 +- .../state_machine/include/state_base.hpp | 8 +- 18 files changed, 170 insertions(+), 70 deletions(-) diff --git a/components/cli/include/cli.hpp b/components/cli/include/cli.hpp index e1ac48f78..c2b11e287 100644 --- a/components/cli/include/cli.hpp +++ b/components/cli/include/cli.hpp @@ -115,7 +115,9 @@ class Cli : private cli::CliSession { * @param _out The output stream to which to write characters. */ explicit Cli(cli::Cli &_cli, std::istream &_in = std::cin, std::ostream &_out = std::cout) - : CliSession(_cli, _out, 1), exit(false), in(_in) { + : CliSession(_cli, _out, 1) + , exit(false) + , in(_in) { if (!_in.good()) throw std::invalid_argument("istream invalid"); if (!_out.good()) diff --git a/components/color/src/color.cpp b/components/color/src/color.cpp index de81ffab7..9e20a21ce 100644 --- a/components/color/src/color.cpp +++ b/components/color/src/color.cpp @@ -2,7 +2,10 @@ namespace espp { -Rgb::Rgb(const float &_r, const float &_g, const float &_b) : r(_r), g(_g), b(_b) { +Rgb::Rgb(const float &_r, const float &_g, const float &_b) + : r(_r) + , g(_g) + , b(_b) { if (r > 1.0 || g > 1.0 || b > 1.0) { r /= 255.; g /= 255.; @@ -13,9 +16,13 @@ Rgb::Rgb(const float &_r, const float &_g, const float &_b) : r(_r), g(_g), b(_b b = std::clamp(b, 0.0f, 1.0f); } -Rgb::Rgb(const Rgb &rgb) : r(rgb.r), g(rgb.g), b(rgb.b) {} +Rgb::Rgb(const Rgb &rgb) + : r(rgb.r) + , g(rgb.g) + , b(rgb.b) {} -Rgb::Rgb(const Hsv &hsv) : Rgb(hsv.rgb()) {} +Rgb::Rgb(const Hsv &hsv) + : Rgb(hsv.rgb()) {} Rgb Rgb::operator+(const Rgb &rhs) const { // divide by number of elements that went into it (blending) instead of just @@ -71,15 +78,22 @@ Hsv Rgb::hsv() const { return HSV; } -Hsv::Hsv(const float &_h, const float &_s, const float &_v) : h(_h), s(_s), v(_v) { +Hsv::Hsv(const float &_h, const float &_s, const float &_v) + : h(_h) + , s(_s) + , v(_v) { h = std::clamp(h, 0.0f, 360.0f); s = std::clamp(s, 0.0f, 1.0f); v = std::clamp(v, 0.0f, 1.0f); } -Hsv::Hsv(const Hsv &hsv) : h(hsv.h), s(hsv.s), v(hsv.v) {} +Hsv::Hsv(const Hsv &hsv) + : h(hsv.h) + , s(hsv.s) + , v(hsv.v) {} -Hsv::Hsv(const Rgb &rgb) : Hsv(rgb.hsv()) {} +Hsv::Hsv(const Rgb &rgb) + : Hsv(rgb.hsv()) {} Rgb Hsv::rgb() const { Rgb RGB; diff --git a/components/display_drivers/example/main/gui.hpp b/components/display_drivers/example/main/gui.hpp index 2999ef83a..7c2087a2f 100644 --- a/components/display_drivers/example/main/gui.hpp +++ b/components/display_drivers/example/main/gui.hpp @@ -15,7 +15,8 @@ class Gui { }; explicit Gui(const Config &config) - : display_(config.display), logger_({.tag = "Gui", .level = config.log_level}) { + : display_(config.display) + , logger_({.tag = "Gui", .level = config.log_level}) { init_ui(); // now start the gui updater task using namespace std::placeholders; diff --git a/components/event_manager/src/event_manager.cpp b/components/event_manager/src/event_manager.cpp index 2e9e90dd3..944ef6500 100644 --- a/components/event_manager/src/event_manager.cpp +++ b/components/event_manager/src/event_manager.cpp @@ -129,8 +129,9 @@ bool EventManager::remove_subscriber(const std::string &topic, const std::string auto elem = std::find(std::begin(topic_subscribers), std::end(topic_subscribers), component); bool exists = elem != std::end(topic_subscribers); if (!exists) { - logger_.warn("Cannot remove subscriber, '{}' is not registered as a subscriber for topic '{}'", - component, topic); + logger_.warn( + "Cannot remove subscriber, '{}' is not registered as a subscriber for topic '{}'", + component, topic); // component is not registered as a subscriber, so return false return false; } @@ -141,7 +142,7 @@ bool EventManager::remove_subscriber(const std::string &topic, const std::string // remove from `subscriber_callbacks_` { std::lock_guard lk(callbacks_mutex_); - auto& callbacks = subscriber_callbacks_[topic]; + auto &callbacks = subscriber_callbacks_[topic]; auto is_component = [&component](std::pair &e) { return std::get<0>(e) == component; diff --git a/components/filters/include/transfer_function.hpp b/components/filters/include/transfer_function.hpp index 9c42d0d6f..7d72fba56 100644 --- a/components/filters/include/transfer_function.hpp +++ b/components/filters/include/transfer_function.hpp @@ -10,7 +10,9 @@ namespace espp { template struct TransferFunction { TransferFunction() = default; - TransferFunction(const std::array &b, const std::array &a) : b(b), a(a) {} + TransferFunction(const std::array &b, const std::array &a) + : b(b) + , a(a) {} std::array b = {}; /**< B coefficients. */ std::array a = {}; /**< A coefficients. */ diff --git a/components/i2c/example/main/i2c_menu.hpp b/components/i2c/example/main/i2c_menu.hpp index 4314d5080..a8d310350 100644 --- a/components/i2c/example/main/i2c_menu.hpp +++ b/components/i2c/example/main/i2c_menu.hpp @@ -10,7 +10,8 @@ class I2cMenu { public: - explicit I2cMenu(std::reference_wrapper i2c) : i2c_(i2c) {} + explicit I2cMenu(std::reference_wrapper i2c) + : i2c_(i2c) {} std::unique_ptr get(std::string_view name = "i2c", std::string_view description = "I2c menu") { diff --git a/components/math/include/bezier.hpp b/components/math/include/bezier.hpp index a87a43f33..68e4b2002 100644 --- a/components/math/include/bezier.hpp +++ b/components/math/include/bezier.hpp @@ -35,7 +35,8 @@ template class Bezier { * @param config Unweighted Config structure containing the control points. */ explicit Bezier(const Config &config) - : weighted_(false), control_points_(config.control_points) {} + : weighted_(false) + , control_points_(config.control_points) {} /** * @brief Construct a rational / weighted cubic bezier curve for evaluation. @@ -43,7 +44,9 @@ template class Bezier { * control points and their weights. */ explicit Bezier(const WeightedConfig &config) - : weighted_(true), control_points_(config.control_points), weights_(config.weights) {} + : weighted_(true) + , control_points_(config.control_points) + , weights_(config.weights) {} /** * @brief Evaluate the bezier at \p t. diff --git a/components/math/include/gaussian.hpp b/components/math/include/gaussian.hpp index 04cfe7ddc..3e96810f7 100644 --- a/components/math/include/gaussian.hpp +++ b/components/math/include/gaussian.hpp @@ -27,7 +27,9 @@ class Gaussian { * @param config Config structure for the gaussian. */ explicit Gaussian(const Config &config) - : gamma_(config.gamma), alpha_(config.alpha), beta_(config.beta) {} + : gamma_(config.gamma) + , alpha_(config.alpha) + , beta_(config.beta) {} /** * @brief Get the currently configured gamma (shape). diff --git a/components/math/include/vector2d.hpp b/components/math/include/vector2d.hpp index b7b32d0fe..6a765d4c8 100644 --- a/components/math/include/vector2d.hpp +++ b/components/math/include/vector2d.hpp @@ -17,13 +17,17 @@ template class Vector2d { * @param x The starting X value. * @param y The starting Y value. */ - explicit Vector2d(T x = T(0), T y = T(0)) : x_(x), y_(y) {} + explicit Vector2d(T x = T(0), T y = T(0)) + : x_(x) + , y_(y) {} /** * @brief Vector copy constructor. * @param other Vector to copy. */ - Vector2d(const Vector2d &other) : x_(other.x_), y_(other.y_) {} + Vector2d(const Vector2d &other) + : x_(other.x_) + , y_(other.y_) {} /** * @brief Assignment operator diff --git a/components/rtsp/include/jpeg_frame.hpp b/components/rtsp/include/jpeg_frame.hpp index 8cc4caf34..f898387db 100644 --- a/components/rtsp/include/jpeg_frame.hpp +++ b/components/rtsp/include/jpeg_frame.hpp @@ -29,7 +29,8 @@ class JpegFrame { /// @param data The buffer containing the jpeg data. /// @param size The size of the buffer. explicit JpegFrame(const char *data, size_t size) - : data_(data, data + size), header_(std::string_view((const char *)data_.data(), size)) {} + : data_(data, data + size) + , header_(std::string_view((const char *)data_.data(), size)) {} /// Get a reference to the header. /// @return A reference to the header. diff --git a/components/rtsp/include/jpeg_header.hpp b/components/rtsp/include/jpeg_header.hpp index 4f0a97b6b..1e85346b1 100644 --- a/components/rtsp/include/jpeg_header.hpp +++ b/components/rtsp/include/jpeg_header.hpp @@ -17,12 +17,16 @@ class JpegHeader { /// @param q0_table The quantization table for the Y channel. /// @param q1_table The quantization table for the Cb and Cr channels. explicit JpegHeader(int width, int height, std::string_view q0_table, std::string_view q1_table) - : width_(width), height_(height), q0_table_(q0_table), q1_table_(q1_table) { + : width_(width) + , height_(height) + , q0_table_(q0_table) + , q1_table_(q1_table) { serialize(); } /// Create a JPEG header from a given JPEG header data. - explicit JpegHeader(std::string_view data) : data_(data.data(), data.data() + data.size()) { + explicit JpegHeader(std::string_view data) + : data_(data.data(), data.data() + data.size()) { parse(); } diff --git a/components/rtsp/include/rtp_jpeg_packet.hpp b/components/rtsp/include/rtp_jpeg_packet.hpp index c234ad353..4d7b89be7 100644 --- a/components/rtsp/include/rtp_jpeg_packet.hpp +++ b/components/rtsp/include/rtp_jpeg_packet.hpp @@ -9,7 +9,10 @@ class RtpJpegPacket : public RtpPacket { public: /// Construct an RTP packet from a buffer. /// @param data The buffer containing the RTP packet. - explicit RtpJpegPacket(std::string_view data) : RtpPacket(data) { parse_mjpeg_header(); } + explicit RtpJpegPacket(std::string_view data) + : RtpPacket(data) { + parse_mjpeg_header(); + } /// Construct an RTP packet from fields /// @details This will construct a packet with quantization tables, so it @@ -25,8 +28,13 @@ class RtpJpegPacket : public RtpPacket { explicit RtpJpegPacket(const int type_specific, const int frag_type, const int q, const int width, const int height, std::string_view q0, std::string_view q1, std::string_view scan_data) - : RtpPacket(PAYLOAD_OFFSET_WITH_QUANT + scan_data.size()), type_specific_(type_specific), - offset_(0), frag_type_(frag_type), q_(q), width_(width), height_(height) { + : RtpPacket(PAYLOAD_OFFSET_WITH_QUANT + scan_data.size()) + , type_specific_(type_specific) + , offset_(0) + , frag_type_(frag_type) + , q_(q) + , width_(width) + , height_(height) { jpeg_data_start_ = PAYLOAD_OFFSET_WITH_QUANT; jpeg_data_size_ = scan_data.size(); @@ -51,8 +59,13 @@ class RtpJpegPacket : public RtpPacket { /// @param scan_data The scan data. explicit RtpJpegPacket(const int type_specific, const int offset, const int frag_type, const int q, const int width, const int height, std::string_view scan_data) - : RtpPacket(PAYLOAD_OFFSET_NO_QUANT + scan_data.size()), type_specific_(type_specific), - offset_(offset), frag_type_(frag_type), q_(q), width_(width), height_(height) { + : RtpPacket(PAYLOAD_OFFSET_NO_QUANT + scan_data.size()) + , type_specific_(type_specific) + , offset_(offset) + , frag_type_(frag_type) + , q_(q) + , width_(width) + , height_(height) { jpeg_data_start_ = PAYLOAD_OFFSET_NO_QUANT; jpeg_data_size_ = scan_data.size(); diff --git a/components/rtsp/include/rtp_packet.hpp b/components/rtsp/include/rtp_packet.hpp index 818cdb70c..8e9a123fd 100644 --- a/components/rtsp/include/rtp_packet.hpp +++ b/components/rtsp/include/rtp_packet.hpp @@ -11,17 +11,32 @@ class RtpPacket { /// Construct an empty RtpPacket. /// The packet_ vector is empty and the header fields are set to 0. RtpPacket() - : version_(2), padding_(false), extension_(false), csrc_count_(0), marker_(false), - payload_type_(0), sequence_number_(0), timestamp_(0), ssrc_(0), payload_size_(0) { + : version_(2) + , padding_(false) + , extension_(false) + , csrc_count_(0) + , marker_(false) + , payload_type_(0) + , sequence_number_(0) + , timestamp_(0) + , ssrc_(0) + , payload_size_(0) { // ensure that the packet_ vector is at least RTP_HEADER_SIZE bytes long packet_.resize(RTP_HEADER_SIZE); } /// Construct an RtpPacket with a payload of size payload_size. explicit RtpPacket(size_t payload_size) - : version_(2), padding_(false), extension_(false), csrc_count_(0), marker_(false), - payload_type_(0), sequence_number_(0), timestamp_(0), ssrc_(0), - payload_size_(payload_size) { + : version_(2) + , padding_(false) + , extension_(false) + , csrc_count_(0) + , marker_(false) + , payload_type_(0) + , sequence_number_(0) + , timestamp_(0) + , ssrc_(0) + , payload_size_(payload_size) { // ensure that the packet_ vector is at least RTP_HEADER_SIZE + payload_size bytes long packet_.resize(RTP_HEADER_SIZE + payload_size); } diff --git a/components/socket/include/tcp_socket.hpp b/components/socket/include/tcp_socket.hpp index 5390d0f3c..bb956f551 100644 --- a/components/socket/include/tcp_socket.hpp +++ b/components/socket/include/tcp_socket.hpp @@ -373,8 +373,8 @@ class TcpSocket : public Socket { * @param remote_info The remote endpoint info. */ explicit TcpSocket(int socket_fd, const Socket::Info &remote_info) - : Socket(socket_fd, Logger::Config{.tag = "TcpSocket", .level = Logger::Verbosity::WARN}), - remote_info_(remote_info) { + : Socket(socket_fd, Logger::Config{.tag = "TcpSocket", .level = Logger::Verbosity::WARN}) + , remote_info_(remote_info) { connected_ = true; set_keepalive(); } diff --git a/components/state_machine/example/main/Complex_generated_states.hpp b/components/state_machine/example/main/Complex_generated_states.hpp index 0457989b2..f0ce378c7 100644 --- a/components/state_machine/example/main/Complex_generated_states.hpp +++ b/components/state_machine/example/main/Complex_generated_states.hpp @@ -38,7 +38,8 @@ class GeneratedEventBase : public EventBase { EventType type; public: - explicit GeneratedEventBase(const EventType &t) : type(t) {} + explicit GeneratedEventBase(const EventType &t) + : type(t) {} virtual ~GeneratedEventBase() {} EventType get_type() const { return type; } virtual std::string to_string() const { return std::string(magic_enum::enum_name(type)); } @@ -53,7 +54,9 @@ template class Event : public GeneratedEventBase { T data; public: - explicit Event(const EventType &t, const T &d) : GeneratedEventBase(t), data(d) {} + explicit Event(const EventType &t, const T &d) + : GeneratedEventBase(t) + , data(d) {} virtual ~Event() {} T get_data() const { return data; } }; // Class Event @@ -232,23 +235,26 @@ class Root : public StateBase { // Constructors Root() - : StateBase(), COMPLEX_OBJ__STATE_1_OBJ(this, this), - COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE_OBJ(this, &COMPLEX_OBJ__STATE_2_OBJ), - COMPLEX_OBJ__STATE_2_OBJ__DEEP_HISTORY_PSEUDOSTATE_OBJ(&COMPLEX_OBJ__STATE_2_OBJ), - COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE2_OBJ(this, &COMPLEX_OBJ__STATE_2_OBJ), - COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE3_OBJ__GRAND_OBJ( - this, &COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE3_OBJ), - COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE3_OBJ__GRAND2_OBJ( - this, &COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE3_OBJ), - COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE3_OBJ(this, &COMPLEX_OBJ__STATE_2_OBJ), - COMPLEX_OBJ__STATE_2_OBJ__SHALLOW_HISTORY_PSEUDOSTATE_OBJ(&COMPLEX_OBJ__STATE_2_OBJ), - COMPLEX_OBJ__STATE_2_OBJ(this, this), - COMPLEX_OBJ__STATE3_OBJ__CHILDSTATE2_OBJ(this, &COMPLEX_OBJ__STATE3_OBJ), - COMPLEX_OBJ__STATE3_OBJ__SHALLOW_HISTORY_PSEUDOSTATE_OBJ(&COMPLEX_OBJ__STATE3_OBJ), - COMPLEX_OBJ__STATE3_OBJ__DEEP_HISTORY_PSEUDOSTATE_OBJ(&COMPLEX_OBJ__STATE3_OBJ), - COMPLEX_OBJ__STATE3_OBJ__CHILDSTATE_OBJ(this, &COMPLEX_OBJ__STATE3_OBJ), - COMPLEX_OBJ__STATE3_OBJ__CHILDSTATE3_OBJ(this, &COMPLEX_OBJ__STATE3_OBJ), - COMPLEX_OBJ__STATE3_OBJ(this, this), COMPLEX_OBJ__END_STATE_OBJ(this), _root(this) {} + : StateBase() + , COMPLEX_OBJ__STATE_1_OBJ(this, this) + , COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE_OBJ(this, &COMPLEX_OBJ__STATE_2_OBJ) + , COMPLEX_OBJ__STATE_2_OBJ__DEEP_HISTORY_PSEUDOSTATE_OBJ(&COMPLEX_OBJ__STATE_2_OBJ) + , COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE2_OBJ(this, &COMPLEX_OBJ__STATE_2_OBJ) + , COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE3_OBJ__GRAND_OBJ( + this, &COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE3_OBJ) + , COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE3_OBJ__GRAND2_OBJ( + this, &COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE3_OBJ) + , COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE3_OBJ(this, &COMPLEX_OBJ__STATE_2_OBJ) + , COMPLEX_OBJ__STATE_2_OBJ__SHALLOW_HISTORY_PSEUDOSTATE_OBJ(&COMPLEX_OBJ__STATE_2_OBJ) + , COMPLEX_OBJ__STATE_2_OBJ(this, this) + , COMPLEX_OBJ__STATE3_OBJ__CHILDSTATE2_OBJ(this, &COMPLEX_OBJ__STATE3_OBJ) + , COMPLEX_OBJ__STATE3_OBJ__SHALLOW_HISTORY_PSEUDOSTATE_OBJ(&COMPLEX_OBJ__STATE3_OBJ) + , COMPLEX_OBJ__STATE3_OBJ__DEEP_HISTORY_PSEUDOSTATE_OBJ(&COMPLEX_OBJ__STATE3_OBJ) + , COMPLEX_OBJ__STATE3_OBJ__CHILDSTATE_OBJ(this, &COMPLEX_OBJ__STATE3_OBJ) + , COMPLEX_OBJ__STATE3_OBJ__CHILDSTATE3_OBJ(this, &COMPLEX_OBJ__STATE3_OBJ) + , COMPLEX_OBJ__STATE3_OBJ(this, this) + , COMPLEX_OBJ__END_STATE_OBJ(this) + , _root(this) {} ~Root(void) {} /** @@ -337,7 +343,9 @@ class Root : public StateBase { Root *_root; // Constructors - State_1(Root *root, StateBase *parent) : StateBase(parent), _root(root) {} + State_1(Root *root, StateBase *parent) + : StateBase(parent) + , _root(root) {} ~State_1(void) {} // StateBase Interface @@ -362,7 +370,9 @@ class Root : public StateBase { Root *_root; // Constructors - State_2(Root *root, StateBase *parent) : StateBase(parent), _root(root) {} + State_2(Root *root, StateBase *parent) + : StateBase(parent) + , _root(root) {} ~State_2(void) {} // StateBase Interface @@ -387,7 +397,9 @@ class Root : public StateBase { Root *_root; // Constructors - ChildState(Root *root, StateBase *parent) : StateBase(parent), _root(root) {} + ChildState(Root *root, StateBase *parent) + : StateBase(parent) + , _root(root) {} ~ChildState(void) {} // StateBase Interface @@ -412,7 +424,9 @@ class Root : public StateBase { Root *_root; // Constructors - ChildState2(Root *root, StateBase *parent) : StateBase(parent), _root(root) {} + ChildState2(Root *root, StateBase *parent) + : StateBase(parent) + , _root(root) {} ~ChildState2(void) {} // StateBase Interface @@ -437,7 +451,9 @@ class Root : public StateBase { Root *_root; // Constructors - ChildState3(Root *root, StateBase *parent) : StateBase(parent), _root(root) {} + ChildState3(Root *root, StateBase *parent) + : StateBase(parent) + , _root(root) {} ~ChildState3(void) {} // StateBase Interface @@ -462,7 +478,9 @@ class Root : public StateBase { Root *_root; // Constructors - Grand(Root *root, StateBase *parent) : StateBase(parent), _root(root) {} + Grand(Root *root, StateBase *parent) + : StateBase(parent) + , _root(root) {} ~Grand(void) {} // StateBase Interface @@ -487,7 +505,9 @@ class Root : public StateBase { Root *_root; // Constructors - Grand2(Root *root, StateBase *parent) : StateBase(parent), _root(root) {} + Grand2(Root *root, StateBase *parent) + : StateBase(parent) + , _root(root) {} ~Grand2(void) {} // StateBase Interface @@ -514,7 +534,9 @@ class Root : public StateBase { Root *_root; // Constructors - State3(Root *root, StateBase *parent) : StateBase(parent), _root(root) {} + State3(Root *root, StateBase *parent) + : StateBase(parent) + , _root(root) {} ~State3(void) {} // StateBase Interface @@ -539,7 +561,9 @@ class Root : public StateBase { Root *_root; // Constructors - ChildState2(Root *root, StateBase *parent) : StateBase(parent), _root(root) {} + ChildState2(Root *root, StateBase *parent) + : StateBase(parent) + , _root(root) {} ~ChildState2(void) {} // StateBase Interface @@ -564,7 +588,9 @@ class Root : public StateBase { Root *_root; // Constructors - ChildState(Root *root, StateBase *parent) : StateBase(parent), _root(root) {} + ChildState(Root *root, StateBase *parent) + : StateBase(parent) + , _root(root) {} ~ChildState(void) {} // StateBase Interface @@ -589,7 +615,9 @@ class Root : public StateBase { Root *_root; // Constructors - ChildState3(Root *root, StateBase *parent) : StateBase(parent), _root(root) {} + ChildState3(Root *root, StateBase *parent) + : StateBase(parent) + , _root(root) {} ~ChildState3(void) {} // StateBase Interface @@ -612,7 +640,8 @@ class Root : public StateBase { */ class End_State : public StateBase { public: - explicit End_State(StateBase *parent) : StateBase(parent) {} + explicit End_State(StateBase *parent) + : StateBase(parent) {} void entry(void) {} void exit(void) {} void tick(void) {} diff --git a/components/state_machine/include/deep_history_state.hpp b/components/state_machine/include/deep_history_state.hpp index c766f4cf0..ac31c8b01 100644 --- a/components/state_machine/include/deep_history_state.hpp +++ b/components/state_machine/include/deep_history_state.hpp @@ -11,8 +11,10 @@ namespace espp::state_machine { */ class DeepHistoryState : public StateBase { public: - DeepHistoryState() : StateBase() {} - explicit DeepHistoryState(StateBase *_parent) : StateBase(_parent) {} + DeepHistoryState() + : StateBase() {} + explicit DeepHistoryState(StateBase *_parent) + : StateBase(_parent) {} /** * @brief Calls _parentState->setDeepHistory() diff --git a/components/state_machine/include/shallow_history_state.hpp b/components/state_machine/include/shallow_history_state.hpp index f40145ac2..2e1ecc49d 100644 --- a/components/state_machine/include/shallow_history_state.hpp +++ b/components/state_machine/include/shallow_history_state.hpp @@ -11,8 +11,10 @@ namespace espp::state_machine { */ class ShallowHistoryState : public StateBase { public: - ShallowHistoryState() : StateBase() {} - explicit ShallowHistoryState(StateBase *_parent) : StateBase(_parent) {} + ShallowHistoryState() + : StateBase() {} + explicit ShallowHistoryState(StateBase *_parent) + : StateBase(_parent) {} /** * @brief Calls _parentState->setShallowHistory(). diff --git a/components/state_machine/include/state_base.hpp b/components/state_machine/include/state_base.hpp index 1d81b9469..48c449c3f 100644 --- a/components/state_machine/include/state_base.hpp +++ b/components/state_machine/include/state_base.hpp @@ -26,8 +26,12 @@ class EventBase { */ class StateBase { public: - StateBase() : _activeState(this), _parentState(nullptr) {} - explicit StateBase(StateBase *parent) : _activeState(this), _parentState(parent) {} + StateBase() + : _activeState(this) + , _parentState(nullptr) {} + explicit StateBase(StateBase *parent) + : _activeState(this) + , _parentState(parent) {} virtual ~StateBase(void) {} /**