1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-29 22:24:26 +00:00

Fix clang

This commit is contained in:
Daniel Vikström
2025-04-09 22:33:03 +02:00
parent 32f4e4ca13
commit f5f1651b31
2 changed files with 3 additions and 12 deletions

View File

@@ -35,15 +35,6 @@ std::string EntityBase::get_icon() const {
}
void EntityBase::set_icon(const char *icon) { this->icon_c_str_ = icon; }
// Entity Device id
const StringRef &EntityBase::get_device_id() const {
if (this->device_id_.empty()) {
return StringRef("");
}
return this->device_id_;
}
void EntityBase::set_device_id(const std::string device_id) { this->device_id_ = StringRef(device_id); }
// Entity Category
EntityCategory EntityBase::get_entity_category() const { return this->entity_category_; }
void EntityBase::set_entity_category(EntityCategory entity_category) { this->entity_category_ = entity_category; }

View File

@@ -48,8 +48,8 @@ class EntityBase {
void set_icon(const char *icon);
// Get/set this entity's device id
const StringRef &get_device_id() const;
void set_device_id(const std::string device_id);
const StringRef &get_device_id() const { return this->device_id_; }
void set_device_id(const std::string &device_id) { this->device_id_ = StringRef(device_id); }
protected:
/// The hash_base() function has been deprecated. It is kept in this
@@ -65,7 +65,7 @@ class EntityBase {
bool internal_{false};
bool disabled_by_default_{false};
EntityCategory entity_category_{ENTITY_CATEGORY_NONE};
StringRef device_id_;
StringRef device_id_{""};
};
class EntityBase_DeviceClass { // NOLINT(readability-identifier-naming)