summaryrefslogtreecommitdiff
path: root/modules/codec/c++
diff options
context:
space:
mode:
authorClaudius "keldu" Holeksa <mail@keldu.de>2024-01-08 00:53:56 +0100
committerClaudius "keldu" Holeksa <mail@keldu.de>2024-01-08 00:53:56 +0100
commit921c500a02f1c3926318732bbee80a0c79b55c1f (patch)
treec51cd12cec10741484aca0587f0ee0a1657d25b6 /modules/codec/c++
parentb8a5458a7493de17516bdb172f6a3a208dfc5eed (diff)
codec: Bringing testing into a proper state and getting all tests except
one to run
Diffstat (limited to 'modules/codec/c++')
-rw-r--r--modules/codec/c++/csv.h27
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>();
}