diff options
Diffstat (limited to 'modules/codec/c++/csv.h')
-rw-r--r-- | modules/codec/c++/csv.h | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/modules/codec/c++/csv.h b/modules/codec/c++/csv.h index f40376f..1664c31 100644 --- a/modules/codec/c++/csv.h +++ b/modules/codec/c++/csv.h @@ -25,14 +25,14 @@ struct csv_encode<schema::Array<T,Dim>, FromDecode> { static error_or<void> encode(const data<Schema, FromDecode>& from, data<Schema, encode::Csv>& to){ if constexpr (is_struct<T>::value){ - auto eov = csv_encode<T>::encode_header(to); + auto eov = csv_encode<T,FromDecode>::encode_header(to); if(eov.is_error()){ return eov; } } for(std::size_t i = 0; i < from.size(); ++i){ - auto eov = csv_encode<T>::encode(from.at(i), to); + auto eov = csv_encode<T,FromDecode>::encode(from.at(i), to); if(eov.is_error()){ return eov; } @@ -42,6 +42,21 @@ struct csv_encode<schema::Array<T,Dim>, FromDecode> { } }; +template<typename... V, string_literal... K, typename FromDecode> +struct csv_encode<schema::Struct<schema::Member<V,K>...>, FromDecode> { + using Schema = schema::Struct<schema::Member<V,K>...>; + + static error_or<void> encode_header(const data<Schema, encode::Csv>& to){ + return make_error<err::not_implemented>(); + } + + static error_or<void> encode(const data<Schema, FromDecode>& from, data<Schema,encode::Csv>& to){ + + + return make_error<err::not_implemented>(); + } +}; + template<typename FromDecode> struct csv_encode<schema::String, FromDecode> { using Schema = schema::String; @@ -64,6 +79,12 @@ struct csv_encode<schema::Primitive<T,N>, FromDecode> { } template<typename Schema> +class data<Schema, encode::Csv> { + private: + public: +}; + +template<typename Schema> class codec<Schema, encode::Csv> { static_assert(is_array<Schema>::value, "Only an Array is allowed as a base value"); public: @@ -74,7 +95,7 @@ public: } template<typename ToDecode> - static error_or<void> decode(data<Schema,encode::Csv>& from, data<Schema, FromEncode>& to){ + static error_or<void> decode(data<Schema,encode::Csv>& from, data<Schema, ToDecode>& to){ return make_error<err::not_implemented>(); } |