mirror of
https://github.com/esphome/esphome.git
synced 2026-08-22 22:26:21 +00:00
[text] Inline the trivial Text publish_state forwarding overloads
This commit is contained in:
@@ -8,10 +8,6 @@ namespace esphome::text {
|
||||
|
||||
static const char *const TAG = "text";
|
||||
|
||||
void Text::publish_state(const std::string &state) { this->publish_state(state.data(), state.size()); }
|
||||
|
||||
void Text::publish_state(const char *state) { this->publish_state(state, strlen(state)); }
|
||||
|
||||
void Text::publish_state(const char *state, size_t len) {
|
||||
this->set_has_state(true);
|
||||
// Only assign if changed to avoid heap allocation
|
||||
|
||||
@@ -23,8 +23,8 @@ class Text : public EntityBase {
|
||||
std::string state;
|
||||
TextTraits traits;
|
||||
|
||||
void publish_state(const std::string &state);
|
||||
void publish_state(const char *state);
|
||||
void publish_state(const std::string &state) { this->publish_state(state.data(), state.size()); }
|
||||
void publish_state(const char *state) { this->publish_state(state, strlen(state)); }
|
||||
void publish_state(const char *state, size_t len);
|
||||
|
||||
/// Instantiate a TextCall object to modify this text component's state.
|
||||
|
||||
Reference in New Issue
Block a user