1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-30 06:33:51 +00:00

address bot review comments

This commit is contained in:
J. Nick Koston
2025-07-11 17:24:55 -10:00
parent 88049f9801
commit 427560f814
2 changed files with 13 additions and 5 deletions

View File

@@ -132,15 +132,20 @@ class ProtoVarInt {
uint64_t value_;
};
// Forward declaration for decode_to_message
class ProtoMessage;
class ProtoLengthDelimited {
public:
explicit ProtoLengthDelimited(const uint8_t *value, size_t length) : value_(value), length_(length) {}
std::string as_string() const { return std::string(reinterpret_cast<const char *>(this->value_), this->length_); }
// Non-template method to decode into an existing message instance
/**
* Decode the length-delimited data into an existing ProtoMessage instance.
*
* This method allows decoding without templates, enabling use in contexts
* where the message type is not known at compile time. The ProtoMessage's
* decode() method will be called with the raw data and length.
*
* @param msg The ProtoMessage instance to decode into
*/
void decode_to_message(ProtoMessage &msg) const;
protected: