summaryrefslogtreecommitdiff
path: root/modules/codec-json
diff options
context:
space:
mode:
authorClaudius 'keldu' Holeksa <mail@keldu.de>2024-08-22 11:45:47 +0200
committerClaudius 'keldu' Holeksa <mail@keldu.de>2024-08-22 11:45:47 +0200
commit1fb10980808d66dfa6dec4ac87857d5c13bf7298 (patch)
tree02753bd4f81b9df25fc2e3edd1542b9b2df22fb9 /modules/codec-json
parent0a80ef11db96a9259d9ec01d7d4d7e9023f3184c (diff)
Removing storage as a parameter
Diffstat (limited to 'modules/codec-json')
-rw-r--r--modules/codec-json/c++/json.tmpl.hpp6
-rw-r--r--modules/codec-json/tests/codec-json.cpp38
2 files changed, 22 insertions, 22 deletions
diff --git a/modules/codec-json/c++/json.tmpl.hpp b/modules/codec-json/c++/json.tmpl.hpp
index 8663d5a..bead73a 100644
--- a/modules/codec-json/c++/json.tmpl.hpp
+++ b/modules/codec-json/c++/json.tmpl.hpp
@@ -837,7 +837,7 @@ struct json_decode<schema::Array<T,D>, ToDecode> {
using Schema = schema::Array<T,D>;
template<size_t Level>
- static error_or<void> decode_flat_level(buffer_view& buff, std::vector<data<T, encode::Native, storage::Default>>& to, std::array<std::size_t, D>& index, std::array<std::size_t, D>& dims, bool log_dim){
+ static error_or<void> decode_flat_level(buffer_view& buff, std::vector<data<T, encode::Native>>& to, std::array<std::size_t, D>& index, std::array<std::size_t, D>& dims, bool log_dim){
if constexpr (Level == D) {
json_helper::skip_whitespace(buff);
@@ -903,7 +903,7 @@ struct json_decode<schema::Array<T,D>, ToDecode> {
}
template<std::size_t Level>
- static error_or<void> decode_unflat_level(std::vector<data<T,encode::Native, storage::Default>>& flat, data<schema::Array<T,D>, ToDecode>& to, std::array<std::size_t, D>& index, std::size_t& flat_index) {
+ static error_or<void> decode_unflat_level(std::vector<data<T,encode::Native>>& flat, data<schema::Array<T,D>, ToDecode>& to, std::array<std::size_t, D>& index, std::size_t& flat_index) {
if constexpr ( Level == D ){
auto& flat_data = flat.at(flat_index);
to.at(index) = std::move(flat_data);
@@ -925,7 +925,7 @@ struct json_decode<schema::Array<T,D>, ToDecode> {
std::array<std::size_t, D> index;
std::array<std::size_t, D> dims;
std::fill(dims.begin(), dims.end(), 0);
- std::vector<data<T,encode::Native, storage::Default>> flat_array;
+ std::vector<data<T,encode::Native>> flat_array;
auto eov = decode_flat_level<0>(buff, flat_array, index, dims, true);
if(eov.is_error()){
return eov;
diff --git a/modules/codec-json/tests/codec-json.cpp b/modules/codec-json/tests/codec-json.cpp
index bc1540e..1d6c0f0 100644
--- a/modules/codec-json/tests/codec-json.cpp
+++ b/modules/codec-json/tests/codec-json.cpp
@@ -34,7 +34,7 @@ using TestStructArrayStruct = Struct<
SAW_TEST("UInt8 write"){
using namespace saw;
- data<schema::UInt8, encode::Native, storage::Default> native_int;
+ data<schema::UInt8, encode::Native> native_int;
data<schema::UInt8, encode::Json> json_int;
native_int.set(121);
@@ -54,7 +54,7 @@ SAW_TEST("UInt8 write"){
SAW_TEST("UInt16 write"){
using namespace saw;
- data<schema::UInt16, encode::Native, storage::Default> native_int;
+ data<schema::UInt16, encode::Native> native_int;
data<schema::UInt16, encode::Json> json_int;
native_int.set(24413);
@@ -74,7 +74,7 @@ SAW_TEST("UInt16 write"){
SAW_TEST("UInt32 write"){
using namespace saw;
- data<schema::UInt32, encode::Native, storage::Default> native_int;
+ data<schema::UInt32, encode::Native> native_int;
data<schema::UInt32, encode::Json> json_int;
native_int.set(44123);
@@ -94,7 +94,7 @@ SAW_TEST("UInt32 write"){
SAW_TEST("UInt64 write"){
using namespace saw;
- data<schema::UInt64, encode::Native, storage::Default> native_int;
+ data<schema::UInt64, encode::Native> native_int;
data<schema::UInt64, encode::Json> json_int;
native_int.set(243345543);
@@ -114,7 +114,7 @@ SAW_TEST("UInt64 write"){
SAW_TEST("Int8 write"){
using namespace saw;
- data<schema::Int8, encode::Native, storage::Default> native_int;
+ data<schema::Int8, encode::Native> native_int;
data<schema::Int8, encode::Json> json_int;
native_int.set(-121);
@@ -134,7 +134,7 @@ SAW_TEST("Int8 write"){
SAW_TEST("Int16 write"){
using namespace saw;
- data<schema::Int16, encode::Native, storage::Default> native_int;
+ data<schema::Int16, encode::Native> native_int;
data<schema::Int16, encode::Json> json_int;
native_int.set(-24413);
@@ -154,7 +154,7 @@ SAW_TEST("Int16 write"){
SAW_TEST("Int32 write"){
using namespace saw;
- data<schema::Int32, encode::Native, storage::Default> native_int;
+ data<schema::Int32, encode::Native> native_int;
data<schema::Int32, encode::Json> json_int;
native_int.set(44123);
@@ -174,7 +174,7 @@ SAW_TEST("Int32 write"){
SAW_TEST("Int64 write"){
using namespace saw;
- data<schema::Int64, encode::Native, storage::Default> native_int;
+ data<schema::Int64, encode::Native> native_int;
data<schema::Int64, encode::Json> json_int;
native_int.set(243345543);
@@ -194,7 +194,7 @@ SAW_TEST("Int64 write"){
SAW_TEST("String write and read"){
using namespace saw;
- data<schema::String, encode::Native, storage::Default> nat_str;
+ data<schema::String, encode::Native> nat_str;
data<schema::String, encode::Json> json_str;
nat_str.set("foo");
@@ -221,7 +221,7 @@ SAW_TEST("String write and read"){
SAW_TEST("Tuple read and write"){
using namespace saw;
- data<schema::TestTuple, encode::Native, storage::Default> native_tup;
+ data<schema::TestTuple, encode::Native> native_tup;
data<schema::TestTuple, encode::Json> json_tup;
auto& nat_zero = native_tup.template get<0>();
@@ -250,7 +250,7 @@ SAW_TEST("Tuple read and write"){
SAW_TEST("Array write"){
using namespace saw;
- data<schema::TestArray, encode::Native, storage::Default> native{3u};
+ data<schema::TestArray, encode::Native> native{3u};
data<schema::TestArray, encode::Json> json;
native.at(0).set("foo");
@@ -270,7 +270,7 @@ SAW_TEST("Array write"){
SAW_TEST("Three Dim Array write and read"){
using namespace saw;
- data<schema::TestMultiArray, encode::Native, storage::Default> native{2,1,2};
+ data<schema::TestMultiArray, encode::Native> native{2,1,2};
data<schema::TestMultiArray, encode::Json> json;
native.at(0,0,0).set("multi");
@@ -300,7 +300,7 @@ SAW_TEST("Three Dim Array write and read"){
SAW_TEST("Struct read and write"){
using namespace saw;
- data<schema::TestStruct, encode::Native, storage::Default> native;
+ data<schema::TestStruct, encode::Native> native;
data<schema::TestStruct, encode::Json> json;
native.get<"foo">().set(5);
@@ -325,7 +325,7 @@ SAW_TEST("Struct read and write"){
SAW_TEST("Array Struct Empty read and write"){
using namespace saw;
- data<schema::TestArrayStruct, encode::Native, storage::Default> native{0u};
+ data<schema::TestArrayStruct, encode::Native> native{0u};
data<schema::TestArrayStruct, encode::Json> json;
codec<schema::TestArrayStruct, encode::Json> json_codec;
@@ -345,7 +345,7 @@ SAW_TEST("Array Struct Empty read and write"){
SAW_TEST("Array Struct read and write"){
using namespace saw;
- data<schema::TestArrayStruct, encode::Native, storage::Default> native{4u};
+ data<schema::TestArrayStruct, encode::Native> native{4u};
data<schema::TestArrayStruct, encode::Json> json;
native.at(0).get<"foo">().set(5);
@@ -374,7 +374,7 @@ SAW_TEST("Array Struct read and write"){
SAW_TEST("Struct Array Struct read and write"){
using namespace saw;
- data<schema::TestStructArrayStruct, encode::Native, storage::Default> native;
+ data<schema::TestStructArrayStruct, encode::Native> native;
native.template get<"banana">() = {4u};
data<schema::TestStructArrayStruct, encode::Json> json;
@@ -404,7 +404,7 @@ SAW_TEST("Struct Array Struct read and write"){
SAW_TEST("Int8 read"){
using namespace saw;
- data<schema::Int8, encode::Native, storage::Default> native_int;
+ data<schema::Int8, encode::Native> native_int;
data<schema::Int8, encode::Json> json_int{"43"};
codec<schema::Int8, encode::Json> json_codec;
@@ -422,7 +422,7 @@ SAW_TEST("Int8 read"){
SAW_TEST("Int64 read"){
using namespace saw;
- data<schema::Int64, encode::Native, storage::Default> native_int;
+ data<schema::Int64, encode::Native> native_int;
data<schema::Int64, encode::Json> json_int{"-453"};
codec<schema::Int64, encode::Json> json_codec;
@@ -440,7 +440,7 @@ SAW_TEST("Int64 read"){
SAW_TEST("Tuple Pretty Encode and Decode"){
using namespace saw;
- data<schema::TestTuple, encode::Native, storage::Default> native_tup;
+ data<schema::TestTuple, encode::Native> native_tup;
data<schema::TestTuple, encode::Json> json_tup;
auto& nat_zero = native_tup.template get<0>();