[Yunq] Add support for nested fields in messages.

This commit is contained in:
Drew Galbraith 2024-01-11 21:32:08 -08:00
parent 9e12531651
commit a48d63a664
18 changed files with 257 additions and 219 deletions

View file

@ -28,6 +28,12 @@ class {{message.name}} {
uint64_t SerializeToBytes(glcr::ByteBuffer&, uint64_t offset, glcr::CapBuffer&) const;
{%- for field in message.fields %}
{%- if field.type == Type.MESSAGE %}
const {{field.cpp_type()}}& {{field.name}}() const { return {{field.name}}_; }
{{field.cpp_type()}}& mutable_{{field.name}}() { return {{field.name}}_; }
{%- else %}
{%- if not field.repeated %}
const {{field.cpp_type()}}& {{field.name}}() const { return {{field.name}}_; }
void set_{{field.name}}(const {{field.cpp_type()}}& value) { {{field.name}}_ = value; }
@ -35,6 +41,8 @@ class {{message.name}} {
const glcr::Vector<{{field.cpp_type()}}>& {{field.name}}() const { return {{field.name}}_; }
void add_{{field.name}}(const {{field.cpp_type()}}& value) { {{field.name}}_.PushBack(value); }
{%- endif %}
{%- endif %}
{%- endfor %}
private: