mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 07:03:55 +00:00 
			
		
		
		
	change name ESPHOME_EMPTY -> NONE
This commit is contained in:
		| @@ -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_; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user