From b84b576a221684a39ef12891bafd233ba6289b09 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Sun, 11 Jun 2023 19:24:59 +0200 Subject: c++, codec-json: Added testing for tuples and fixed minor buffer changes --- src/core/buffer.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/core/buffer.cpp') diff --git a/src/core/buffer.cpp b/src/core/buffer.cpp index 81fc0df..15f4cae 100644 --- a/src/core/buffer.cpp +++ b/src/core/buffer.cpp @@ -60,14 +60,7 @@ error buffer::pop(uint8_t &buffer, size_t size) { return no_error(); } -std::string buffer::to_string() const { - std::ostringstream oss; - for (size_t i = 0; i < read_composite_length(); ++i) { - oss << read(i); - } - return oss.str(); -} - +/* std::string buffer::to_hex() const { std::ostringstream oss; oss << std::hex << std::setfill('0'); @@ -79,6 +72,15 @@ std::string buffer::to_hex() const { } return oss.str(); } +*/ + +std::string convert_to_string(const buffer& buff){ + std::ostringstream oss; + for (size_t i = 0; i < buff.read_composite_length(); ++i) { + oss << buff.read(i); + } + return oss.str(); +} buffer_view::buffer_view(buffer &buffer) : buffer_{&buffer}, read_offset_{0}, write_offset_{0} {} -- cgit v1.2.3