1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-02 19:32:19 +01:00

change name ESPHOME_EMPTY -> NONE

This commit is contained in:
Tomasz Duda
2024-05-06 16:02:14 +02:00
parent 0152fddb34
commit 51719ec448

View File

@@ -24,7 +24,7 @@ template<int... S> struct gens<0, S...> { using type = seq<S...>; }; // NOLINT
template<typename T, typename... X> class TemplatableValue { template<typename T, typename... X> class TemplatableValue {
public: public:
TemplatableValue() : type_(ESPHOME_EMPTY) {} TemplatableValue() : type_(NONE) {}
template<typename F, enable_if_t<!is_invocable<F, X...>::value, int> = 0> template<typename F, enable_if_t<!is_invocable<F, X...>::value, int> = 0>
TemplatableValue(F value) : type_(VALUE), value_(value) {} TemplatableValue(F value) : type_(VALUE), value_(value) {}
@@ -32,13 +32,13 @@ template<typename T, typename... X> class TemplatableValue {
template<typename F, enable_if_t<is_invocable<F, X...>::value, int> = 0> template<typename F, enable_if_t<is_invocable<F, X...>::value, int> = 0>
TemplatableValue(F f) : type_(LAMBDA), f_(f) {} TemplatableValue(F f) : type_(LAMBDA), f_(f) {}
bool has_value() { return this->type_ != ESPHOME_EMPTY; } bool has_value() { return this->type_ != NONE; }
T value(X... x) { T value(X... x) {
if (this->type_ == LAMBDA) { if (this->type_ == LAMBDA) {
return this->f_(x...); return this->f_(x...);
} }
// return value also when empty // return value also when none
return this->value_; return this->value_;
} }
@@ -58,7 +58,7 @@ template<typename T, typename... X> class TemplatableValue {
protected: protected:
enum { enum {
ESPHOME_EMPTY, NONE,
VALUE, VALUE,
LAMBDA, LAMBDA,
} type_; } type_;