mirror of
https://github.com/esphome/esphome.git
synced 2026-07-10 08:55:36 +00:00
Merge branch 'entity-base-inline-accessors' into integration
This commit is contained in:
@@ -8,9 +8,6 @@ namespace esphome {
|
||||
|
||||
static const char *const TAG = "entity_base";
|
||||
|
||||
// Entity Name
|
||||
const StringRef &EntityBase::get_name() const { return this->name_; }
|
||||
|
||||
void EntityBase::configure_entity_(const char *name, uint32_t object_id_hash, uint32_t entity_fields) {
|
||||
this->name_ = StringRef(name);
|
||||
if (this->name_.empty()) {
|
||||
@@ -176,8 +173,6 @@ StringRef EntityBase::get_object_id_to(std::span<char, OBJECT_ID_MAX_LEN> buf) c
|
||||
return StringRef(buf.data(), len);
|
||||
}
|
||||
|
||||
uint32_t EntityBase::get_object_id_hash() { return this->object_id_hash_; }
|
||||
|
||||
// Migrate preference data from old_key to new_key if they differ.
|
||||
// This helper is exposed so callers with custom key computation (like TextPrefs)
|
||||
// can use it for manual migration. See: https://github.com/esphome/backlog/issues/85
|
||||
|
||||
@@ -68,7 +68,7 @@ static constexpr uint8_t ENTITY_FIELD_ENTITY_CATEGORY_SHIFT = 26;
|
||||
class EntityBase {
|
||||
public:
|
||||
// Get the name of this Entity
|
||||
const StringRef &get_name() const;
|
||||
const StringRef &get_name() const { return this->name_; }
|
||||
|
||||
// Get whether this Entity has its own name or it should use the device friendly_name.
|
||||
bool has_own_name() const { return this->flags_.has_own_name; }
|
||||
@@ -86,7 +86,7 @@ class EntityBase {
|
||||
std::string get_object_id() const;
|
||||
|
||||
// Get the unique Object ID of this Entity
|
||||
uint32_t get_object_id_hash();
|
||||
uint32_t get_object_id_hash() { return this->object_id_hash_; }
|
||||
|
||||
/// Get object_id with zero heap allocation
|
||||
/// For static case: returns StringRef to internal storage (buffer unused)
|
||||
|
||||
Reference in New Issue
Block a user