mirror of
https://github.com/esphome/esphome.git
synced 2025-11-19 08:15:49 +00:00
[core] Use ESPDEPRECATED macro for deprecation warnings (#11755)
This commit is contained in:
@@ -35,7 +35,7 @@ class Select : public EntityBase {
|
|||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
/// @deprecated Use current_option() instead. This member will be removed in ESPHome 2026.5.0.
|
/// @deprecated Use current_option() instead. This member will be removed in ESPHome 2026.5.0.
|
||||||
__attribute__((deprecated("Use current_option() instead of .state. Will be removed in 2026.5.0")))
|
ESPDEPRECATED("Use current_option() instead of .state. Will be removed in 2026.5.0", "2025.11.0")
|
||||||
std::string state{};
|
std::string state{};
|
||||||
|
|
||||||
Select() = default;
|
Select() = default;
|
||||||
|
|||||||
@@ -61,9 +61,10 @@ class EntityBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get/set this entity's icon
|
// Get/set this entity's icon
|
||||||
[[deprecated("Use get_icon_ref() instead for better performance (avoids string copy). Will stop working in ESPHome "
|
ESPDEPRECATED(
|
||||||
"2026.5.0")]] std::string
|
"Use get_icon_ref() instead for better performance (avoids string copy). Will be removed in ESPHome 2026.5.0",
|
||||||
get_icon() const;
|
"2025.11.0")
|
||||||
|
std::string get_icon() const;
|
||||||
void set_icon(const char *icon);
|
void set_icon(const char *icon);
|
||||||
StringRef get_icon_ref() const {
|
StringRef get_icon_ref() const {
|
||||||
static constexpr auto EMPTY_STRING = StringRef::from_lit("");
|
static constexpr auto EMPTY_STRING = StringRef::from_lit("");
|
||||||
@@ -160,9 +161,10 @@ class EntityBase {
|
|||||||
class EntityBase_DeviceClass { // NOLINT(readability-identifier-naming)
|
class EntityBase_DeviceClass { // NOLINT(readability-identifier-naming)
|
||||||
public:
|
public:
|
||||||
/// Get the device class, using the manual override if set.
|
/// Get the device class, using the manual override if set.
|
||||||
[[deprecated("Use get_device_class_ref() instead for better performance (avoids string copy). Will stop working in "
|
ESPDEPRECATED("Use get_device_class_ref() instead for better performance (avoids string copy). Will be removed in "
|
||||||
"ESPHome 2026.5.0")]] std::string
|
"ESPHome 2026.5.0",
|
||||||
get_device_class();
|
"2025.11.0")
|
||||||
|
std::string get_device_class();
|
||||||
/// Manually set the device class.
|
/// Manually set the device class.
|
||||||
void set_device_class(const char *device_class);
|
void set_device_class(const char *device_class);
|
||||||
/// Get the device class as StringRef
|
/// Get the device class as StringRef
|
||||||
@@ -178,9 +180,10 @@ class EntityBase_DeviceClass { // NOLINT(readability-identifier-naming)
|
|||||||
class EntityBase_UnitOfMeasurement { // NOLINT(readability-identifier-naming)
|
class EntityBase_UnitOfMeasurement { // NOLINT(readability-identifier-naming)
|
||||||
public:
|
public:
|
||||||
/// Get the unit of measurement, using the manual override if set.
|
/// Get the unit of measurement, using the manual override if set.
|
||||||
[[deprecated("Use get_unit_of_measurement_ref() instead for better performance (avoids string copy). Will stop "
|
ESPDEPRECATED("Use get_unit_of_measurement_ref() instead for better performance (avoids string copy). Will be "
|
||||||
"working in ESPHome 2026.5.0")]] std::string
|
"removed in ESPHome 2026.5.0",
|
||||||
get_unit_of_measurement();
|
"2025.11.0")
|
||||||
|
std::string get_unit_of_measurement();
|
||||||
/// Manually set the unit of measurement.
|
/// Manually set the unit of measurement.
|
||||||
void set_unit_of_measurement(const char *unit_of_measurement);
|
void set_unit_of_measurement(const char *unit_of_measurement);
|
||||||
/// Get the unit of measurement as StringRef
|
/// Get the unit of measurement as StringRef
|
||||||
|
|||||||
Reference in New Issue
Block a user