Mark user-configurable classes as final (part 6/21)

Add the C++ `final` specifier to leaf, user-configurable component classes and
automation action/trigger/condition primitives so that classes meant to be
terminal cannot be subclassed by external components. Only classes never used as
a base anywhere in the tree are marked. Part 6 of 21, split alphabetically by
component (esp32_ble_client .. fujitsu_general).
This commit is contained in:
Jesse Hills
2026-06-15 13:19:32 +12:00
parent a25ac28ae5
commit 70e1046c3a
40 changed files with 109 additions and 106 deletions

View File

@@ -17,7 +17,7 @@ namespace espbt = esphome::esp32_ble_tracker;
class BLEService;
class BLECharacteristic {
class BLECharacteristic final {
public:
~BLECharacteristic();
bool parsed = false;

View File

@@ -17,7 +17,7 @@ namespace espbt = esphome::esp32_ble_tracker;
class BLEClientBase;
class BLEService {
class BLEService final {
public:
~BLEService();
bool parsed = false;

View File

@@ -24,7 +24,7 @@ using namespace bytebuffer;
class BLEService;
class BLECharacteristic {
class BLECharacteristic final {
public:
BLECharacteristic(ESPBTUUID uuid, uint32_t properties);
~BLECharacteristic();

View File

@@ -23,7 +23,7 @@ namespace esphome::esp32_ble_server {
using namespace esp32_ble;
using namespace bytebuffer;
class BLEServer : public Component, public Parented<ESP32BLE> {
class BLEServer final : public Component, public Parented<ESP32BLE> {
public:
void setup() override;
void loop() override;

View File

@@ -64,7 +64,7 @@ class BLECharacteristicSetValueActionManager {
void remove_listener_(BLECharacteristic *characteristic);
};
template<typename... Ts> class BLECharacteristicSetValueAction : public Action<Ts...> {
template<typename... Ts> class BLECharacteristicSetValueAction final : public Action<Ts...> {
public:
BLECharacteristicSetValueAction(BLECharacteristic *characteristic) : parent_(characteristic) {}
TEMPLATABLE_VALUE(std::vector<uint8_t>, buffer)
@@ -92,7 +92,7 @@ template<typename... Ts> class BLECharacteristicSetValueAction : public Action<T
#endif // USE_ESP32_BLE_SERVER_SET_VALUE_ACTION
#ifdef USE_ESP32_BLE_SERVER_NOTIFY_ACTION
template<typename... Ts> class BLECharacteristicNotifyAction : public Action<Ts...> {
template<typename... Ts> class BLECharacteristicNotifyAction final : public Action<Ts...> {
public:
BLECharacteristicNotifyAction(BLECharacteristic *characteristic) : parent_(characteristic) {}
void play(const Ts &...x) override {
@@ -110,7 +110,7 @@ template<typename... Ts> class BLECharacteristicNotifyAction : public Action<Ts.
#endif // USE_ESP32_BLE_SERVER_NOTIFY_ACTION
#ifdef USE_ESP32_BLE_SERVER_DESCRIPTOR_SET_VALUE_ACTION
template<typename... Ts> class BLEDescriptorSetValueAction : public Action<Ts...> {
template<typename... Ts> class BLEDescriptorSetValueAction final : public Action<Ts...> {
public:
BLEDescriptorSetValueAction(BLEDescriptor *descriptor) : parent_(descriptor) {}
TEMPLATABLE_VALUE(std::vector<uint8_t>, buffer)

View File

@@ -19,7 +19,7 @@ class BLEServer;
using namespace esp32_ble;
class BLEService {
class BLEService final {
public:
BLEService(ESPBTUUID uuid, uint16_t num_handles, uint8_t inst_id, bool advertise);
~BLEService();

View File

@@ -7,7 +7,7 @@
namespace esphome::esp32_ble_tracker {
#ifdef USE_ESP32_BLE_DEVICE
class ESPBTAdvertiseTrigger : public Trigger<const ESPBTDevice &>, public ESPBTDeviceListener {
class ESPBTAdvertiseTrigger final : public Trigger<const ESPBTDevice &>, public ESPBTDeviceListener {
public:
explicit ESPBTAdvertiseTrigger(ESP32BLETracker *parent) { parent->register_listener(this); }
void set_addresses(std::initializer_list<uint64_t> addresses) { this->address_vec_ = addresses; }
@@ -28,7 +28,7 @@ class ESPBTAdvertiseTrigger : public Trigger<const ESPBTDevice &>, public ESPBTD
std::vector<uint64_t> address_vec_;
};
class BLEServiceDataAdvertiseTrigger : public Trigger<const adv_data_t &>, public ESPBTDeviceListener {
class BLEServiceDataAdvertiseTrigger final : public Trigger<const adv_data_t &>, public ESPBTDeviceListener {
public:
explicit BLEServiceDataAdvertiseTrigger(ESP32BLETracker *parent) { parent->register_listener(this); }
void set_address(uint64_t address) { this->address_ = address; }
@@ -54,7 +54,7 @@ class BLEServiceDataAdvertiseTrigger : public Trigger<const adv_data_t &>, publi
ESPBTUUID uuid_;
};
class BLEManufacturerDataAdvertiseTrigger : public Trigger<const adv_data_t &>, public ESPBTDeviceListener {
class BLEManufacturerDataAdvertiseTrigger final : public Trigger<const adv_data_t &>, public ESPBTDeviceListener {
public:
explicit BLEManufacturerDataAdvertiseTrigger(ESP32BLETracker *parent) { parent->register_listener(this); }
void set_address(uint64_t address) { this->address_ = address; }
@@ -82,7 +82,7 @@ class BLEManufacturerDataAdvertiseTrigger : public Trigger<const adv_data_t &>,
#endif // USE_ESP32_BLE_DEVICE
class BLEEndOfScanTrigger : public Trigger<>, public ESPBTDeviceListener {
class BLEEndOfScanTrigger final : public Trigger<>, public ESPBTDeviceListener {
public:
explicit BLEEndOfScanTrigger(ESP32BLETracker *parent) { parent->register_listener(this); }
@@ -92,7 +92,7 @@ class BLEEndOfScanTrigger : public Trigger<>, public ESPBTDeviceListener {
void on_scan_end() override { this->trigger(); }
};
template<typename... Ts> class ESP32BLEStartScanAction : public Action<Ts...> {
template<typename... Ts> class ESP32BLEStartScanAction final : public Action<Ts...> {
public:
ESP32BLEStartScanAction(ESP32BLETracker *parent) : parent_(parent) {}
TEMPLATABLE_VALUE(bool, continuous)
@@ -111,7 +111,7 @@ template<typename... Ts> class ESP32BLEStartScanAction : public Action<Ts...> {
ESP32BLETracker *parent_;
};
template<typename... Ts> class ESP32BLEStopScanAction : public Action<Ts...>, public Parented<ESP32BLETracker> {
template<typename... Ts> class ESP32BLEStopScanAction final : public Action<Ts...>, public Parented<ESP32BLETracker> {
public:
void play(const Ts &...x) override { this->parent_->stop_scan(); }
};

View File

@@ -294,11 +294,11 @@ class ESPBTClient : public ESPBTDeviceListener {
uint8_t *tracker_state_version_{nullptr};
};
class ESP32BLETracker : public Component,
class ESP32BLETracker final : public Component,
#ifdef USE_OTA_STATE_LISTENER
public ota::OTAGlobalStateListener,
public ota::OTAGlobalStateListener,
#endif
public Parented<ESP32BLE> {
public Parented<ESP32BLE> {
public:
void set_scan_duration(uint32_t scan_duration) { scan_duration_ = scan_duration; }
void set_scan_interval(uint32_t scan_interval) { scan_interval_ = scan_interval; }

View File

@@ -119,7 +119,7 @@ class ESP32CameraImageReader : public camera::CameraImageReader {
};
/* ---------------- ESP32Camera class ---------------- */
class ESP32Camera : public camera::Camera {
class ESP32Camera final : public camera::Camera {
public:
ESP32Camera();
@@ -235,7 +235,7 @@ class ESP32Camera : public camera::Camera {
RAMAllocator<camera_fb_t> fb_allocator_{RAMAllocator<camera_fb_t>::ALLOC_INTERNAL};
};
class ESP32CameraImageTrigger : public Trigger<CameraImageData>, public camera::CameraListener {
class ESP32CameraImageTrigger final : public Trigger<CameraImageData>, public camera::CameraListener {
public:
explicit ESP32CameraImageTrigger(ESP32Camera *parent) { parent->add_listener(this); }
void on_camera_image(const std::shared_ptr<camera::CameraImage> &image) override {
@@ -246,13 +246,13 @@ class ESP32CameraImageTrigger : public Trigger<CameraImageData>, public camera::
}
};
class ESP32CameraStreamStartTrigger : public Trigger<>, public camera::CameraListener {
class ESP32CameraStreamStartTrigger final : public Trigger<>, public camera::CameraListener {
public:
explicit ESP32CameraStreamStartTrigger(ESP32Camera *parent) { parent->add_listener(this); }
void on_stream_start() override { this->trigger(); }
};
class ESP32CameraStreamStopTrigger : public Trigger<>, public camera::CameraListener {
class ESP32CameraStreamStopTrigger final : public Trigger<>, public camera::CameraListener {
public:
explicit ESP32CameraStreamStopTrigger(ESP32Camera *parent) { parent->add_listener(this); }
void on_stream_stop() override { this->trigger(); }

View File

@@ -17,7 +17,7 @@ namespace esphome::esp32_camera_web_server {
enum Mode { STREAM, SNAPSHOT };
class CameraWebServer : public Component, public camera::CameraListener {
class CameraWebServer final : public Component, public camera::CameraListener {
public:
CameraWebServer();
~CameraWebServer();

View File

@@ -14,7 +14,7 @@ enum CanMode : uint8_t {
CAN_MODE_LISTEN_ONLY = 1,
};
class ESP32Can : public canbus::Canbus {
class ESP32Can final : public canbus::Canbus {
public:
void set_rx(int rx) { rx_ = rx; }
void set_tx(int tx) { tx_ = tx; }

View File

@@ -11,7 +11,7 @@
namespace esphome::esp32_dac {
class ESP32DAC : public output::FloatOutput, public Component {
class ESP32DAC final : public output::FloatOutput, public Component {
public:
void set_pin(InternalGPIOPin *pin) { pin_ = pin; }

View File

@@ -13,7 +13,7 @@
namespace esphome::esp32_hosted {
class Esp32HostedUpdate : public update::UpdateEntity, public PollingComponent {
class Esp32HostedUpdate final : public update::UpdateEntity, public PollingComponent {
public:
void setup() override;
void dump_config() override;

View File

@@ -9,7 +9,7 @@
namespace esphome::esp32_improv {
class ESP32ImprovProvisionedTrigger : public Trigger<> {
class ESP32ImprovProvisionedTrigger final : public Trigger<> {
public:
explicit ESP32ImprovProvisionedTrigger(ESP32ImprovComponent *parent) : parent_(parent) {
parent->add_on_state_callback([this](improv::State state, improv::Error error) {
@@ -23,7 +23,7 @@ class ESP32ImprovProvisionedTrigger : public Trigger<> {
ESP32ImprovComponent *parent_;
};
class ESP32ImprovProvisioningTrigger : public Trigger<> {
class ESP32ImprovProvisioningTrigger final : public Trigger<> {
public:
explicit ESP32ImprovProvisioningTrigger(ESP32ImprovComponent *parent) : parent_(parent) {
parent->add_on_state_callback([this](improv::State state, improv::Error error) {
@@ -37,7 +37,7 @@ class ESP32ImprovProvisioningTrigger : public Trigger<> {
ESP32ImprovComponent *parent_;
};
class ESP32ImprovStartTrigger : public Trigger<> {
class ESP32ImprovStartTrigger final : public Trigger<> {
public:
explicit ESP32ImprovStartTrigger(ESP32ImprovComponent *parent) : parent_(parent) {
parent->add_on_state_callback([this](improv::State state, improv::Error error) {
@@ -52,7 +52,7 @@ class ESP32ImprovStartTrigger : public Trigger<> {
ESP32ImprovComponent *parent_;
};
class ESP32ImprovStateTrigger : public Trigger<improv::State, improv::Error> {
class ESP32ImprovStateTrigger final : public Trigger<improv::State, improv::Error> {
public:
explicit ESP32ImprovStateTrigger(ESP32ImprovComponent *parent) : parent_(parent) {
parent->add_on_state_callback([this](improv::State state, improv::Error error) {
@@ -66,7 +66,7 @@ class ESP32ImprovStateTrigger : public Trigger<improv::State, improv::Error> {
ESP32ImprovComponent *parent_;
};
class ESP32ImprovStoppedTrigger : public Trigger<> {
class ESP32ImprovStoppedTrigger final : public Trigger<> {
public:
explicit ESP32ImprovStoppedTrigger(ESP32ImprovComponent *parent) : parent_(parent) {
parent->add_on_state_callback([this](improv::State state, improv::Error error) {

View File

@@ -32,7 +32,7 @@ namespace esphome::esp32_improv {
using namespace esp32_ble_server;
class ESP32ImprovComponent : public Component, public improv_base::ImprovBase {
class ESP32ImprovComponent final : public Component, public improv_base::ImprovBase {
public:
ESP32ImprovComponent();
void dump_config() override;

View File

@@ -30,7 +30,7 @@ struct LedParams {
rmt_symbol_word_t reset;
};
class ESP32RMTLEDStripLightOutput : public light::AddressableLight {
class ESP32RMTLEDStripLightOutput final : public light::AddressableLight {
public:
void setup() override;
void write_state(light::LightState *state) override;

View File

@@ -172,7 +172,7 @@ class ESP32TouchComponent final : public Component {
};
/// Simple helper class to expose a touch pad value as a binary sensor.
class ESP32TouchBinarySensor : public binary_sensor::BinarySensor {
class ESP32TouchBinarySensor final : public binary_sensor::BinarySensor {
public:
ESP32TouchBinarySensor(int channel_id, uint32_t threshold, uint32_t wakeup_threshold)
: channel_id_(channel_id), threshold_(threshold), wakeup_threshold_(wakeup_threshold) {}

View File

@@ -7,7 +7,7 @@
namespace esphome::esp8266 {
class ESP8266GPIOPin : public InternalGPIOPin {
class ESP8266GPIOPin final : public InternalGPIOPin {
public:
void set_pin(uint8_t pin) { pin_ = pin; }
void set_inverted(bool inverted) { inverted_ = inverted; }

View File

@@ -9,7 +9,7 @@
namespace esphome::esp8266_pwm {
class ESP8266PWM : public output::FloatOutput, public Component {
class ESP8266PWM final : public output::FloatOutput, public Component {
public:
void set_pin(InternalGPIOPin *pin) { pin_ = pin; }
void set_frequency(float frequency) { this->frequency_ = frequency; }
@@ -34,7 +34,7 @@ class ESP8266PWM : public output::FloatOutput, public Component {
float last_output_{0.0};
};
template<typename... Ts> class SetFrequencyAction : public Action<Ts...> {
template<typename... Ts> class SetFrequencyAction final : public Action<Ts...> {
public:
SetFrequencyAction(ESP8266PWM *parent) : parent_(parent) {}
TEMPLATABLE_VALUE(float, frequency);

View File

@@ -6,7 +6,7 @@
namespace esphome::esp_ldo {
class EspLdo : public Component {
class EspLdo final : public Component {
public:
EspLdo(int channel) : channel_(channel) {}
@@ -27,7 +27,7 @@ class EspLdo : public Component {
esp_ldo_channel_handle_t handle_{};
};
template<typename... Ts> class AdjustAction : public Action<Ts...> {
template<typename... Ts> class AdjustAction final : public Action<Ts...> {
public:
explicit AdjustAction(EspLdo *ldo) : ldo_(ldo) {}

View File

@@ -9,7 +9,7 @@
namespace esphome::espnow {
template<typename... Ts> class SendAction : public Action<Ts...>, public Parented<ESPNowComponent> {
template<typename... Ts> class SendAction final : public Action<Ts...>, public Parented<ESPNowComponent> {
TEMPLATABLE_VALUE(peer_address_t, address);
TEMPLATABLE_VALUE(std::vector<uint8_t>, data);
@@ -86,7 +86,7 @@ template<typename... Ts> class SendAction : public Action<Ts...>, public Parente
} flags_{0};
};
template<typename... Ts> class AddPeerAction : public Action<Ts...>, public Parented<ESPNowComponent> {
template<typename... Ts> class AddPeerAction final : public Action<Ts...>, public Parented<ESPNowComponent> {
TEMPLATABLE_VALUE(peer_address_t, address);
protected:
@@ -96,7 +96,7 @@ template<typename... Ts> class AddPeerAction : public Action<Ts...>, public Pare
}
};
template<typename... Ts> class DeletePeerAction : public Action<Ts...>, public Parented<ESPNowComponent> {
template<typename... Ts> class DeletePeerAction final : public Action<Ts...>, public Parented<ESPNowComponent> {
TEMPLATABLE_VALUE(peer_address_t, address);
protected:
@@ -106,7 +106,7 @@ template<typename... Ts> class DeletePeerAction : public Action<Ts...>, public P
}
};
template<typename... Ts> class SetChannelAction : public Action<Ts...>, public Parented<ESPNowComponent> {
template<typename... Ts> class SetChannelAction final : public Action<Ts...>, public Parented<ESPNowComponent> {
TEMPLATABLE_VALUE(uint8_t, channel)
protected:
@@ -119,8 +119,8 @@ template<typename... Ts> class SetChannelAction : public Action<Ts...>, public P
}
};
class OnReceiveTrigger : public Trigger<const ESPNowRecvInfo &, const uint8_t *, uint8_t>,
public ESPNowReceivedPacketHandler {
class OnReceiveTrigger final : public Trigger<const ESPNowRecvInfo &, const uint8_t *, uint8_t>,
public ESPNowReceivedPacketHandler {
public:
explicit OnReceiveTrigger(std::array<uint8_t, ESP_NOW_ETH_ALEN> address) : has_address_(true) {
memcpy(this->address_, address.data(), ESP_NOW_ETH_ALEN);
@@ -141,16 +141,16 @@ class OnReceiveTrigger : public Trigger<const ESPNowRecvInfo &, const uint8_t *,
bool has_address_{false};
uint8_t address_[ESP_NOW_ETH_ALEN]{};
};
class OnUnknownPeerTrigger : public Trigger<const ESPNowRecvInfo &, const uint8_t *, uint8_t>,
public ESPNowUnknownPeerHandler {
class OnUnknownPeerTrigger final : public Trigger<const ESPNowRecvInfo &, const uint8_t *, uint8_t>,
public ESPNowUnknownPeerHandler {
public:
bool on_unknown_peer(const ESPNowRecvInfo &info, const uint8_t *data, uint8_t size) override {
this->trigger(info, data, size);
return false; // Return false to continue processing other internal handlers
}
};
class OnBroadcastTrigger : public Trigger<const ESPNowRecvInfo &, const uint8_t *, uint8_t>,
public ESPNowBroadcastHandler {
class OnBroadcastTrigger final : public Trigger<const ESPNowRecvInfo &, const uint8_t *, uint8_t>,
public ESPNowBroadcastHandler {
public:
explicit OnBroadcastTrigger(std::array<uint8_t, ESP_NOW_ETH_ALEN> address) : has_address_(true) {
memcpy(this->address_, address.data(), ESP_NOW_ETH_ALEN);

View File

@@ -88,7 +88,7 @@ class ESPNowBroadcastHandler {
virtual bool on_broadcast(const ESPNowRecvInfo &info, const uint8_t *data, uint8_t size) = 0;
};
class ESPNowComponent : public Component {
class ESPNowComponent final : public Component {
public:
ESPNowComponent();
void setup() override;

View File

@@ -11,10 +11,10 @@
namespace esphome::espnow {
class ESPNowTransport : public packet_transport::PacketTransport,
public Parented<ESPNowComponent>,
public ESPNowReceivedPacketHandler,
public ESPNowBroadcastHandler {
class ESPNowTransport final : public packet_transport::PacketTransport,
public Parented<ESPNowComponent>,
public ESPNowReceivedPacketHandler,
public ESPNowBroadcastHandler {
public:
void setup() override;
float get_setup_priority() const override { return setup_priority::AFTER_WIFI; }

View File

@@ -6,22 +6,22 @@
namespace esphome::ethernet {
template<typename... Ts> class EthernetConnectedCondition : public Condition<Ts...> {
template<typename... Ts> class EthernetConnectedCondition final : public Condition<Ts...> {
public:
bool check(const Ts &...x) override { return global_eth_component->is_connected(); }
};
template<typename... Ts> class EthernetEnabledCondition : public Condition<Ts...> {
template<typename... Ts> class EthernetEnabledCondition final : public Condition<Ts...> {
public:
bool check(const Ts &...x) override { return global_eth_component->is_enabled(); }
};
template<typename... Ts> class EthernetEnableAction : public Action<Ts...> {
template<typename... Ts> class EthernetEnableAction final : public Action<Ts...> {
public:
void play(const Ts &...x) override { global_eth_component->enable(); }
};
template<typename... Ts> class EthernetDisableAction : public Action<Ts...> {
template<typename... Ts> class EthernetDisableAction final : public Action<Ts...> {
public:
void play(const Ts &...x) override { global_eth_component->disable(); }
};

View File

@@ -6,14 +6,14 @@
namespace esphome::event {
template<typename... Ts> class TriggerEventAction : public Action<Ts...>, public Parented<Event> {
template<typename... Ts> class TriggerEventAction final : public Action<Ts...>, public Parented<Event> {
public:
TEMPLATABLE_VALUE(std::string, event_type)
void play(const Ts &...x) override { this->parent_->trigger(this->event_type_.value(x...)); }
};
class EventTrigger : public Trigger<StringRef> {
class EventTrigger final : public Trigger<StringRef> {
public:
EventTrigger(Event *event) {
event->add_on_event_callback([this](StringRef event_type) { this->trigger(event_type); });

View File

@@ -16,8 +16,8 @@ struct ExposureNotification {
std::array<uint8_t, 4> associated_encrypted_metadata;
};
class ExposureNotificationTrigger : public Trigger<ExposureNotification>,
public esp32_ble_tracker::ESPBTDeviceListener {
class ExposureNotificationTrigger final : public Trigger<ExposureNotification>,
public esp32_ble_tracker::ESPBTDeviceListener {
public:
bool parse_device(const esp32_ble_tracker::ESPBTDevice &device) override;
};

View File

@@ -32,7 +32,7 @@ class EzoCommand {
};
/// This class implements support for the EZO circuits in i2c mode
class EZOSensor : public sensor::Sensor, public PollingComponent, public i2c::I2CDevice {
class EZOSensor final : public sensor::Sensor, public PollingComponent, public i2c::I2CDevice {
public:
void loop() override;
void dump_config() override;

View File

@@ -19,7 +19,7 @@
namespace esphome::ezo_pmp {
class EzoPMP : public PollingComponent, public i2c::I2CDevice {
class EzoPMP final : public PollingComponent, public i2c::I2CDevice {
public:
void dump_config() override;
@@ -114,7 +114,7 @@ class EzoPMP : public PollingComponent, public i2c::I2CDevice {
};
// Action Templates
template<typename... Ts> class EzoPMPFindAction : public Action<Ts...> {
template<typename... Ts> class EzoPMPFindAction final : public Action<Ts...> {
public:
EzoPMPFindAction(EzoPMP *ezopmp) : ezopmp_(ezopmp) {}
@@ -124,7 +124,7 @@ template<typename... Ts> class EzoPMPFindAction : public Action<Ts...> {
EzoPMP *ezopmp_;
};
template<typename... Ts> class EzoPMPDoseContinuouslyAction : public Action<Ts...> {
template<typename... Ts> class EzoPMPDoseContinuouslyAction final : public Action<Ts...> {
public:
EzoPMPDoseContinuouslyAction(EzoPMP *ezopmp) : ezopmp_(ezopmp) {}
@@ -134,7 +134,7 @@ template<typename... Ts> class EzoPMPDoseContinuouslyAction : public Action<Ts..
EzoPMP *ezopmp_;
};
template<typename... Ts> class EzoPMPDoseVolumeAction : public Action<Ts...> {
template<typename... Ts> class EzoPMPDoseVolumeAction final : public Action<Ts...> {
public:
EzoPMPDoseVolumeAction(EzoPMP *ezopmp) : ezopmp_(ezopmp) {}
@@ -145,7 +145,7 @@ template<typename... Ts> class EzoPMPDoseVolumeAction : public Action<Ts...> {
EzoPMP *ezopmp_;
};
template<typename... Ts> class EzoPMPDoseVolumeOverTimeAction : public Action<Ts...> {
template<typename... Ts> class EzoPMPDoseVolumeOverTimeAction final : public Action<Ts...> {
public:
EzoPMPDoseVolumeOverTimeAction(EzoPMP *ezopmp) : ezopmp_(ezopmp) {}
@@ -159,7 +159,7 @@ template<typename... Ts> class EzoPMPDoseVolumeOverTimeAction : public Action<Ts
EzoPMP *ezopmp_;
};
template<typename... Ts> class EzoPMPDoseWithConstantFlowRateAction : public Action<Ts...> {
template<typename... Ts> class EzoPMPDoseWithConstantFlowRateAction final : public Action<Ts...> {
public:
EzoPMPDoseWithConstantFlowRateAction(EzoPMP *ezopmp) : ezopmp_(ezopmp) {}
@@ -173,7 +173,7 @@ template<typename... Ts> class EzoPMPDoseWithConstantFlowRateAction : public Act
EzoPMP *ezopmp_;
};
template<typename... Ts> class EzoPMPSetCalibrationVolumeAction : public Action<Ts...> {
template<typename... Ts> class EzoPMPSetCalibrationVolumeAction final : public Action<Ts...> {
public:
EzoPMPSetCalibrationVolumeAction(EzoPMP *ezopmp) : ezopmp_(ezopmp) {}
@@ -184,7 +184,7 @@ template<typename... Ts> class EzoPMPSetCalibrationVolumeAction : public Action<
EzoPMP *ezopmp_;
};
template<typename... Ts> class EzoPMPClearTotalVolumeDispensedAction : public Action<Ts...> {
template<typename... Ts> class EzoPMPClearTotalVolumeDispensedAction final : public Action<Ts...> {
public:
EzoPMPClearTotalVolumeDispensedAction(EzoPMP *ezopmp) : ezopmp_(ezopmp) {}
@@ -194,7 +194,7 @@ template<typename... Ts> class EzoPMPClearTotalVolumeDispensedAction : public Ac
EzoPMP *ezopmp_;
};
template<typename... Ts> class EzoPMPClearCalibrationAction : public Action<Ts...> {
template<typename... Ts> class EzoPMPClearCalibrationAction final : public Action<Ts...> {
public:
EzoPMPClearCalibrationAction(EzoPMP *ezopmp) : ezopmp_(ezopmp) {}
@@ -204,7 +204,7 @@ template<typename... Ts> class EzoPMPClearCalibrationAction : public Action<Ts..
EzoPMP *ezopmp_;
};
template<typename... Ts> class EzoPMPPauseDosingAction : public Action<Ts...> {
template<typename... Ts> class EzoPMPPauseDosingAction final : public Action<Ts...> {
public:
EzoPMPPauseDosingAction(EzoPMP *ezopmp) : ezopmp_(ezopmp) {}
@@ -214,7 +214,7 @@ template<typename... Ts> class EzoPMPPauseDosingAction : public Action<Ts...> {
EzoPMP *ezopmp_;
};
template<typename... Ts> class EzoPMPStopDosingAction : public Action<Ts...> {
template<typename... Ts> class EzoPMPStopDosingAction final : public Action<Ts...> {
public:
EzoPMPStopDosingAction(EzoPMP *ezopmp) : ezopmp_(ezopmp) {}
@@ -224,7 +224,7 @@ template<typename... Ts> class EzoPMPStopDosingAction : public Action<Ts...> {
EzoPMP *ezopmp_;
};
template<typename... Ts> class EzoPMPChangeI2CAddressAction : public Action<Ts...> {
template<typename... Ts> class EzoPMPChangeI2CAddressAction final : public Action<Ts...> {
public:
EzoPMPChangeI2CAddressAction(EzoPMP *ezopmp) : ezopmp_(ezopmp) {}
@@ -235,7 +235,7 @@ template<typename... Ts> class EzoPMPChangeI2CAddressAction : public Action<Ts..
EzoPMP *ezopmp_;
};
template<typename... Ts> class EzoPMPArbitraryCommandAction : public Action<Ts...> {
template<typename... Ts> class EzoPMPArbitraryCommandAction final : public Action<Ts...> {
public:
EzoPMPArbitraryCommandAction(EzoPMP *ezopmp) : ezopmp_(ezopmp) {}

View File

@@ -7,7 +7,7 @@
namespace esphome::factory_reset {
class FactoryResetButton : public button::Button, public Component {
class FactoryResetButton final : public button::Button, public Component {
public:
void dump_config() override;
#ifdef USE_OPENTHREAD

View File

@@ -10,7 +10,7 @@
#endif
namespace esphome::factory_reset {
class FactoryResetComponent : public Component {
class FactoryResetComponent final : public Component {
public:
FactoryResetComponent(uint8_t required_count, uint16_t max_interval)
: max_interval_(max_interval), required_count_(required_count) {}

View File

@@ -6,7 +6,7 @@
namespace esphome::factory_reset {
class FactoryResetSwitch : public switch_::Switch, public Component {
class FactoryResetSwitch final : public switch_::Switch, public Component {
public:
void dump_config() override;
#ifdef USE_OPENTHREAD

View File

@@ -18,7 +18,7 @@ namespace esphome::fan {
// (e.g. `const T & &` if Ts already carries a reference, or `const const
// T &` if Ts already carries a const). This keeps trigger args no-copy
// regardless of whether the trigger supplies `T`, `T &`, or `const T &`.
template<typename... Ts> class TurnOnAction : public Action<Ts...> {
template<typename... Ts> class TurnOnAction final : public Action<Ts...> {
public:
using ApplyFn = void (*)(FanCall &, const std::remove_cvref_t<Ts> &...);
TurnOnAction(Fan *state, ApplyFn apply) : state_(state), apply_(apply) {}
@@ -33,7 +33,7 @@ template<typename... Ts> class TurnOnAction : public Action<Ts...> {
ApplyFn apply_;
};
template<typename... Ts> class TurnOffAction : public Action<Ts...> {
template<typename... Ts> class TurnOffAction final : public Action<Ts...> {
public:
explicit TurnOffAction(Fan *state) : state_(state) {}
@@ -42,7 +42,7 @@ template<typename... Ts> class TurnOffAction : public Action<Ts...> {
Fan *state_;
};
template<typename... Ts> class ToggleAction : public Action<Ts...> {
template<typename... Ts> class ToggleAction final : public Action<Ts...> {
public:
explicit ToggleAction(Fan *state) : state_(state) {}
@@ -51,7 +51,7 @@ template<typename... Ts> class ToggleAction : public Action<Ts...> {
Fan *state_;
};
template<typename... Ts> class CycleSpeedAction : public Action<Ts...> {
template<typename... Ts> class CycleSpeedAction final : public Action<Ts...> {
public:
explicit CycleSpeedAction(Fan *state) : state_(state) {}
@@ -95,7 +95,7 @@ template<typename... Ts> class CycleSpeedAction : public Action<Ts...> {
Fan *state_;
};
template<typename... Ts> class FanIsOnCondition : public Condition<Ts...> {
template<typename... Ts> class FanIsOnCondition final : public Condition<Ts...> {
public:
explicit FanIsOnCondition(Fan *state) : state_(state) {}
bool check(const Ts &...x) override { return this->state_->state; }
@@ -103,7 +103,7 @@ template<typename... Ts> class FanIsOnCondition : public Condition<Ts...> {
protected:
Fan *state_;
};
template<typename... Ts> class FanIsOffCondition : public Condition<Ts...> {
template<typename... Ts> class FanIsOffCondition final : public Condition<Ts...> {
public:
explicit FanIsOffCondition(Fan *state) : state_(state) {}
bool check(const Ts &...x) override { return !this->state_->state; }
@@ -112,7 +112,7 @@ template<typename... Ts> class FanIsOffCondition : public Condition<Ts...> {
Fan *state_;
};
class FanStateTrigger : public Trigger<Fan *> {
class FanStateTrigger final : public Trigger<Fan *> {
public:
FanStateTrigger(Fan *state) : fan_(state) {
state->add_on_state_callback([this]() { this->trigger(this->fan_); });
@@ -122,7 +122,7 @@ class FanStateTrigger : public Trigger<Fan *> {
Fan *fan_;
};
class FanTurnOnTrigger : public Trigger<> {
class FanTurnOnTrigger final : public Trigger<> {
public:
FanTurnOnTrigger(Fan *state) : fan_(state) {
state->add_on_state_callback([this]() {
@@ -141,7 +141,7 @@ class FanTurnOnTrigger : public Trigger<> {
bool last_on_;
};
class FanTurnOffTrigger : public Trigger<> {
class FanTurnOffTrigger final : public Trigger<> {
public:
FanTurnOffTrigger(Fan *state) : fan_(state) {
state->add_on_state_callback([this]() {
@@ -160,7 +160,7 @@ class FanTurnOffTrigger : public Trigger<> {
bool last_on_;
};
class FanDirectionSetTrigger : public Trigger<FanDirection> {
class FanDirectionSetTrigger final : public Trigger<FanDirection> {
public:
FanDirectionSetTrigger(Fan *state) : fan_(state) {
state->add_on_state_callback([this]() {
@@ -179,7 +179,7 @@ class FanDirectionSetTrigger : public Trigger<FanDirection> {
FanDirection last_direction_;
};
class FanOscillatingSetTrigger : public Trigger<bool> {
class FanOscillatingSetTrigger final : public Trigger<bool> {
public:
FanOscillatingSetTrigger(Fan *state) : fan_(state) {
state->add_on_state_callback([this]() {
@@ -198,7 +198,7 @@ class FanOscillatingSetTrigger : public Trigger<bool> {
bool last_oscillating_;
};
class FanSpeedSetTrigger : public Trigger<int> {
class FanSpeedSetTrigger final : public Trigger<int> {
public:
FanSpeedSetTrigger(Fan *state) : fan_(state) {
state->add_on_state_callback([this]() {
@@ -217,7 +217,7 @@ class FanSpeedSetTrigger : public Trigger<int> {
int last_speed_;
};
class FanPresetSetTrigger : public Trigger<StringRef> {
class FanPresetSetTrigger final : public Trigger<StringRef> {
public:
FanPresetSetTrigger(Fan *state) : fan_(state) {
state->add_on_state_callback([this]() {

View File

@@ -17,7 +17,7 @@
namespace esphome::fastled_base {
class FastLEDLightOutput : public light::AddressableLight {
class FastLEDLightOutput final : public light::AddressableLight {
public:
/// Only for custom effects: Get the internal controller.
CLEDController *get_controller() const { return this->controller_; }

View File

@@ -10,7 +10,7 @@
namespace esphome::feedback {
class FeedbackCover : public cover::Cover, public Component {
class FeedbackCover final : public cover::Cover, public Component {
public:
void setup() override;
void loop() override;

View File

@@ -92,7 +92,7 @@ enum GrowAuraLEDColor {
WHITE = 0x07,
};
class FingerprintGrowComponent : public PollingComponent, public uart::UARTDevice {
class FingerprintGrowComponent final : public PollingComponent, public uart::UARTDevice {
public:
void update() override;
void setup() override;
@@ -209,7 +209,8 @@ class FingerprintGrowComponent : public PollingComponent, public uart::UARTDevic
CallbackManager<void(uint16_t)> enrollment_failed_callback_;
};
template<typename... Ts> class EnrollmentAction : public Action<Ts...>, public Parented<FingerprintGrowComponent> {
template<typename... Ts>
class EnrollmentAction final : public Action<Ts...>, public Parented<FingerprintGrowComponent> {
public:
TEMPLATABLE_VALUE(uint16_t, finger_id)
TEMPLATABLE_VALUE(uint8_t, num_scans)
@@ -226,12 +227,12 @@ template<typename... Ts> class EnrollmentAction : public Action<Ts...>, public P
};
template<typename... Ts>
class CancelEnrollmentAction : public Action<Ts...>, public Parented<FingerprintGrowComponent> {
class CancelEnrollmentAction final : public Action<Ts...>, public Parented<FingerprintGrowComponent> {
public:
void play(const Ts &...x) override { this->parent_->finish_enrollment(1); }
};
template<typename... Ts> class DeleteAction : public Action<Ts...>, public Parented<FingerprintGrowComponent> {
template<typename... Ts> class DeleteAction final : public Action<Ts...>, public Parented<FingerprintGrowComponent> {
public:
TEMPLATABLE_VALUE(uint16_t, finger_id)
@@ -241,12 +242,13 @@ template<typename... Ts> class DeleteAction : public Action<Ts...>, public Paren
}
};
template<typename... Ts> class DeleteAllAction : public Action<Ts...>, public Parented<FingerprintGrowComponent> {
template<typename... Ts> class DeleteAllAction final : public Action<Ts...>, public Parented<FingerprintGrowComponent> {
public:
void play(const Ts &...x) override { this->parent_->delete_all_fingerprints(); }
};
template<typename... Ts> class LEDControlAction : public Action<Ts...>, public Parented<FingerprintGrowComponent> {
template<typename... Ts>
class LEDControlAction final : public Action<Ts...>, public Parented<FingerprintGrowComponent> {
public:
TEMPLATABLE_VALUE(bool, state)
@@ -256,7 +258,8 @@ template<typename... Ts> class LEDControlAction : public Action<Ts...>, public P
}
};
template<typename... Ts> class AuraLEDControlAction : public Action<Ts...>, public Parented<FingerprintGrowComponent> {
template<typename... Ts>
class AuraLEDControlAction final : public Action<Ts...>, public Parented<FingerprintGrowComponent> {
public:
TEMPLATABLE_VALUE(uint8_t, state)
TEMPLATABLE_VALUE(uint8_t, speed)

View File

@@ -14,7 +14,7 @@ namespace esphome::font {
class Font;
class Glyph {
class Glyph final {
public:
constexpr Glyph(uint32_t code_point, const uint8_t *data, int advance, int offset_x, int offset_y, int width,
int height)
@@ -37,7 +37,7 @@ class Glyph {
int height;
};
class Font
class Font final
#ifdef USE_DISPLAY
: public display::BaseFont
#endif

View File

@@ -11,7 +11,7 @@ namespace esphome::fs3000 {
// 1015 has a max speed detection of 15 m/s
enum FS3000Model { FIVE, FIFTEEN };
class FS3000Component : public PollingComponent, public i2c::I2CDevice, public sensor::Sensor {
class FS3000Component final : public PollingComponent, public i2c::I2CDevice, public sensor::Sensor {
public:
void setup() override;
void update() override;

View File

@@ -34,7 +34,7 @@ enum FTMode : uint8_t {
static const size_t MAX_TOUCHES = 5; // max number of possible touches reported
class FT5x06Touchscreen : public touchscreen::Touchscreen, public i2c::I2CDevice {
class FT5x06Touchscreen final : public touchscreen::Touchscreen, public i2c::I2CDevice {
public:
void setup() override;
void dump_config() override;

View File

@@ -17,7 +17,7 @@ using namespace touchscreen;
static const uint8_t FT6X36_DEFAULT_THRESHOLD = 22;
class FT63X6Touchscreen : public Touchscreen, public i2c::I2CDevice {
class FT63X6Touchscreen final : public Touchscreen, public i2c::I2CDevice {
public:
void setup() override;
void dump_config() override;

View File

@@ -46,7 +46,7 @@ const uint8_t FUJITSU_GENERAL_TEMP_MAX = 30; // Celsius
*/
// clang-format on
class FujitsuGeneralClimate : public climate_ir::ClimateIR {
class FujitsuGeneralClimate final : public climate_ir::ClimateIR {
public:
FujitsuGeneralClimate()
: ClimateIR(FUJITSU_GENERAL_TEMP_MIN, FUJITSU_GENERAL_TEMP_MAX, 1.0f, true, true,