From ad15f0ec0074c1245505a016d348bcc1ce9ad01b Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Mon, 4 Dec 2023 17:32:38 +0100 Subject: codec: Added simple schema build helper --- modules/codec/c++/schema_builder.h | 46 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 modules/codec/c++/schema_builder.h (limited to 'modules/codec/c++/schema_builder.h') diff --git a/modules/codec/c++/schema_builder.h b/modules/codec/c++/schema_builder.h new file mode 100644 index 0000000..91094fe --- /dev/null +++ b/modules/codec/c++/schema_builder.h @@ -0,0 +1,46 @@ +#pragma once + +#include "schema.h" + +namespace saw { +template +struct schema_factory { + using Schema = T; + static_assert(always_false, "Not supported"); +}; + +template +struct schema_factory...>> { + using Schema = schema::Struct...>; + + template + constexpr schema_factory...,schema::Member>> add() const noexcept { + return {}; + } +}; + +template +struct schema_factory...>> { + using Schema = schema::Union...>; + + template + constexpr schema_factory...,schema::Member>> add() const noexcept { + return {}; + } +}; + +template +struct schema_factory> { + using Schema = schema::Tuple; + + template + constexpr schema_factory> add() const noexcept { + return {}; + } +}; + +template +constexpr schema_factory build_schema() noexcept { + return {}; +} +} -- cgit v1.2.3