summaryrefslogtreecommitdiff
path: root/include/lib/ArduinoJson/Deserialization/Reader.hpp
blob: 7b590ee0423eaba2d7a58b90f72e484f9ff3bf23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// ArduinoJson - https://arduinojson.org
// Copyright Benoit Blanchon 2014-2021
// MIT License

#pragma once

#include "lib/ArduinoJson/Namespace.hpp"

#include <stdlib.h>  // for size_t

namespace ARDUINOJSON_NAMESPACE {

// The default reader is a simple wrapper for Readers that are not copiable
template <typename TSource, typename Enable = void>
struct Reader {
 public:
  Reader(TSource& source) : _source(&source) {}

  int read() {
    return _source->read();
  }

  size_t readBytes(char* buffer, size_t length) {
    return _source->readBytes(buffer, length);
  }

 private:
  TSource* _source;
};

template <typename TSource, typename Enable = void>
struct BoundedReader {
  // no default implementation because we need to pass the size to the
  // constructor
};
}  // namespace ARDUINOJSON_NAMESPACE

#include "lib/ArduinoJson/Deserialization/Readers/IteratorReader.hpp"
#include "lib/ArduinoJson/Deserialization/Readers/RamReader.hpp"
#include "lib/ArduinoJson/Deserialization/Readers/VariantReader.hpp"

#if ARDUINOJSON_ENABLE_ARDUINO_STREAM
#include "lib/ArduinoJson/Deserialization/Readers/ArduinoStreamReader.hpp"
#endif

#if ARDUINOJSON_ENABLE_ARDUINO_STRING
#include "lib/ArduinoJson/Deserialization/Readers/ArduinoStringReader.hpp"
#endif

#if ARDUINOJSON_ENABLE_PROGMEM
#include "lib/ArduinoJson/Deserialization/Readers/FlashReader.hpp"
#endif

#if ARDUINOJSON_ENABLE_STD_STREAM
#include "lib/ArduinoJson/Deserialization/Readers/StdStreamReader.hpp"
#endif