ESPHome  1.15.1
Public Member Functions | Protected Member Functions | Protected Attributes
esphome::Nameable Class Referenceabstract

Helper class that enables naming of objects so that it doesn't have to be re-implement every time. More...

#include <component.h>

Inheritance diagram for esphome::Nameable:
esphome::binary_sensor::BinarySensor esphome::climate::Climate esphome::cover::Cover esphome::esp32_camera::ESP32Camera esphome::fan::FanState esphome::light::LightState esphome::sensor::Sensor esphome::switch_::Switch esphome::text_sensor::TextSensor

Public Member Functions

 Nameable ()
 
 Nameable (const std::string &name)
 
const std::string & get_name () const
 
void set_name (const std::string &name)
 
const std::string & get_object_id ()
 Get the sanitized name of this nameable as an ID. Caching it internally. More...
 
uint32_t get_object_id_hash ()
 
bool is_internal () const
 
void set_internal (bool internal)
 

Protected Member Functions

virtual uint32_t hash_base ()=0
 
void calc_object_id_ ()
 

Protected Attributes

std::string name_
 
std::string object_id_
 
uint32_t object_id_hash_
 
bool internal_ {false}
 

Detailed Description

Helper class that enables naming of objects so that it doesn't have to be re-implement every time.

Definition at line 244 of file component.h.

Constructor & Destructor Documentation

◆ Nameable() [1/2]

esphome::Nameable::Nameable ( )
inline

Definition at line 246 of file component.h.

◆ Nameable() [2/2]

esphome::Nameable::Nameable ( const std::string &  name)
explicit

Definition at line 174 of file component.cpp.

Member Function Documentation

◆ calc_object_id_()

void esphome::Nameable::calc_object_id_ ( )
protected

Definition at line 179 of file component.cpp.

◆ get_name()

const std::string & esphome::Nameable::get_name ( ) const

Definition at line 169 of file component.cpp.

◆ get_object_id()

const std::string & esphome::Nameable::get_object_id ( )

Get the sanitized name of this nameable as an ID. Caching it internally.

Definition at line 176 of file component.cpp.

◆ get_object_id_hash()

uint32_t esphome::Nameable::get_object_id_hash ( )

Definition at line 184 of file component.cpp.

◆ hash_base()

virtual uint32_t esphome::Nameable::hash_base ( )
protectedpure virtual

◆ is_internal()

bool esphome::Nameable::is_internal ( ) const

Definition at line 177 of file component.cpp.

◆ set_internal()

void esphome::Nameable::set_internal ( bool  internal)

Definition at line 178 of file component.cpp.

◆ set_name()

void esphome::Nameable::set_name ( const std::string &  name)

Definition at line 170 of file component.cpp.

Field Documentation

◆ internal_

bool esphome::Nameable::internal_ {false}
protected

Definition at line 265 of file component.h.

◆ name_

std::string esphome::Nameable::name_
protected

Definition at line 262 of file component.h.

◆ object_id_

std::string esphome::Nameable::object_id_
protected

Definition at line 263 of file component.h.

◆ object_id_hash_

uint32_t esphome::Nameable::object_id_hash_
protected

Definition at line 264 of file component.h.


The documentation for this class was generated from the following files: