From c3dd050ec7d7e775b62b0a8160ec4be4f671f035 Mon Sep 17 00:00:00 2001 From: Claudius 'keldu' Holeksa Date: Mon, 19 Aug 2024 16:52:39 +0200 Subject: Allow easier conversion and extraction to stl data. Also fixing indent in json --- modules/codec-json/c++/json.tmpl.hpp | 4 ++-- modules/codec/c++/base64.hpp | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/codec-json/c++/json.tmpl.hpp b/modules/codec-json/c++/json.tmpl.hpp index e73e49d..70cc0d1 100644 --- a/modules/codec-json/c++/json.tmpl.hpp +++ b/modules/codec-json/c++/json.tmpl.hpp @@ -18,7 +18,7 @@ struct json_helper { static error_or print_pretty_indent(buffer& to, uint64_t depth){ { - auto eov = to.push(*reinterpret_cast("\r\n"), 2); + auto eov = to.push(*reinterpret_cast("\n")); if(!eov.template is_type()){ return eov; } @@ -751,7 +751,7 @@ struct json_decode...>, ToDecode> { // Check if there are no elements present in the JSON Struct if(buff.read() == '}'){ if(sizeof...(T) > 0){ - return make_error("Expected Struct ending '}'"); + return make_error("Expected non empty struct"); } buff.read_advance(1); return void_t{}; diff --git a/modules/codec/c++/base64.hpp b/modules/codec/c++/base64.hpp index fcd2f75..b65060e 100644 --- a/modules/codec/c++/base64.hpp +++ b/modules/codec/c++/base64.hpp @@ -30,6 +30,10 @@ public: return data_.at(i); } + std::string stl_string() const { + return data_; + } + bool operator==(const data& rhs) const { return data_ == rhs.data_; } -- cgit v1.2.3