1
0
mirror of https://github.com/esphome/esphome.git synced 2026-02-08 08:41:59 +00:00
This commit is contained in:
J. Nick Koston
2026-01-02 21:56:38 -10:00
parent af8c453f7c
commit 979b96f7d4
2 changed files with 163 additions and 477 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -913,6 +913,10 @@ class PointerToStringBufferType(PointerToBufferTypeBase):
reference_type = "StringRef &"
const_reference_type = "const StringRef &"
@classmethod
def can_use_dump_field(cls) -> bool:
return True
@property
def public_content(self) -> list[str]:
return [f"StringRef {self.field_name}{{}};"]
@@ -929,15 +933,12 @@ class PointerToStringBufferType(PointerToBufferTypeBase):
}}"""
def dump(self, name: str) -> str:
return f'out.append("\'").append(this->{self.field_name}.c_str(), this->{self.field_name}.size()).append("\'");'
# Not used since we use dump_field, but required by abstract base class
return f'out.append("\'").append({name}.c_str(), {name}.size()).append("\'");'
@property
def dump_content(self) -> str:
return (
f'out.append(" {self.name}: ");\n'
+ f"{self.dump(self.field_name)}\n"
+ 'out.append("\\n");'
)
return f'dump_field(out, "{self.name}", this->{self.field_name});'
def get_size_calculation(self, name: str, force: bool = False) -> str:
return f"size.add_length({self.calculate_field_id_size()}, this->{self.field_name}.size());"