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:
Fabian
2023-03-28 08:38:56 +02:00
committed by GitHub
parent 1f50bd0649
commit cb2fcaa9b1
26 changed files with 161 additions and 63 deletions
+4 -6
View File
@@ -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};