Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
IteratorReader.hpp
00001 // ArduinoJson - arduinojson.org 00002 // Copyright Benoit Blanchon 2014-2021 00003 // MIT License 00004 00005 #pragma once 00006 00007 namespace ARDUINOJSON_NAMESPACE { 00008 00009 template <typename TIterator> 00010 class IteratorReader { 00011 TIterator _ptr, _end; 00012 00013 public: 00014 explicit IteratorReader(TIterator begin, TIterator end) 00015 : _ptr(begin), _end(end) {} 00016 00017 int read() { 00018 if (_ptr < _end) 00019 return static_cast<unsigned char>(*_ptr++); 00020 else 00021 return -1; 00022 } 00023 00024 size_t readBytes(char* buffer, size_t length) { 00025 size_t i = 0; 00026 while (i < length && _ptr < _end) buffer[i++] = *_ptr++; 00027 return i; 00028 } 00029 }; 00030 00031 template <typename T> 00032 struct void_ { 00033 typedef void type; 00034 }; 00035 00036 template <typename TSource> 00037 struct Reader<TSource, typename void_<typename TSource::const_iterator>::type> 00038 : IteratorReader<typename TSource::const_iterator> { 00039 explicit Reader(const TSource& source) 00040 : IteratorReader<typename TSource::const_iterator>(source.begin(), 00041 source.end()) {} 00042 }; 00043 } // namespace ARDUINOJSON_NAMESPACE
Generated on Wed Jul 13 2022 01:10:36 by
1.7.2