From 87db03e9ffa559eaf5f6b970ad42776f33ae34b2 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Thu, 8 Jan 2026 19:03:09 +0100 Subject: dangling --- modules/codec/c++/data_print.hpp | 94 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 modules/codec/c++/data_print.hpp (limited to 'modules/codec/c++/data_print.hpp') diff --git a/modules/codec/c++/data_print.hpp b/modules/codec/c++/data_print.hpp new file mode 100644 index 0000000..8eba274 --- /dev/null +++ b/modules/codec/c++/data_print.hpp @@ -0,0 +1,94 @@ +#pragma once + +#include "data.hpp" +#include + +namespace saw { +namespace impl { +struct data_print_tab_helper { + static void apply(std::ostream& o, uint64_t tabs){ + for(uint64_t i = 0u; i < tabs; ++i){ + o<<'\t'; + } + } +}; + +template +struct data_print_std_helper { + static void apply(std::ostream& o, const data& dat){ + // Blueprint + (void)o; + (void)dat; + } +}; + +template +struct data_print_std_helper, Encode> { + static void apply(std::ostream& o, const data,Encode>& dat, uint64_t tabs){ + (void) tabs; + // Blueprint + o< +struct data_print_std_helper { + static void apply(std::ostream& o, const data& dat, uint64_t tabs){ + (void) tabs; + // Blueprint + auto size = dat.size(); + o<<"\""; + for(saw::data i{0u}; i < size; ++i){ + o< +struct data_print_std_helper, Encode> { + static void apply(std::ostream& o, const data,Encode>& dat, uint64_t tabs){ + (void) tabs; + // Blueprint + auto size = dat.size(); + o<<"\""; + for(saw::data i{0u}; i < size; ++i){ + o< +struct data_print_std_helper, Encode> { + template + static void apply(std::ostream& o, const data,Encode>& dat, uint64_t tabs){ + if constexpr (i < sizeof...(Members)){ + using Memb = parameter_pack_type::type; + + data_print_tab_helper::apply(o,tabs); + o<<"- \""<::apply(o,dat.template get(), tabs); + o<<"\n"; + apply(o,dat,tabs); + } + } + + static void apply(std::ostream& o, const data,Encode>& dat, uint64_t tabs){ + data_print_tab_helper::apply(o,tabs); + + apply<0u>(o,dat,tabs+1u); + } +}; + +} +} + +namespace std { +template +inline ostream& operator<<(ostream& o, const saw::data& dat){ + + saw::impl::data_print_std_helper::apply(o, dat, 0u); + + return o; +} +} -- cgit v1.2.3