From 39895a677e5d370824e702cfe90ebc67737b8482 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 12 May 2021 09:12:09 +0200 Subject: import ArduinoJson 6.18.0 --- .../Deserialization/Readers/StdStreamReader.hpp | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 include/lib/ArduinoJson/Deserialization/Readers/StdStreamReader.hpp (limited to 'include/lib/ArduinoJson/Deserialization/Readers/StdStreamReader.hpp') diff --git a/include/lib/ArduinoJson/Deserialization/Readers/StdStreamReader.hpp b/include/lib/ArduinoJson/Deserialization/Readers/StdStreamReader.hpp new file mode 100644 index 0000000..eebaa2c --- /dev/null +++ b/include/lib/ArduinoJson/Deserialization/Readers/StdStreamReader.hpp @@ -0,0 +1,29 @@ +// ArduinoJson - https://arduinojson.org +// Copyright Benoit Blanchon 2014-2021 +// MIT License + +#pragma once + +#include + +namespace ARDUINOJSON_NAMESPACE { + +template +struct Reader::value>::type> { + public: + explicit Reader(std::istream& stream) : _stream(&stream) {} + + int read() { + return _stream->get(); + } + + size_t readBytes(char* buffer, size_t length) { + _stream->read(buffer, static_cast(length)); + return static_cast(_stream->gcount()); + } + + private: + std::istream* _stream; +}; +} // namespace ARDUINOJSON_NAMESPACE -- cgit v1.2.3