idl-compiler.py: generate skip() definition for enums serializers

Currently they only have the declaration and so far they got away with
it, looks like no users exists, but this is about to change so generate
the definition too.
This commit is contained in:
Botond Dénes
2025-06-20 13:05:28 +03:00
parent b0d5462440
commit 093d4f8d69

View File

@@ -196,6 +196,16 @@ template<typename Input>
return static_cast<{name}>(deserialize(buf, std::type_identity<{self.underlying_type}>()));
}}""")
def serializer_skip_impl(self, cout):
name = self.ns_qualified_name()
fprintln(cout, f"""
{self.template_declaration}
template<typename Input>
void serializer<{name}>::skip(Input& buf) {{
buf.skip(sizeof({self.underlying_type}));
}}""")
class Attributes(ASTBase):
''' AST node for representing class and field attributes.
@@ -839,6 +849,7 @@ def handle_enum(enum, hout, cout):
enum.serializer_write_impl(cout)
enum.serializer_read_impl(cout)
enum.serializer_skip_impl(cout)
def join_template(template_params):