PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
ArduinoJson
src
ArduinoJson
Deserialization
Readers
ArduinoStreamReader.hpp
1
// ArduinoJson - arduinojson.org
2
// Copyright Benoit Blanchon 2014-2020
3
// MIT License
4
5
#pragma once
6
7
#include <Arduino.h>
8
9
namespace
ARDUINOJSON_NAMESPACE {
10
11
template
<
typename
TSource>
12
struct
Reader
<TSource,
13
typename
enable_if
<
is_base_of
<
Stream
, TSource>::value>
::type
> {
14
public
:
15
explicit
Reader
(
Stream
& stream) : _stream(&stream) {}
16
17
int
read() {
18
// don't use _stream.read() as it ignores the timeout
19
char
c;
20
return
_stream->readBytes(&c, 1) ?
static_cast<
unsigned
char
>
(c) : -1;
21
}
22
23
size_t
readBytes(
char
* buffer,
size_t
length) {
24
return
_stream->readBytes(buffer, length);
25
}
26
27
private
:
28
Stream
* _stream;
29
};
30
31
}
// namespace ARDUINOJSON_NAMESPACE
ARDUINOJSON_NAMESPACE::enable_if
Definition:
enable_if.hpp:13
ARDUINOJSON_NAMESPACE::Reader
Definition:
Reader.hpp:15
type
ARDUINOJSON_NAMESPACE::is_base_of
Definition:
is_base_of.hpp:14
Stream
Definition:
Issue978.cpp:7
Generated on Fri May 20 2022 16:48:01 for PropWare by
1.8.17