mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 15:12:06 +00:00 
			
		
		
		
	address bot review comments
This commit is contained in:
		| @@ -132,15 +132,20 @@ class ProtoVarInt { | |||||||
|   uint64_t value_; |   uint64_t value_; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| // Forward declaration for decode_to_message |  | ||||||
| class ProtoMessage; |  | ||||||
|  |  | ||||||
| class ProtoLengthDelimited { | class ProtoLengthDelimited { | ||||||
|  public: |  public: | ||||||
|   explicit ProtoLengthDelimited(const uint8_t *value, size_t length) : value_(value), length_(length) {} |   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_); } |   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; |   void decode_to_message(ProtoMessage &msg) const; | ||||||
|  |  | ||||||
|  protected: |  protected: | ||||||
|   | |||||||
| @@ -540,7 +540,10 @@ class MessageType(TypeInfo): | |||||||
|  |  | ||||||
|     @property |     @property | ||||||
|     def decode_length(self) -> str: |     def decode_length(self) -> str: | ||||||
|         # For non-template decoding, we need to handle this differently |         # Override to return None for message types because we can't use template-based | ||||||
|  |         # decoding when the specific message type isn't known at compile time. | ||||||
|  |         # Instead, we use the non-template decode_to_message() method which allows | ||||||
|  |         # runtime polymorphism through virtual function calls. | ||||||
|         return None |         return None | ||||||
|  |  | ||||||
|     @property |     @property | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user