mirror of
https://github.com/esphome/esphome.git
synced 2025-11-18 07:45:56 +00:00
[number] Modernize to C++17 nested namespaces (#11945)
This commit is contained in:
@@ -1,8 +1,7 @@
|
|||||||
#include "automation.h"
|
#include "automation.h"
|
||||||
#include "esphome/core/log.h"
|
#include "esphome/core/log.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome::number {
|
||||||
namespace number {
|
|
||||||
|
|
||||||
static const char *const TAG = "number.automation";
|
static const char *const TAG = "number.automation";
|
||||||
|
|
||||||
@@ -52,5 +51,4 @@ void ValueRangeTrigger::on_state_(float state) {
|
|||||||
this->rtc_.save(&in_range);
|
this->rtc_.save(&in_range);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace number
|
} // namespace esphome::number
|
||||||
} // namespace esphome
|
|
||||||
|
|||||||
@@ -4,8 +4,7 @@
|
|||||||
#include "esphome/core/automation.h"
|
#include "esphome/core/automation.h"
|
||||||
#include "esphome/core/component.h"
|
#include "esphome/core/component.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome::number {
|
||||||
namespace number {
|
|
||||||
|
|
||||||
class NumberStateTrigger : public Trigger<float> {
|
class NumberStateTrigger : public Trigger<float> {
|
||||||
public:
|
public:
|
||||||
@@ -91,5 +90,4 @@ template<typename... Ts> class NumberInRangeCondition : public Condition<Ts...>
|
|||||||
float max_{NAN};
|
float max_{NAN};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace number
|
} // namespace esphome::number
|
||||||
} // namespace esphome
|
|
||||||
|
|||||||
@@ -3,8 +3,7 @@
|
|||||||
#include "esphome/core/controller_registry.h"
|
#include "esphome/core/controller_registry.h"
|
||||||
#include "esphome/core/log.h"
|
#include "esphome/core/log.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome::number {
|
||||||
namespace number {
|
|
||||||
|
|
||||||
static const char *const TAG = "number";
|
static const char *const TAG = "number";
|
||||||
|
|
||||||
@@ -43,5 +42,4 @@ void Number::add_on_state_callback(std::function<void(float)> &&callback) {
|
|||||||
this->state_callback_.add(std::move(callback));
|
this->state_callback_.add(std::move(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace number
|
} // namespace esphome::number
|
||||||
} // namespace esphome
|
|
||||||
|
|||||||
@@ -6,8 +6,7 @@
|
|||||||
#include "number_call.h"
|
#include "number_call.h"
|
||||||
#include "number_traits.h"
|
#include "number_traits.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome::number {
|
||||||
namespace number {
|
|
||||||
|
|
||||||
class Number;
|
class Number;
|
||||||
void log_number(const char *tag, const char *prefix, const char *type, Number *obj);
|
void log_number(const char *tag, const char *prefix, const char *type, Number *obj);
|
||||||
@@ -53,5 +52,4 @@ class Number : public EntityBase {
|
|||||||
CallbackManager<void(float)> state_callback_;
|
CallbackManager<void(float)> state_callback_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace number
|
} // namespace esphome::number
|
||||||
} // namespace esphome
|
|
||||||
|
|||||||
@@ -2,8 +2,7 @@
|
|||||||
#include "number.h"
|
#include "number.h"
|
||||||
#include "esphome/core/log.h"
|
#include "esphome/core/log.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome::number {
|
||||||
namespace number {
|
|
||||||
|
|
||||||
static const char *const TAG = "number";
|
static const char *const TAG = "number";
|
||||||
|
|
||||||
@@ -125,5 +124,4 @@ void NumberCall::perform() {
|
|||||||
this->parent_->control(target_value);
|
this->parent_->control(target_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace number
|
} // namespace esphome::number
|
||||||
} // namespace esphome
|
|
||||||
|
|||||||
@@ -4,8 +4,7 @@
|
|||||||
#include "esphome/core/log.h"
|
#include "esphome/core/log.h"
|
||||||
#include "number_traits.h"
|
#include "number_traits.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome::number {
|
||||||
namespace number {
|
|
||||||
|
|
||||||
class Number;
|
class Number;
|
||||||
|
|
||||||
@@ -44,5 +43,4 @@ class NumberCall {
|
|||||||
bool cycle_;
|
bool cycle_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace number
|
} // namespace esphome::number
|
||||||
} // namespace esphome
|
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
#include "esphome/core/log.h"
|
#include "esphome/core/log.h"
|
||||||
#include "number_traits.h"
|
#include "number_traits.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome::number {
|
||||||
namespace number {
|
|
||||||
|
|
||||||
static const char *const TAG = "number";
|
static const char *const TAG = "number";
|
||||||
|
|
||||||
} // namespace number
|
} // namespace esphome::number
|
||||||
} // namespace esphome
|
|
||||||
|
|||||||
@@ -3,8 +3,7 @@
|
|||||||
#include "esphome/core/entity_base.h"
|
#include "esphome/core/entity_base.h"
|
||||||
#include "esphome/core/helpers.h"
|
#include "esphome/core/helpers.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome::number {
|
||||||
namespace number {
|
|
||||||
|
|
||||||
enum NumberMode : uint8_t {
|
enum NumberMode : uint8_t {
|
||||||
NUMBER_MODE_AUTO = 0,
|
NUMBER_MODE_AUTO = 0,
|
||||||
@@ -35,5 +34,4 @@ class NumberTraits : public EntityBase_DeviceClass, public EntityBase_UnitOfMeas
|
|||||||
NumberMode mode_{NUMBER_MODE_AUTO};
|
NumberMode mode_{NUMBER_MODE_AUTO};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace number
|
} // namespace esphome::number
|
||||||
} // namespace esphome
|
|
||||||
|
|||||||
Reference in New Issue
Block a user