mirror of
https://github.com/esphome/esphome.git
synced 2024-11-10 01:07:45 +01:00
[helpers] Move Base64 string to cpp (#6819)
This commit is contained in:
parent
54b51269ab
commit
f07479419c
2 changed files with 4 additions and 4 deletions
|
@ -433,6 +433,10 @@ int8_t step_to_accuracy_decimals(float step) {
|
||||||
return str.length() - dot_pos - 1;
|
return str.length() - dot_pos - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const std::string BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||||
|
"abcdefghijklmnopqrstuvwxyz"
|
||||||
|
"0123456789+/";
|
||||||
|
|
||||||
static inline bool is_base64(char c) { return (isalnum(c) || (c == '+') || (c == '/')); }
|
static inline bool is_base64(char c) { return (isalnum(c) || (c == '+') || (c == '/')); }
|
||||||
|
|
||||||
std::string base64_encode(const std::vector<uint8_t> &buf) { return base64_encode(buf.data(), buf.size()); }
|
std::string base64_encode(const std::vector<uint8_t> &buf) { return base64_encode(buf.data(), buf.size()); }
|
||||||
|
|
|
@ -435,10 +435,6 @@ std::string value_accuracy_to_string(float value, int8_t accuracy_decimals);
|
||||||
/// Derive accuracy in decimals from an increment step.
|
/// Derive accuracy in decimals from an increment step.
|
||||||
int8_t step_to_accuracy_decimals(float step);
|
int8_t step_to_accuracy_decimals(float step);
|
||||||
|
|
||||||
static const std::string BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
|
||||||
"abcdefghijklmnopqrstuvwxyz"
|
|
||||||
"0123456789+/";
|
|
||||||
|
|
||||||
std::string base64_encode(const uint8_t *buf, size_t buf_len);
|
std::string base64_encode(const uint8_t *buf, size_t buf_len);
|
||||||
std::string base64_encode(const std::vector<uint8_t> &buf);
|
std::string base64_encode(const std::vector<uint8_t> &buf);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue