47 lines
1.6 KiB
Django/Jinja
47 lines
1.6 KiB
Django/Jinja
// Generated file - DO NOT MODIFY
|
|
#pragma once
|
|
|
|
#include <glacier/buffer/byte_buffer.h>
|
|
#include <glacier/buffer/cap_buffer.h>
|
|
#include <glacier/container/vector.h>
|
|
#include <glacier/string/string.h>
|
|
#include <ztypes.h>
|
|
|
|
|
|
{%- for message in messages %}
|
|
class {{message.name}} {
|
|
public:
|
|
{{message.name}}() {}
|
|
// Delete copy and move until implemented.
|
|
{{message.name}}(const {{message.name}}&) = delete;
|
|
{{message.name}}({{message.name}}&&) = delete;
|
|
|
|
void ParseFromBytes(const glcr::ByteBuffer&, uint64_t offset);
|
|
void ParseFromBytes(const glcr::ByteBuffer&, uint64_t offset, const glcr::CapBuffer&);
|
|
uint64_t SerializeToBytes(glcr::ByteBuffer&, uint64_t offset) const;
|
|
uint64_t SerializeToBytes(glcr::ByteBuffer&, uint64_t offset, glcr::CapBuffer&) const;
|
|
|
|
{%- for field in message.fields %}
|
|
{%- 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; }
|
|
{%- else %}
|
|
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 %}
|
|
{%- endfor %}
|
|
|
|
private:
|
|
{%- for field in message.fields %}
|
|
{%- if not field.repeated %}
|
|
{{field.cpp_type()}} {{field.name}}_;
|
|
{%- else %}
|
|
glcr::Vector<{{field.cpp_type()}}> {{field.name}}_;
|
|
{%- endif %}
|
|
{%- endfor %}
|
|
|
|
// Parses everything except for caps.
|
|
void ParseFromBytesInternal(const glcr::ByteBuffer&, uint64_t offset);
|
|
};
|
|
{%- endfor %}
|