mirror of
https://github.com/esphome/esphome.git
synced 2024-11-30 10:44:13 +01:00
replaced std::string with a simple pointer to the string literal in main.cpp
This commit is contained in:
parent
889b2f24bb
commit
0ec353c112
2 changed files with 7 additions and 5 deletions
|
@ -13,10 +13,10 @@ void StoreYamlComponent::dump_config() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string StoreYamlComponent::get_yaml() const { return this->yaml_; }
|
const char *StoreYamlComponent::get_yaml() const { return this->yaml_; }
|
||||||
|
|
||||||
void StoreYamlComponent::log(bool dump_config) const {
|
void StoreYamlComponent::log(bool dump_config) const {
|
||||||
const char *s = this->yaml_.c_str();
|
const char *s = this->yaml_;
|
||||||
while (*s) {
|
while (*s) {
|
||||||
const char *e = s;
|
const char *e = s;
|
||||||
while (*e && *e++ != '\n')
|
while (*e && *e++ != '\n')
|
||||||
|
|
|
@ -3,17 +3,19 @@
|
||||||
#include "esphome/core/component.h"
|
#include "esphome/core/component.h"
|
||||||
#include "esphome/core/automation.h"
|
#include "esphome/core/automation.h"
|
||||||
|
|
||||||
|
extern const char ESPHOME_YAML[];
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome {
|
||||||
namespace store_yaml {
|
namespace store_yaml {
|
||||||
class StoreYamlComponent : public Component {
|
class StoreYamlComponent : public Component {
|
||||||
bool show_in_dump_config_{false};
|
bool show_in_dump_config_{false};
|
||||||
std::string yaml_;
|
const char *yaml_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void dump_config() override;
|
void dump_config() override;
|
||||||
void set_show_in_dump_config(bool show) { this->show_in_dump_config_ = show; }
|
void set_show_in_dump_config(bool show) { this->show_in_dump_config_ = show; }
|
||||||
void set_yaml(const std::string &yaml) { this->yaml_ = yaml; }
|
void set_yaml(const char *yaml) { this->yaml_ = yaml; }
|
||||||
std::string get_yaml() const;
|
const char *get_yaml() const;
|
||||||
void log(bool dump_config = false) const;
|
void log(bool dump_config = false) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue