mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-06-03 11:30:46 +02:00
EntityBase Name can stay in flash. (#4594)
* `EntityBase`can stay in flash. * Trying to please the CI. --------- Co-authored-by: Your Name <you@example.com>
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <cstdint>
|
||||
#include "string_ref.h"
|
||||
|
||||
namespace esphome {
|
||||
|
||||
@@ -14,12 +15,9 @@ enum EntityCategory : uint8_t {
|
||||
// The generic Entity base class that provides an interface common to all Entities.
|
||||
class EntityBase {
|
||||
public:
|
||||
EntityBase() : EntityBase("") {}
|
||||
explicit EntityBase(std::string name);
|
||||
|
||||
// Get/set the name of this Entity
|
||||
const std::string &get_name() const;
|
||||
void set_name(const std::string &name);
|
||||
const StringRef &get_name() const;
|
||||
void set_name(const char *name);
|
||||
|
||||
// Get whether this Entity has its own name or it should use the device friendly_name.
|
||||
bool has_own_name() const { return this->has_own_name_; }
|
||||
@@ -54,7 +52,7 @@ class EntityBase {
|
||||
virtual uint32_t hash_base() { return 0L; }
|
||||
void calc_object_id_();
|
||||
|
||||
std::string name_;
|
||||
StringRef name_;
|
||||
bool has_own_name_{false};
|
||||
std::string object_id_;
|
||||
const char *icon_c_str_{nullptr};
|
||||
|
||||
Reference in New Issue
Block a user